Skip to content

Fixed Exchanges.sol reverting on deployment due to expecting sortedOracles report on Empty Address#8334

Merged
martinvol merged 32 commits intomasterfrom
tjudice/exchangeFix
Jan 13, 2022
Merged

Fixed Exchanges.sol reverting on deployment due to expecting sortedOracles report on Empty Address#8334
martinvol merged 32 commits intomasterfrom
tjudice/exchangeFix

Conversation

@Tjudice
Copy link
Copy Markdown
Contributor

@Tjudice Tjudice commented Jul 19, 2021

Description

Current behavior: If Exchange.sol was deployed before the corresponding StableToken.sol, a call to _updateBucketsIfNeccesary() in the initialize function would revert the deployment since there was no viable exchange rates. Additionally, instead of using the registry to retrieve the corresponding stable token address, the address was passed as a parameter to the Exchange.sol initialize function and could be change with setStableToken()

Updated Behavior:

  • Added new storage variable stableTokenRegistryId
  • Removed called in initialize function to _updateBucketsIfNeccesary(), so contract deployment will not revert.
  • Changed Initialize function's address stableToken parameter to a string stableTokenIdentifier, which represents the registry identifier for the corresponding stableToken
  • Added function activateStable(), which performs the necessary activation once the stableToken is registered and oracle reports exist.

Testing

Unit tests

Related issues

Backwards compatibility

  • activateStable() will only take effect on contracts where stable == address(0), or exchanges initialized with the new version

@Tjudice Tjudice requested a review from a team July 19, 2021 22:44
@yorhodes yorhodes force-pushed the tjudice/exchangeFix branch from 9a5812e to bef40e1 Compare September 2, 2021 21:31
Comment thread packages/protocol/contracts/stability/Exchange.sol Outdated
Comment thread packages/protocol/contracts/stability/Exchange.sol Outdated
@martinvol martinvol merged commit 1114edb into master Jan 13, 2022
@martinvol martinvol deleted the tjudice/exchangeFix branch January 13, 2022 15:59
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.

Exchange.sol should not expect SortedOracle reports

5 participants