-
Notifications
You must be signed in to change notification settings - Fork 2
Modify zkSync MetaVesT for Yearn BORG director compensation #16
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
base: feat/zk-sync-guardian-compensations
Are you sure you want to change the base?
Modify zkSync MetaVesT for Yearn BORG director compensation #16
Conversation
| function validateTokenApprovalAndBalance(address tokenContract, uint256 total) internal view { | ||
| if ( | ||
| IERC20M(tokenContract).allowance(authority, address(this)) < total || | ||
| IERC20M(tokenContract).balanceOf(authority) < total | ||
| ) revert MetaVesTController_AmountNotApprovedForTransferFrom(); | ||
| } |
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.
Restored from main:
MetaVesT/src/MetaVesTController.sol
Lines 279 to 284 in 6ccd5b6
| function validateTokenApprovalAndBalance(address tokenContract, uint256 total) internal view { | |
| if ( | |
| IERC20M(tokenContract).allowance(authority, address(this)) < total || | |
| IERC20M(tokenContract).balanceOf(authority) < total | |
| ) revert MetaVesTController_AmountNotApprovedForTransferFrom(); | |
| } |
| 0, | ||
| 0 | ||
| ); | ||
| safeTransferFrom(_allocation.tokenContract, authority, vestingAllocation, _total); |
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.
Restored from main:
MetaVesT/src/MetaVesTController.sol
Line 347 in 6ccd5b6
| safeTransferFrom(_allocation.tokenContract, authority, vestingAllocation, _total); |
| if ( | ||
| IERC20M(_tokenContract).allowance(msg.sender, address(this)) < _milestone.milestoneAward || | ||
| IERC20M(_tokenContract).balanceOf(msg.sender) < _milestone.milestoneAward | ||
| ) revert MetaVesT_AmountNotApprovedForTransferFrom(); |
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.
Restored from main:
MetaVesT/src/MetaVesTController.sol
Lines 457 to 460 in 6ccd5b6
| if ( | |
| IERC20M(_tokenContract).allowance(msg.sender, address(this)) < _milestone.milestoneAward || | |
| IERC20M(_tokenContract).balanceOf(msg.sender) < _milestone.milestoneAward | |
| ) revert MetaVesT_AmountNotApprovedForTransferFrom(); |
| //transfer the milestone award back to the authority, we check in the controller to ensure only uncompleted milestones can be removed | ||
| safeTransfer(allocation.tokenContract, getAuthority(), _milestoneAward); |
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.
Restored from main:
MetaVesT/src/BaseAllocation.sol
Lines 267 to 268 in 6ccd5b6
| //transfer the milestone award back to the authority, we check in the controller to ensure only uncompleted milestones can be removed | |
| safeTransfer(allocation.tokenContract, getAuthority(), _milestoneAward); |
| if (_amount > getAmountWithdrawable() || _amount > IERC20M(allocation.tokenContract).balanceOf(address(this))) revert MetaVesT_MoreThanAvailable(); | ||
| tokensWithdrawn += _amount; | ||
| IController(controller).mint(recipient, _amount); | ||
| safeTransfer(allocation.tokenContract, recipient, _amount); |
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.
Restored from main:
MetaVesT/src/BaseAllocation.sol
Lines 308 to 310 in 6ccd5b6
| if (_amount > getAmountWithdrawable() || _amount > IERC20M(allocation.tokenContract).balanceOf(address(this))) revert MetaVesT_MoreThanAvailable(); | |
| tokensWithdrawn += _amount; | |
| safeTransfer(allocation.tokenContract, msg.sender, _amount); |
Primary goal is to keep changes minimum. The real feature changes are only in the following two files:
Changes are for (1) contracts size & stack-too-deep fixes, and (2) replacing capped minter interface with regular ERC20 tokens. Most logic are not new and directly restored from main branch, as shown and commented below.
The remaining changes are all scripts & tests.