-
Notifications
You must be signed in to change notification settings - Fork 48
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
Global optimistic auction rebalance extension #154
Global optimistic auction rebalance extension #154
Conversation
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.
Should add some internal functions that would DRY the contract a bit
Should also add some events.
contracts/global-extensions/GlobalOptimisticAuctionRebalanceExtension.sol
Outdated
Show resolved
Hide resolved
contracts/global-extensions/GlobalOptimisticAuctionRebalanceExtension.sol
Outdated
Show resolved
Hide resolved
contracts/global-extensions/GlobalOptimisticAuctionRebalanceExtension.sol
Show resolved
Hide resolved
require(assertionId != bytes32(0), "Proposal hash does not exist"); | ||
|
||
delete assertionIds[proposalHash]; | ||
delete proposalHashes[assertionId]; |
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.
missed removing the assertedProducts here. probably a good idea to make an internal function that unsets these..
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.
bump to resolve @snake-poison
if (msg.sender == address(settings.optimisticParams.optimisticOracleV3)) { | ||
// Delete the disputed proposal and associated assertionId. | ||
delete assertionIds[proposalHash]; | ||
delete proposalHashes[assertionId]; |
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.
missed removing the assertedProducts here. probably a good idea to make an internal function that unsets these..
…xtension from GlobalAuctionRebalanceExtension.
contracts/global-extensions/GlobalOptimisticAuctionRebalanceExtension.sol
Show resolved
Hide resolved
contracts/global-extensions/GlobalOptimisticAuctionRebalanceExtension.sol
Outdated
Show resolved
Hide resolved
contracts/global-extensions/GlobalOptimisticAuctionRebalanceExtension.sol
Outdated
Show resolved
Hide resolved
/* ============ External Functions ============ */ | ||
|
||
/** | ||
* @dev OPERATOR ONLY: sets product settings for a given quote asset |
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.
* @dev OPERATOR ONLY: sets product settings for a given quote asset | |
* @dev OPERATOR ONLY: sets product settings for a given set token |
contracts/global-extensions/GlobalOptimisticAuctionRebalanceExtension.sol
Show resolved
Hide resolved
contracts/global-extensions/GlobalOptimisticAuctionRebalanceExtension.sol
Outdated
Show resolved
Hide resolved
|
||
|
||
|
||
uint256 minimumBond = settings.optimisticParams.optimisticOracleV3.getMinimumBond(address(settings.optimisticParams.collateral)); | ||
uint256 totalBond = minimumBond > settings.optimisticParams.bondAmount ? minimumBond : settings.optimisticParams.bondAmount; | ||
|
||
settings.optimisticParams.collateral.safeTransferFrom(msg.sender, address(this), totalBond); | ||
settings.optimisticParams.collateral.safeIncreaseAllowance(address(settings.optimisticParams.optimisticOracleV3), totalBond); |
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.
lets clean this up with some internal functions
contracts/global-extensions/GlobalOptimisticAuctionRebalanceExtension.sol
Show resolved
Hide resolved
contracts/global-extensions/GlobalOptimisticAuctionRebalanceExtension.sol
Outdated
Show resolved
Hide resolved
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.
Good stuff.
Mostly added questions for my own understanding.
Also might be worth to review all the docstrings at the end to make sure they align with the function implementations.
contracts/global-extensions/GlobalOptimisticAuctionRebalanceExtension.sol
Outdated
Show resolved
Hide resolved
contracts/global-extensions/GlobalOptimisticAuctionRebalanceExtension.sol
Show resolved
Hide resolved
contracts/global-extensions/GlobalOptimisticAuctionRebalanceExtension.sol
Outdated
Show resolved
Hide resolved
contracts/global-extensions/GlobalOptimisticAuctionRebalanceExtension.sol
Show resolved
Hide resolved
contracts/global-extensions/GlobalOptimisticAuctionRebalanceExtension.sol
Outdated
Show resolved
Hide resolved
contracts/global-extensions/GlobalOptimisticAuctionRebalanceExtension.sol
Outdated
Show resolved
Hide resolved
contracts/global-extensions/GlobalOptimisticAuctionRebalanceExtension.sol
Show resolved
Hide resolved
contracts/global-extensions/GlobalOptimisticAuctionRebalanceExtension.sol
Show resolved
Hide resolved
contracts/global-extensions/GlobalOptimisticAuctionRebalanceExtension.sol
Show resolved
Hide resolved
fix assertedProducts update.
07cb344
to
c633ed5
Compare
08cdb1b
to
0472543
Compare
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.
LGTM! Great Work 🚀
UMA docs: https://docs.uma.xyz/
Interaction Flow closely resembles: https://github.com/UMAprotocol/protocol/blob/master/packages/core/contracts/optimistic-governor/implementation/OptimisticGovernor.sol