-
Notifications
You must be signed in to change notification settings - Fork 28
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
feat: Use RDTTestBase (SC-5205) #42
Conversation
This pull request has been linked to Shortcut Story #5205: [rdt] Refactor tests to use functions for assertions. |
address notStaker; | ||
bytes constant ARITHMETIC_ERROR = abi.encodeWithSignature("Panic(uint256)", 0x11); | ||
|
||
uint256 constant START = 10_000_000; |
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.
Add internal modifier
?
} | ||
|
||
// Deposit asset into RDT | ||
function _depositAsset(address asset_, address staker_, uint256 depositAmount_) internal { |
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.
I think you can remove the asset
from the input parameters since it's already a state variable.
} | ||
|
||
// Transfer funds into RDT and update the vesting schedule | ||
function _transferAndUpdateVesting(address asset_, address rdToken_, uint256 vestingAmount_, uint256 vestingPeriod_) internal { |
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.
I think you can remove asset
and rdToken
from the input parameters since they're already state variables.
Same for all the other utility functions where state variables are available.
} | ||
|
||
// Returns a valid `permit` signature signed by this contract's `owner` address | ||
function _getValidPermitSignature(uint256 value_, address owner_, address spender_, uint256 ownerSk_, uint256 deadline_) internal returns (uint8 v_, bytes32 r_, bytes32 s_) { |
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.
Reorder params to match order in which they are used in the function body.
notOwner = new Owner(); | ||
owner = new Owner(); | ||
asset = new MockERC20("MockToken", "MT", 18); | ||
rdToken = new RDT("Revenue Distribution Token", "RDT", address(owner), address(asset), 1e30); | ||
vm.warp(START); |
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.
Add new line here.
|
||
uint256 constant sampleAssetsToConvert = 1e18; | ||
uint256 constant sampleSharesToConvert = 1e18; | ||
|
||
address staker; | ||
address notStaker; | ||
bytes constant ARITHMETIC_ERROR = abi.encodeWithSignature("Panic(uint256)", 0x11); |
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.
How about adding this to TestUtils
directly?
Added a base test to remove duplicate code