-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
gasgas enhancementgas enhancementhelp wantedExtra attention is neededExtra attention is neededin progressSomething is actively being worked onSomething is actively being worked on
Description
Description
The token model is serialized in the join function and then again in mintShares. It would be cheaper to calculate lambdaDash and mDash in Token.mintShares. This avoids duplicate calls to Ecosystem.deserialize and to Token.serialize.
// mdash
uint256 lambdaDash = SafeMath.add(token.maxLambdaPurchase, token.lambda);
uint256 mDash = ElasticMath.mDash(lambdaDash, token.lambda, token.m);
// serialize the token
Ecosystem.Instance memory ecosystem = _getEcosystem();
Token tokenStorage = Token(ecosystem.tokenModelAddress);
token.m = mDash;
tokenStorage.serialize(token);
// tokencontract mint shares
bool success = tokenContract.mintShares(msg.sender, token.maxLambdaPurchase);
require(success, 'ElasticDAO: Mint Shares Failed during Join');Definition of Done
- mDash and lambdaDash calculations are in the mintShares function
- Token is not serialized in ElasticDAO.join
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
gasgas enhancementgas enhancementhelp wantedExtra attention is neededExtra attention is neededin progressSomething is actively being worked onSomething is actively being worked on