-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Features/hdev 1991 new asset #36
base: main
Are you sure you want to change the base?
Conversation
function configureAssets(DistributionTypes.AssetConfigInput[] calldata assetsConfigInput) external override { | ||
require(msg.sender == EMISSION_MANAGER, 'ONLY_EMISSION_MANAGER'); | ||
|
||
for (uint256 i = 0; i < assetsConfigInput.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cache assetsConfigInput.length in a local var, should save some gas
function _claimRewards(address user, DistributionTypes.UserStakeInput[] memory stakes) internal returns (uint256) { | ||
uint256 accruedRewards = 0; | ||
|
||
for (uint256 i = 0; i < stakes.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same, cache stakes.length to save some gas
) internal view returns (uint256) { | ||
uint256 accruedRewards = 0; | ||
|
||
for (uint256 i = 0; i < stakes.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cache stakes.length to save some gas
uint256 reserveIndex, | ||
uint256 userIndex | ||
) internal pure returns (uint256) { | ||
return principalUserBalance.mul(reserveIndex.sub(userIndex)).div(10 ** uint256(PRECISION)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because PRECISION is in 18 decimals, this line of code assumes principalUserBalance
and reserveIndex
and userIndex
are also in 18 decimals. Is that ALWAYS going to be the case?
uint256 timeDelta = currentTimestamp.sub(lastUpdateTimestamp); | ||
//console.log("timeDelta: ", timeDelta); | ||
//console.log("emissionPerSecond: ", emissionPerSecond); | ||
return emissionPerSecond.mul(timeDelta).mul(10 ** uint256(PRECISION)).div(totalBalance).add(currentIndex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
emissionPerSecond * timeDelta * 1e18 / totalBalance + currentIndex
I don't understand why currentIndex is being added here.
address constant aTokenAddress = address(0); // @todo change | ||
address constant sdtAddress = address(0); // @todo change | ||
address constant vdtAddress = address(0); // @todo change | ||
address constant aTokenImplAddress = address(0); // @todo change |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are the vars necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will transform this to a config!
Description of Changes
Link to Jira Ticket
How To Test
Developer Checklist:
feature/HDEV-XXX-description
Reviewers Checklist: