Fixed Exchanges.sol reverting on deployment due to expecting sortedOracles report on Empty Address#8334
Merged
Fixed Exchanges.sol reverting on deployment due to expecting sortedOracles report on Empty Address#8334
Conversation
… address for stable token contract.
…ase to updateBuckets first
…ient manner for testing
9a5812e to
bef40e1
Compare
0f164f2 to
3732256
Compare
yorhodes
approved these changes
Oct 29, 2021
nambrot
reviewed
Oct 29, 2021
m-chrzan
approved these changes
Nov 1, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
stableTokenRegistryId_updateBucketsIfNeccesary(), so contract deployment will not revert.stableTokenparameter to a stringstableTokenIdentifier, which represents the registry identifier for the correspondingstableTokenactivateStable(), 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 wherestable == address(0), or exchanges initialized with the new version