Skip to content
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

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open

Add MakerEscrow #85

wants to merge 6 commits into from

Conversation

08xmt
Copy link
Contributor

@08xmt 08xmt commented Aug 24, 2024

No description provided.

@08xmt 08xmt marked this pull request as ready for review August 26, 2024 10:35
src/escrows/MakerEscrow.sol Outdated Show resolved Hide resolved
uint mkrBal = token.balanceOf(address(this));
if(address(voteDelegate) != address(0)){
uint staked = voteDelegate.stake(address(this));
voteDelegate.lock(mkrBal - staked);
Copy link

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

Copy link
Contributor Author

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.

Copy link

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

Copy link

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

if(msg.sender != beneficiary) revert OnlyBeneficiary();
if(address(voteDelegate) != address(0)){
uint stake = voteDelegate.stake(address(this));
iou.approve(address(voteDelegate), stake);
Copy link

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

/**
* @notice Get the owner of the `voteDelegate` contract that is being delegated to.
*/
function delegate() external returns(address){
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

view function

interface IVoteDelegate {
function lock(uint) external;
function free(uint) external;
function stake(address) external returns(uint);
Copy link

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

}

interface IVoteDelegateFactory {
function isDelegate(address) external returns(bool);
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants