Skip to content

Commit

Permalink
fix: update eXOF proposal with EUROCXOF rateFeed (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
bowd authored Sep 21, 2023
1 parent f323290 commit 411686f
Show file tree
Hide file tree
Showing 15 changed files with 494 additions and 655 deletions.
27 changes: 27 additions & 0 deletions bin/cgp-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

##############################################################################
# Script for running Governance Proposal Checks on top of a network
# Usage: yarn cgp:check
# -n <baklava|alfajores|celo> -- network to submit the proposal to
# -u <upgrade_name> -- name of the upgrade (MU01)
# Example: yarn cgp:check -n baklava -u MU03
##############################################################################

source "$(dirname "$0")/setup.sh"

NETWORK=""
UPGRADE=""
while getopts n:u:p:sfr flag
do
case "${flag}" in
n) NETWORK=${OPTARG};;
u) UPGRADE=${OPTARG};;
esac
done

parse_network "$NETWORK"
parse_upgrade "$UPGRADE"

echo "👀 Checking $UPGRADE"
forge script $(forge_skip $UPGRADE) --rpc-url $RPC_URL --skip .dev.sol --sig "check(string)" script/utils/SimulateUpgrade.sol:SimulateUpgrade $UPGRADE
22 changes: 17 additions & 5 deletions bin/cgp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# -n <baklava|alfajores|celo> -- network to submit the proposal to
# -u <upgrade_name> -- name of the upgrade (MU01)
# -s -- simulate the proposal (optional)
# -r -- revert
# -f -- use forked network (optional)
# Example: yarn cgp -n baklava -u MU01 -p 1
##############################################################################
Expand All @@ -16,13 +17,15 @@ NETWORK=""
UPGRADE=""
SIMULATE=false
USE_FORK=false
while getopts n:u:p:sf flag
REVERT=false
while getopts n:u:p:sfr flag
do
case "${flag}" in
n) NETWORK=${OPTARG};;
u) UPGRADE=${OPTARG};;
s) SIMULATE=true;;
f) USE_FORK=true;;
r) REVERT=true;;
esac
done

Expand All @@ -36,13 +39,22 @@ if [ "$USE_FORK" = true ] ; then
echo "🍴 Submitting to forked network"
fi


if [ "$REVERT" = true ] ; then
CONTRACT=$UPGRADE'Revert'
echo "🔄 Reverting $UPGRADE via $CONTRACT"
else
CONTRACT=$UPGRADE
echo "🔥 Submitting $UPGRADE via $CONTRACT"
fi

if [ "$SIMULATE" = true ] ; then
echo "🥸 Simulating $UPGRADE"
forge script $(forge_skip $UPGRADE) --rpc-url $RPC_URL --skip .dev.sol --sig "run(string)" script/utils/SimulateUpgrade.sol:SimulateUpgrade $UPGRADE
echo "🥸 Simulating $CONTRACT"
forge script $(forge_skip $UPGRADE) --rpc-url $RPC_URL --skip .dev.sol --sig "run(string)" script/utils/SimulateUpgrade.sol:SimulateUpgrade $CONTRACT
else
echo "🔥 Submitting $UPGRADE"
echo "🔥 Submitting $CONTRACT"
confirm_if_celo "$NETWORK"
forge script $(forge_skip $UPGRADE) --rpc-url $RPC_URL --legacy --broadcast ${UPGRADE}
forge script $(forge_skip $UPGRADE) --rpc-url $RPC_URL --legacy --broadcast ${CONTRACT}
fi


Expand Down

This file was deleted.

This file was deleted.

25 changes: 0 additions & 25 deletions contracts/NonrecoverableValueDeltaBreaker.sol

