-
Notifications
You must be signed in to change notification settings - Fork 6
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
Added test for RewardsReceiver and SharedDepositMinterV2 #18
Added test for RewardsReceiver and SharedDepositMinterV2 #18
Conversation
looks like CI is failing here
|
hmm are you sure you uploaded all files? maybe missing local changes? |
test/v2/core/minter.spec.js
Outdated
const numValidators = 1000; | ||
const adminFee = 0; | ||
|
||
const FeeCalc = await ethers.getContractFactory("FeeCalc"); |
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.
try to use the zero address for this like the deploy instead.
the idea was to flesh out and launch a fee calc contract for configuring fees later. but it should default to running internal logic if the passed in address is address(0)
test/v2/core/minter.spec.js
Outdated
expect(afterStake).to.eq(prevStake.add(parseEther("1"))); | ||
}); | ||
|
||
it("depositAndStakeFor", async () => { |
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.
can we add a test to make sure this works for the direction case?
i.e. Alice calls the function, but with Bobs address, and bob recvs the tokens in the end
test/v2/core/minter.spec.js
Outdated
expect(afterBalance).to.eq(prevBalance.sub(parseEther("0.5"))); | ||
|
||
prevBalance = await sgEth.balanceOf(alice.address); | ||
await minter.connect(alice).withdrawTo(parseEther("0.5"), alice.address); |
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 as above, can we test this works for directing rewards to others?
|
||
expect(afterBalance).to.eq(prevBalance.sub(parseEther("0.5"))); | ||
}); | ||
|
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.
can we add a comment here denoting all the functions below are Admin or Keeper functions?
And that we are checking that the auth is safe on them?
are we missing anything obvious here in the tests? weird its not showing more like 100% cov
|
Actually I'm not sure what should I test on Rollover contract. it's just have one internal function. |
ah ok, can you add tests for the owner functions, check to see they work only for the owner? @devlancer412 |
test/v2/core/minter.spec.js
Outdated
}); | ||
|
||
it("slash", async () => { | ||
const GOV_ROLE = await minter.GOV(); |
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.
example:
- user deposits
- rewards generated
- reward sync called
- slash called
- user redeems
ensure user does not get back >1
@chimera-defi Please check last updates |
nice, can we fix the build plz? @devlancer412 |
@chimera-defi merged another test pr to here |
|
||
storedTotalAssets = storedTotalAssets_ + lastRewardAmount_; // SSTORE | ||
if (end - timestamp < rewardsCycleLength / 20) { |
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.
whats with the changes here? can we reset this file to head?
ill add any auto lint stuff later
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.
don't have any changes on this file. all changes are from prettier such as removing spaces
a999e52
into
chimera-defi:ch/contractImprovements
No description provided.