-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add MakerEscrow #85
base: dev
Are you sure you want to change the base?
Add MakerEscrow #85
Conversation
src/escrows/MakerEscrow.sol
Outdated
uint mkrBal = token.balanceOf(address(this)); | ||
if(address(voteDelegate) != address(0)){ | ||
uint staked = voteDelegate.stake(address(this)); | ||
voteDelegate.lock(mkrBal - staked); |
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.
all mkrBal
balance should be locked otherwise some mkr won't be locked depending on the staked
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.
Unless there's an external inbound transfer that doesn't properly call onDeposit
. Not sure if that's worth taking into account or not.
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 was referring that if someone deposits twice the same amount for example, it wouldn't lock the second deposit
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.
and if the amount staked is higher than the new deposit it would revert underflow
src/escrows/MakerEscrow.sol
Outdated
if(msg.sender != beneficiary) revert OnlyBeneficiary(); | ||
if(address(voteDelegate) != address(0)){ | ||
uint stake = voteDelegate.stake(address(this)); | ||
iou.approve(address(voteDelegate), stake); |
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.
this approval is not needed bc we already max approve when setting the voteDelegate
, but could be worth to reset the approvals(iou
and token
) when changing vote delegate
src/escrows/MakerEscrow.sol
Outdated
/** | ||
* @notice Get the owner of the `voteDelegate` contract that is being delegated to. | ||
*/ | ||
function delegate() external returns(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.
view function
src/escrows/MakerEscrow.sol
Outdated
interface IVoteDelegate { | ||
function lock(uint) external; | ||
function free(uint) external; | ||
function stake(address) external returns(uint); |
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.
stake
and delegate
are view functions
src/escrows/MakerEscrow.sol
Outdated
} | ||
|
||
interface IVoteDelegateFactory { | ||
function isDelegate(address) external returns(bool); |
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.
isDelegate
and delegates
are view functions
No description provided.