-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: $cCOP launch deployment scripts #226
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
999f434
chore: copy PUSO scripts into cCOP folder
nvtaveras 6352d42
chore: change PUSO references to cCOP
nvtaveras de7c60f
chore: rename PUSO scripts to cCOP
nvtaveras 71f8951
chore: fix imports after renaming scripts
nvtaveras c1498f0
chore: adjust $cCOP pool params to the COP/USD exchnge rate
nvtaveras dab6f82
fix: revert reset frequency to 5 minutes
nvtaveras 423417c
refactor: update token name
bayological File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
// solhint-disable func-name-mixedcase, contract-name-camelcase, function-max-lines, var-name-mixedcase | ||
pragma solidity ^0.5.13; | ||
pragma experimental ABIEncoderV2; | ||
|
||
import { Chain } from "script/utils/Chain.sol"; | ||
import { Config } from "script/utils/Config.sol"; | ||
import { Contracts } from "script/utils/Contracts.sol"; | ||
import { FixidityLib } from "script/utils/FixidityLib.sol"; | ||
|
||
/** | ||
* @dev This library contains the configuration required for the cCOP governance proposal. | ||
* The following configuration is used: | ||
* - 1 pool: cCOP<->cUSD | ||
* - 1 rate feed: COPUSD | ||
* - Configuration params needed to initialize the cCOP stable token | ||
*/ | ||
library cCOPConfig { | ||
using FixidityLib for FixidityLib.Fraction; | ||
using Contracts for Contracts.Cache; | ||
|
||
struct cCOP { | ||
Config.Pool poolConfig; | ||
Config.RateFeed rateFeedConfig; | ||
Config.StableTokenV2 stableTokenConfig; | ||
} | ||
|
||
/** | ||
* @dev Returns the populated configuration object for the cCOP governance proposal. | ||
*/ | ||
function get(Contracts.Cache storage contracts) internal view returns (cCOP memory config) { | ||
config.poolConfig = cCOPcUSD_PoolConfig(contracts); | ||
config.rateFeedConfig = COPUSD_RateFeedConfig(); | ||
config.stableTokenConfig = stableTokencCOPConfig(); | ||
} | ||
|
||
/* ==================== Rate Feed Configuration ==================== */ | ||
|
||
/** | ||
* @dev Returns the configuration for the COPUSD rate feed. | ||
*/ | ||
function COPUSD_RateFeedConfig() internal pure returns (Config.RateFeed memory rateFeedConfig) { | ||
// TODO: Get confirmation for Roman that these are OK | ||
// These are the exact same as the $PUSO rate feed config | ||
rateFeedConfig.rateFeedID = Config.rateFeedID("relayed:COPUSD"); | ||
rateFeedConfig.medianDeltaBreaker0 = Config.MedianDeltaBreaker({ | ||
enabled: true, | ||
threshold: FixidityLib.newFixedFraction(4, 100), // 4% | ||
cooldown: 15 minutes, | ||
smoothingFactor: FixidityLib.newFixedFraction(5, 1000).unwrap() // 0.005 | ||
}); | ||
} | ||
|
||
/* ==================== Pool Configuration ==================== */ | ||
|
||
/** | ||
* @dev Returns the configuration for the cCOPcUSD pool. | ||
*/ | ||
function cCOPcUSD_PoolConfig( | ||
Contracts.Cache storage contracts | ||
) internal view returns (Config.Pool memory poolConfig) { | ||
// TODO: Get confirmation from Roman that these are OK | ||
// These were taken from the $PUSO pool and adjusted to the COP/USD exchange rate, | ||
// which was 0.00023747 at the time of writing | ||
poolConfig = Config.Pool({ | ||
asset0: contracts.celoRegistry("StableToken"), | ||
asset1: contracts.deployed("StableTokenCOPProxy"), | ||
isConstantSum: true, | ||
spread: FixidityLib.newFixedFraction(3, 1000), // 0.3%, in line with current DT of chainlink feed | ||
nvtaveras marked this conversation as resolved.
Show resolved
Hide resolved
|
||
referenceRateResetFrequency: 5 minutes, | ||
minimumReports: 1, | ||
stablePoolResetSize: 10_000_000 * 1e18, | ||
referenceRateFeedID: Config.rateFeedID("relayed:COPUSD"), | ||
asset0limits: Config.TradingLimit({ | ||
enabled0: true, | ||
timeStep0: 5 minutes, | ||
limit0: 200_000, | ||
enabled1: true, | ||
timeStep1: 1 days, | ||
limit1: 1_000_000, | ||
enabledGlobal: true, | ||
limitGlobal: 5_000_000 | ||
}), | ||
asset1limits: Config.TradingLimit({ | ||
enabled0: true, | ||
timeStep0: 5 minutes, | ||
limit0: 4211 * 200_000, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rcroessmann Took this rate from the chainlink COP/USD aggregator directly https://celoscan.io/address/0x97b770B0200CCe161907a9cbe0C6B177679f8F7C#readContract |
||
enabled1: true, | ||
timeStep1: 1 days, | ||
limit1: 4211 * 1_000_000, | ||
enabledGlobal: true, | ||
limitGlobal: 4211 * 5_000_000 | ||
}) | ||
}); | ||
} | ||
|
||
/* ==================== Stable Token Configuration ==================== */ | ||
|
||
/** | ||
* @dev Returns the configuration for the cCOP stable token. | ||
*/ | ||
function stableTokencCOPConfig() internal pure returns (Config.StableTokenV2 memory config) { | ||
config = Config.StableTokenV2({ name: "Celo Colombian Peso", symbol: "cCOP" }); | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
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.
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.
@rcroessmann Didn't update any of the circuit breaker parameters below