Replies: 2 comments 6 replies
-
Personally, I'd still go with the Factory pattern. My main reason is that It separates concerns: mentally (your last point) and technically too - no "filter by asset and campaign" needed, no state mixed between campaigns. Airstreams feel like a more independent feature, rather than a centralized protocol architecture like the one we use for the core. At the same time, I've no great technical argument for why a Would you mind explaining more about the Accounting and TVL points? Not sure I understand why accounting would be more difficult, or why we'd lose TVL. Agree on the indexing (tracking one instance vs. multiple), although it feels like a minor point. |
Beta Was this translation helpful? Give feedback.
-
IMO the factory pattern is the better choice here, primarily due to the notable difference in complexity between the systems. A system with greater complexity tends to be more prone to errors. Regarding the cons of the factory, as @razgraf also mention, TVL and Accounting are minor points, and the gas one, yes it is cheaper from the sender point of view, but in the perspective of the recipient it would be more expensive due to a more complex mapping for the eligibility checking, plus the campaign checkings: mapping(uint256 airstreamId => mapping(uint256 => uint256)) private _claimedBitMap;
enum CampaignType{
LockupLinear;
LockupDynamic;
}
function claim(Params params) public{
// ...
CampaignType campaignType = getCampaignType(airstreamId);
if( campaignType == CampaignType.LockupLinear){
lockupLinear.createWithDurations(createParams);
} else if (campaignType == CampaignType.LockupDynamic){
lockupDynamic.createWithDeltas(createParams);
} Probably there would be more checks required which I can't think of without actually starting to implement. Yes, the gas difference between the Factory pattern here is more "elegant" 😁. |
Beta Was this translation helpful? Give feedback.
-
Problem Situation
The current design on the
feat/airstreams
branch involves anAirstreamsFactory
contract that deploys a bespokeAirstreams
contract for every airstream creator. But now I realize that we don't necessarily have to design the airstreams like this. We could instead have a monolith contract where all airstream campaigns are bundled together; there would be anAirstream
struct and anairstreams
mapping.Comparison
My Thoughts
In an ideal world, we would build both the factory and the monolith. In the UI, we would default to using the latter. Elsewhere, we would mention the possibility of creating bespoke
Airstreams
deployments (to cater to users who prefer to deploy custom contracts).However, we have limited resources (time and money for audits), so our first MVP should contain only one design. But I can't decide which is better because the pros/ cons analysis doesn't tilt the balance in any particular direction.
WDYT, @razgraf, @andreivladbrg?
Beta Was this translation helpful? Give feedback.
All reactions