This file was deleted.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"cgp": "./bin/cgp.sh",
"cgp:pass": "./bin/cgp-pass.sh",
"cgp:diff": "./bin/cgp-diff.sh",
"cgp:check": "./bin/cgp-check.sh",
"cgp:yaml-to-json": "./bin/cgp-yaml-to-json.sh",
"show": "./bin/show.sh",
"clean": "./bin/clean.sh",
Expand Down
27 changes: 15 additions & 12 deletions script/upgrades/eXOF/Config.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ library eXOFConfig {
// Rate Feeds
Config.RateFeed CELOXOF;
Config.RateFeed EURXOF;
Config.RateFeed EUROCXOF;
Config.RateFeed[] rateFeeds;
Config.StableToken stableTokenXOF;
}
Expand All @@ -40,9 +41,10 @@ library eXOFConfig {
config.pools[0] = config.eXOFCelo = eXOFCelo_PoolConfig(contracts);
config.pools[1] = config.eXOFEUROC = eXOFEUROC_PoolConfig(contracts);

config.rateFeeds = new Config.RateFeed[](2);
config.rateFeeds = new Config.RateFeed[](3);
config.rateFeeds[0] = config.CELOXOF = CELOXOF_RateFeedConfig(contracts);
config.rateFeeds[1] = config.EURXOF = EURXOF_RateFeedConfig(contracts);
config.rateFeeds[1] = config.EURXOF = EURXOF_RateFeedConfig();
config.rateFeeds[2] = config.EUROCXOF = EUROCXOF_RateFeedConfig();

config.stableTokenXOF = stableTokenXOFConfig();
}
Expand All @@ -54,38 +56,39 @@ library eXOFConfig {
*/
function CELOXOF_RateFeedConfig(
Contracts.Cache storage contracts
) internal returns (Config.RateFeed memory rateFeedConfig) {
) internal view returns (Config.RateFeed memory rateFeedConfig) {
rateFeedConfig.rateFeedID = contracts.deployed("StableTokenXOFProxy");
rateFeedConfig.medianDeltaBreaker0 = Config.MedianDeltaBreaker({
enabled: true,
threshold: FixidityLib.newFixedFraction(3, 100), // 0.03
cooldown: 30 minutes,
smoothingFactor: 0
smoothingFactor: 1e24 // 1
});
rateFeedConfig.dependentRateFeeds = Arrays.addresses(contracts.dependency("EURXOFRateFeedAddr"));
rateFeedConfig.dependentRateFeeds = Arrays.addresses(Config.rateFeedID("EURXOF"), Config.rateFeedID("EUROCXOF"));
}

/**
* @dev Returns the configuration for the EURXOF rate feed.
*/
function EURXOF_RateFeedConfig(
Contracts.Cache storage contracts
) internal returns (Config.RateFeed memory rateFeedConfig) {
rateFeedConfig.rateFeedID = contracts.dependency("EURXOFRateFeedAddr");
function EUROCXOF_RateFeedConfig() internal view returns (Config.RateFeed memory rateFeedConfig) {
rateFeedConfig.rateFeedID = Config.rateFeedID("EUROCXOF");
rateFeedConfig.valueDeltaBreaker0 = Config.ValueDeltaBreaker({
enabled: true,
threshold: FixidityLib.newFixedFraction(5, 1000), // 0.005
referenceValue: 655.957 * 10 ** 24,
cooldown: 15 minutes
});
rateFeedConfig.dependentRateFeeds = Arrays.addresses(Config.rateFeedID("EURXOF"), Config.rateFeedID("EUROCEUR"));
}

rateFeedConfig.valueDeltaBreaker1 = Config.ValueDeltaBreaker({
function EURXOF_RateFeedConfig() internal view returns (Config.RateFeed memory rateFeedConfig) {
rateFeedConfig.rateFeedID = Config.rateFeedID("EURXOF");
rateFeedConfig.valueDeltaBreaker0 = Config.ValueDeltaBreaker({
enabled: true,
threshold: FixidityLib.newFixedFraction(10, 100), // 0.10
referenceValue: 655.957 * 10 ** 24,
cooldown: 0 seconds
});
rateFeedConfig.dependentRateFeeds = Arrays.addresses(contracts.dependency("EUROCEURRateFeedAddr"));
}

/* ==================== Pool Configurations ==================== */
Expand Down Expand Up @@ -144,7 +147,7 @@ library eXOFConfig {
minimumReports: 5,
referenceRateResetFrequency: 5 minutes,
stablePoolResetSize: 656 * 1_000_000 * 1e18, // 656 * 1.0 million
referenceRateFeedID: contracts.dependency("EURXOFRateFeedAddr"),
referenceRateFeedID: Config.rateFeedID("EUROCXOF"),
asset0limits: Config.TradingLimit({
enabled0: true,
timeStep0: 5 minutes,
Expand Down

This file was deleted.

Loading

0 comments on commit 411686f

Please sign in to comment.