Skip to content
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

Update eXOF proposal with EUROCXOF rateFeed #127

Merged
merged 18 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
25 changes: 16 additions & 9 deletions script/upgrades/eXOF/Config.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
// Rate Feeds
Config.RateFeed CELOXOF;
Config.RateFeed EURXOF;
Config.RateFeed EUROCXOF;
Config.RateFeed[] rateFeeds;
Config.StableToken stableTokenXOF;
}
Expand All @@ -40,9 +41,10 @@
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[2] = config.EUROCXOF = EUROCXOF_RateFeedConfig(contracts);

config.stableTokenXOF = stableTokenXOFConfig();
}
Expand All @@ -60,32 +62,37 @@
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"));
bowd marked this conversation as resolved.
Show resolved Hide resolved
}

/**
* @dev Returns the configuration for the EURXOF rate feed.
*/
function EURXOF_RateFeedConfig(
function EUROCXOF_RateFeedConfig(
Contracts.Cache storage contracts

Check warning on line 74 in script/upgrades/eXOF/Config.sol

View workflow job for this annotation

GitHub Actions / Lint & Build

Variable "contracts" is unused
) internal returns (Config.RateFeed memory rateFeedConfig) {
rateFeedConfig.rateFeedID = contracts.dependency("EURXOFRateFeedAddr");
rateFeedConfig.rateFeedID = Config.rateFeedID("EUROCXOF");
rateFeedConfig.valueDeltaBreaker0 = Config.ValueDeltaBreaker({
enabled: true,
threshold: FixidityLib.newFixedFraction(5, 1000), // 0.005
Copy link
Contributor

@sissnad sissnad Sep 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this value breaker on EURXOF has two consequences:

  1. Only one of the base pairs that build EUROC/XOF has a tight (50bps) value breaker
  2. The CELO/eXOF pool will only inherit the 10% value breaker. In particular, CELO/eXOF will stay active while EUROC/eXOF is suspended until it auto-recovers.

I think we could live with 1, by maybe lowering EUROC/XOF value breaker threshold to 50bps.
But 2 does not feel great. Allowing minting / redemption through CELO/eXOF while we do not via EUROC

threshold: FixidityLib.newFixedFraction(10, 1000), // 0.01
nvtaveras marked this conversation as resolved.
Show resolved Hide resolved
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(
Contracts.Cache storage contracts

Check warning on line 87 in script/upgrades/eXOF/Config.sol

View workflow job for this annotation

GitHub Actions / Lint & Build

Variable "contracts" is unused
) internal 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 +151,7 @@
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
Loading