Skip to content

Commit

Permalink
Merge branch 'main' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
bpierre committed Dec 19, 2024
2 parents ef789e0 + 56c9523 commit 216e13e
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 18 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
- [13 - Trove Adjustments May Be Griefed by Sandwich Raising the Average Interest Rate](#13---trove-adjustments-may-be-griefed-by-sandwich-raising-the-average-interest-rate)
- [14 - Stability Pool Claiming and Compounding Yield Can Be Used to Gain a Slightly Higher Rate of Rewards](#14---stability-pool-claiming-and-compounding-yield-can-be-used-to-gain-a-slightly-higher-rate-of-rewards)
- [15 - Urgent Redemptions Premium Can Worsen the ICR](#15---urgent-redemptions-premium-can-worsen-the-icr)
- [Issues identified in audits requiring no fix](#issues-identified-in-audits-requiring-no-fix)

27. [Requirements](#requirements)

Expand Down Expand Up @@ -1570,3 +1571,6 @@ This may be used to lock in a bit more bad debt.
Liquidations already carry a collateral premium to the caller and to the liquidators.

Redemptions at this CR may allow for a bit more bad debt to be redistributed which could cause a liquidation cascade, however the difference doesn't seem particularly meaningful when compared to how high the Liquidation Premium tends to be for liquidations.

### Issues identified in audits requiring no fix
A collection of issues identified in security audits which nevertheless do not require a fix [can be found here](https://github.com/liquity/bold/labels/wontfix).
4 changes: 1 addition & 3 deletions contracts/script/DeployLiquity2.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,7 @@ contract DeployLiquity2Script is DeployGovernance, UniPriceConverter, StdCheats,
vm.startBroadcast(privateKey);
}

if (vm.envBool("USE_TESTNET_PRICEFEEDS")) {
useTestnetPriceFeeds = true;
}
useTestnetPriceFeeds = vm.envOr("USE_TESTNET_PRICEFEEDS", false);

console2.log(deployer, "deployer");
console2.log(deployer.balance, "deployer balance");
Expand Down
9 changes: 6 additions & 3 deletions contracts/src/PriceFeeds/RETHPriceFeed.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,14 @@ contract RETHPriceFeed is CompositePriceFeed, IRETHPriceFeed {
(uint256 rEthEthPrice, bool rEthEthOracleDown) = _getOracleAnswer(rEthEthOracle);
(uint256 rEthPerEth, bool exchangeRateIsDown) = _getCanonicalRate();

// If the ETH-USD feed is down, shut down and switch to the last good price seen by the system
// since we need both ETH-USD and canonical for primary and fallback price calcs
if (ethUsdOracleDown || exchangeRateIsDown) {
// If either the ETH-USD feed or exchange rate is down, shut down and switch to the last good price
// seen by the system since we need both for primary and fallback price calcs
if (ethUsdOracleDown) {
return (_shutDownAndSwitchToLastGoodPrice(address(ethUsdOracle.aggregator)), true);
}
if (exchangeRateIsDown) {
return (_shutDownAndSwitchToLastGoodPrice(rateProviderAddress), true);
}
// If the ETH-USD feed is live but the RETH-ETH oracle is down, shutdown and substitute RETH-ETH with the canonical rate
if (rEthEthOracleDown) {
return (_shutDownAndSwitchToETHUSDxCanonical(address(rEthEthOracle.aggregator), ethUsdPrice), true);
Expand Down
7 changes: 5 additions & 2 deletions contracts/src/PriceFeeds/WSTETHPriceFeed.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ contract WSTETHPriceFeed is CompositePriceFeed, IWSTETHPriceFeed {
// - If exchange rate or ETH-USD is down, shut down and switch to last good price. Reasoning:
// - Exchange rate is used in all price calcs
// - ETH-USD is used in the fallback calc, and for redemptions in the primary price calc
if (exchangeRateIsDown || ethUsdOracleDown) {
return (_shutDownAndSwitchToLastGoodPrice(address(stEthUsdOracle.aggregator)), true);
if (exchangeRateIsDown) {
return (_shutDownAndSwitchToLastGoodPrice(rateProviderAddress), true);
}
if (ethUsdOracleDown) {
return (_shutDownAndSwitchToLastGoodPrice(address(ethUsdOracle.aggregator)), true);
}

// If the STETH-USD feed is down, shut down and try to substitute it with the ETH-USD price
Expand Down
32 changes: 22 additions & 10 deletions contracts/utils/deploy-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Options:
--rpc-url <RPC_URL> RPC URL to use.
--slow Only send a transaction after the previous
one has been confirmed.
--use-testnet-pricefeeds Use testnet PriceFeeds instead of real
oracles when deploying to mainnet.
--verify Verify contracts after deployment.
--verifier <VERIFIER> Verification provider to use.
Possible values: etherscan, sourcify.
Expand All @@ -56,6 +58,7 @@ const argv = minimist(process.argv.slice(2), {
"verify",
"dry-run",
"slow",
"use-testnet-pricefeeds",
],
string: [
"chain-id",
Expand Down Expand Up @@ -117,7 +120,7 @@ export async function main() {

const forgeArgs: string[] = [
"script",
"src/scripts/DeployLiquity2.s.sol",
"DeployLiquity2Script",
"--chain-id",
String(options.chainId),
"--rpc-url",
Expand Down Expand Up @@ -172,15 +175,16 @@ export async function main() {
echo`
Deploying Liquity contracts with the following settings:
CHAIN_ID: ${options.chainId}
DEPLOYER: ${options.deployer}
LEDGER_PATH: ${options.ledgerPath}
ETHERSCAN_API_KEY: ${options.etherscanApiKey && "(secret)"}
OPEN_DEMO_TROVES: ${options.openDemoTroves ? "yes" : "no"}
RPC_URL: ${options.rpcUrl}
VERIFY: ${options.verify ? "yes" : "no"}
VERIFIER: ${options.verifier}
VERIFIER_URL: ${options.verifierUrl}
CHAIN_ID: ${options.chainId}
DEPLOYER: ${options.deployer}
LEDGER_PATH: ${options.ledgerPath}
ETHERSCAN_API_KEY: ${options.etherscanApiKey && "(secret)"}
OPEN_DEMO_TROVES: ${options.openDemoTroves ? "yes" : "no"}
RPC_URL: ${options.rpcUrl}
USE_TESTNET_PRICEFEEDS: ${options.useTestnetPricefeeds ? "yes" : "no"}
VERIFY: ${options.verify ? "yes" : "no"}
VERIFIER: ${options.verifier}
VERIFIER_URL: ${options.verifierUrl}
`;

process.env.DEPLOYER = options.deployer;
Expand All @@ -189,6 +193,10 @@ Deploying Liquity contracts with the following settings:
process.env.OPEN_DEMO_TROVES = "true";
}

if (options.useTestnetPricefeeds) {
process.env.USE_TESTNET_PRICEFEEDS = "true";
}

if ("CI" in process.env) {
echo("Workaround: deleting variable 'CI' from environment"); // See https://github.com/liquity/bold/pull/113
delete process.env.CI;
Expand Down Expand Up @@ -297,6 +305,7 @@ async function parseArgs() {
verifier: argv["verifier"],
verifierUrl: argv["verifier-url"],
gasPrice: argv["gas-price"],
useTestnetPricefeeds: argv["use-testnet-pricefeeds"],
};

const [networkPreset] = argv._;
Expand All @@ -312,6 +321,9 @@ async function parseArgs() {
process.env.OPEN_DEMO_TROVES && process.env.OPEN_DEMO_TROVES !== "false",
);
options.rpcUrl ??= process.env.RPC_URL;
options.useTestnetPricefeeds ??= Boolean(
process.env.USE_TESTNET_PRICEFEEDS && process.env.USE_TESTNET_PRICEFEEDS !== "false",
);
options.verify ??= Boolean(
process.env.VERIFY && process.env.VERIFY !== "false",
);
Expand Down

0 comments on commit 216e13e

Please sign in to comment.