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

Add USDC market on Scroll mainnet #824

Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
c9d6bd8
debug
Aug 30, 2023
2052b10
update price feed
Sep 1, 2023
35d0a4a
update config
Sep 1, 2023
f0f3398
temp workaround
Sep 1, 2023
4aa336b
add scroll to scenarios
Sep 1, 2023
11a826f
uncomment spider debug messages
Sep 7, 2023
ef562e7
add scroll relations
Sep 7, 2023
e99e2f1
catch failed spider crawls
Sep 7, 2023
e3bb341
Fix spider for scroll
kevincheng96 Sep 7, 2023
4f40e49
update bridge receiver to be compatible with scroll bridge
Sep 8, 2023
5148b9a
update relations
Sep 8, 2023
62589ae
Modified deployment roots from GitHub Actions
Sep 11, 2023
76091fd
Merge branch 'main' of github.com:compound-finance/comet
Sep 11, 2023
04139b5
remove console.log
Sep 11, 2023
b72a9df
rename scroll messenger
Sep 11, 2023
cf25e22
add scroll to governance scenarios
Sep 11, 2023
f06c198
adapt scroll relay message fn
Sep 12, 2023
5d4f484
Merge branch 'isabellewei/scroll-deploy' of github.com:compound-finan…
Sep 14, 2023
d9e6a55
fix unit tests
Sep 19, 2023
582b5f2
rename contracts and update message relaying
Sep 27, 2023
42b1363
Merge branch 'isabellewei/scroll-deploy' of github.com:compound-finan…
Sep 27, 2023
742892b
Merge branch 'isabellewei/scroll-deploy' of github.com:compound-finan…
Sep 28, 2023
4912c5f
Merge branch 'isabellewei/scroll-deploy' of github.com:compound-finan…
Oct 1, 2023
6632c40
Merge branch 'isabellewei/scroll-deploy' of github.com:compound-finan…
Oct 25, 2023
aca0b92
update scroll testnet block explorer URL
Oct 25, 2023
d461ce1
remove base fee
Oct 26, 2023
dcae3f3
fix scroll l2 sender address
Oct 26, 2023
2003c6d
remove old roots
Oct 26, 2023
e695355
fix type errors
Oct 26, 2023
75e0ea3
Modified deployment roots from GitHub Actions
Oct 26, 2023
18ce6a8
proposal for intializing usdc market on scroll goerli
Nov 2, 2023
9a62f93
add configurator to scroll relations
Nov 4, 2023
d712351
Merge branch 'isabellewei/scroll-deploy' of github.com:compound-finan…
Nov 7, 2023
0d421ad
PR comments
Nov 9, 2023
ff98c16
add docstrings
Jan 3, 2024
d51e02e
emit event when intializing ScrollBridgeReceiver
Jan 3, 2024
9001e27
PR comments
Jan 4, 2024
23de1e8
update comment
Jan 4, 2024
3bde642
add usdc market on scroll mainnet
isabellewei Jan 25, 2024
c1d8c0a
fix wseth
isabellewei Jan 26, 2024
d06e1f4
create migration
isabellewei Jan 26, 2024
c653f86
use gauntlet recommended parameters
isabellewei Jan 30, 2024
05a9bc1
Merge branch 'isabellewei/scroll-deploy' of github.com:compound-finan…
isabellewei Feb 2, 2024
f0c6ac2
Merge branch 'main' into isabellewei/scroll-mainnet
isabellewei Feb 2, 2024
cb459f3
lint and fix timelock params
isabellewei Feb 2, 2024
d4a0097
set rewards speed to 0
isabellewei Feb 6, 2024
1f0d2c3
add pause guardian
isabellewei Feb 7, 2024
12f8856
fix scientific notation
isabellewei Feb 7, 2024
d804f03
add scroll mainnet roots
isabellewei Feb 8, 2024
0577a5b
update scroll relations for wsteth
isabellewei Feb 14, 2024
9b24330
PR comments
isabellewei Feb 14, 2024
b3c91f8
update wsteth/USD price feed to exchange rate based
isabellewei Feb 16, 2024
64b6126
Modified deployment roots from GitHub Actions
Feb 16, 2024
a159d37
update proposal description
isabellewei Feb 16, 2024
8bc26f1
update scroll governance proposal to bridge USDC instead of COMP
isabellewei Feb 21, 2024
4a20baa
final PR comments
isabellewei Feb 23, 2024
d1c3189
set message value on propsal actions
isabellewei Mar 6, 2024
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
3 changes: 2 additions & 1 deletion .github/workflows/deploy-market.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:
- base-goerli
- linea-goerli
- scroll-goerli
- scroll
deployment:
description: Deployment Name (e.g. "usdc")
required: true
Expand Down Expand Up @@ -44,7 +45,7 @@ jobs:
with:
wallet_connect_project_id: ${{ secrets.WALLET_CONNECT_PROJECT_ID }}
requested_network: "${{ inputs.network }}"
ethereum_url: "${{ fromJSON('{\"fuji\":\"https://api.avax-test.network/ext/bc/C/rpc\",\"mainnet\":\"https://mainnet.infura.io/v3/$INFURA_KEY\",\"goerli\":\"https://goerli.infura.io/v3/$INFURA_KEY\",\"mumbai\":\"https://polygon-mumbai.infura.io/v3/$INFURA_KEY\",\"polygon\":\"https://polygon-mainnet.infura.io/v3/$INFURA_KEY\",\"arbitrum-goerli\":\"https://arbitrum-goerli.infura.io/v3/$INFURA_KEY\",\"arbitrum\":\"https://arbitrum-mainnet.infura.io/v3/$INFURA_KEY\",\"base\":\"https://clean-spring-wind.base-mainnet.discover.quiknode.pro/$QUICKNODE_KEY\",\"base-goerli\":\"https://base-goerli.infura.io/v3/$INFURA_KEY\",\"linea-goerli\":\"https://linea-goerli.infura.io/v3/$INFURA_KEY\",\"scroll-goerli\":\"https://alpha-rpc.scroll.io/l2\"}')[inputs.network] }}"
ethereum_url: "${{ fromJSON('{\"fuji\":\"https://api.avax-test.network/ext/bc/C/rpc\",\"mainnet\":\"https://mainnet.infura.io/v3/$INFURA_KEY\",\"goerli\":\"https://goerli.infura.io/v3/$INFURA_KEY\",\"mumbai\":\"https://polygon-mumbai.infura.io/v3/$INFURA_KEY\",\"polygon\":\"https://polygon-mainnet.infura.io/v3/$INFURA_KEY\",\"arbitrum-goerli\":\"https://arbitrum-goerli.infura.io/v3/$INFURA_KEY\",\"arbitrum\":\"https://arbitrum-mainnet.infura.io/v3/$INFURA_KEY\",\"base\":\"https://clean-spring-wind.base-mainnet.discover.quiknode.pro/$QUICKNODE_KEY\",\"base-goerli\":\"https://base-goerli.infura.io/v3/$INFURA_KEY\",\"linea-goerli\":\"https://linea-goerli.infura.io/v3/$INFURA_KEY\",\"scroll-goerli\":\"https://alpha-rpc.scroll.io/l2\",\"scroll\":\"https://rpc.scroll.io\"}')[inputs.network] }}"
port: 8585
if: github.event.inputs.eth_pk == ''

Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/enact-migration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:
- base-goerli
- linea-goerli
- scroll-goerli
- scroll
deployment:
description: Deployment Name (e.g. "usdc")
required: true
Expand Down Expand Up @@ -52,7 +53,7 @@ jobs:
case ${{ github.event.inputs.network }} in
polygon | arbitrum | base)
echo "GOV_NETWORK=mainnet" >> $GITHUB_ENV ;;
mumbai | arbitrum-goerli | base-goerli | linea-goerli | scroll-goerli)
mumbai | arbitrum-goerli | base-goerli | linea-goerli | scroll-goerli | scroll)
echo "GOV_NETWORK=goerli" >> $GITHUB_ENV ;;
*)
echo "No governance network for selected network" ;;
Expand All @@ -63,7 +64,7 @@ jobs:
with:
wallet_connect_project_id: ${{ secrets.WALLET_CONNECT_PROJECT_ID }}
requested_network: "${{ inputs.network }}"
ethereum_url: "${{ fromJSON('{\"fuji\":\"https://api.avax-test.network/ext/bc/C/rpc\",\"mainnet\":\"https://mainnet.infura.io/v3/$INFURA_KEY\",\"goerli\":\"https://goerli.infura.io/v3/$INFURA_KEY\",\"mumbai\":\"https://polygon-mumbai.infura.io/v3/$INFURA_KEY\",\"polygon\":\"https://polygon-mainnet.infura.io/v3/$INFURA_KEY\",\"arbitrum-goerli\":\"https://arbitrum-goerli.infura.io/v3/$INFURA_KEY\",\"arbitrum\":\"https://arbitrum-mainnet.infura.io/v3/$INFURA_KEY\",\"base\":\"https://clean-spring-wind.base-mainnet.discover.quiknode.pro/$QUICKNODE_KEY\",\"base-goerli\":\"https://base-goerli.infura.io/v3/$INFURA_KEY\",\"linea-goerli\":\"https://linea-goerli.infura.io/v3/$INFURA_KEY\",\"scroll-goerli\":\"https://alpha-rpc.scroll.io/l2\"}')[inputs.network] }}"
ethereum_url: "${{ fromJSON('{\"fuji\":\"https://api.avax-test.network/ext/bc/C/rpc\",\"mainnet\":\"https://mainnet.infura.io/v3/$INFURA_KEY\",\"goerli\":\"https://goerli.infura.io/v3/$INFURA_KEY\",\"mumbai\":\"https://polygon-mumbai.infura.io/v3/$INFURA_KEY\",\"polygon\":\"https://polygon-mainnet.infura.io/v3/$INFURA_KEY\",\"arbitrum-goerli\":\"https://arbitrum-goerli.infura.io/v3/$INFURA_KEY\",\"arbitrum\":\"https://arbitrum-mainnet.infura.io/v3/$INFURA_KEY\",\"base\":\"https://clean-spring-wind.base-mainnet.discover.quiknode.pro/$QUICKNODE_KEY\",\"base-goerli\":\"https://base-goerli.infura.io/v3/$INFURA_KEY\",\"linea-goerli\":\"https://linea-goerli.infura.io/v3/$INFURA_KEY\",\"scroll-goerli\":\"https://alpha-rpc.scroll.io/l2\",\"scroll\":\"https://rpc.scroll.io\"}')[inputs.network] }}"
port: 8585
if: github.event.inputs.eth_pk == ''

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prepare-migration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
with:
wallet_connect_project_id: ${{ secrets.WALLET_CONNECT_PROJECT_ID }}
requested_network: "${{ inputs.network }}"
ethereum_url: "${{ fromJSON('{\"fuji\":\"https://api.avax-test.network/ext/bc/C/rpc\",\"mainnet\":\"https://mainnet.infura.io/v3/$INFURA_KEY\",\"goerli\":\"https://goerli.infura.io/v3/$INFURA_KEY\",\"mumbai\":\"https://polygon-mumbai.infura.io/v3/$INFURA_KEY\",\"polygon\":\"https://polygon-mainnet.infura.io/v3/$INFURA_KEY\",\"arbitrum-goerli\":\"https://arbitrum-goerli.infura.io/v3/$INFURA_KEY\",\"arbitrum\":\"https://arbitrum-mainnet.infura.io/v3/$INFURA_KEY\",\"base\":\"https://clean-spring-wind.base-mainnet.discover.quiknode.pro/$QUICKNODE_KEY\",\"base-goerli\":\"https://base-goerli.infura.io/v3/$INFURA_KEY\",\"linea-goerli\":\"https://linea-goerli.infura.io/v3/$INFURA_KEY\",\"scroll-goerli\":\"https://alpha-rpc.scroll.io/l2\"}')[inputs.network] }}"
ethereum_url: "${{ fromJSON('{\"fuji\":\"https://api.avax-test.network/ext/bc/C/rpc\",\"mainnet\":\"https://mainnet.infura.io/v3/$INFURA_KEY\",\"goerli\":\"https://goerli.infura.io/v3/$INFURA_KEY\",\"mumbai\":\"https://polygon-mumbai.infura.io/v3/$INFURA_KEY\",\"polygon\":\"https://polygon-mainnet.infura.io/v3/$INFURA_KEY\",\"arbitrum-goerli\":\"https://arbitrum-goerli.infura.io/v3/$INFURA_KEY\",\"arbitrum\":\"https://arbitrum-mainnet.infura.io/v3/$INFURA_KEY\",\"base\":\"https://clean-spring-wind.base-mainnet.discover.quiknode.pro/$QUICKNODE_KEY\",\"base-goerli\":\"https://base-goerli.infura.io/v3/$INFURA_KEY\",\"linea-goerli\":\"https://linea-goerli.infura.io/v3/$INFURA_KEY\",\"scroll-goerli\":\"https://alpha-rpc.scroll.io/l2\",\"scroll\":\"https://rpc.scroll.io\"}')[inputs.network] }}"
port: 8585
if: github.event.inputs.eth_pk == ''

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-scenarios.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
fail-fast: false
matrix:
bases: [ development, mainnet, mainnet-weth, goerli, goerli-weth, fuji, mumbai, polygon, arbitrum-usdc.e, arbitrum-usdc, arbitrum-goerli-usdc, arbitrum-goerli-usdc.e, base-usdbc, base-weth, base-goerli, base-goerli-weth, linea-goerli, scroll-goerli]
bases: [ development, mainnet, mainnet-weth, goerli, goerli-weth, fuji, mumbai, polygon, arbitrum-usdc.e, arbitrum-usdc, arbitrum-goerli-usdc, arbitrum-goerli-usdc.e, base-usdbc, base-weth, base-goerli, base-goerli-weth, linea-goerli, scroll-goerli, scroll]
name: Run scenarios
env:
ETHERSCAN_KEY: ${{ secrets.ETHERSCAN_KEY }}
Expand Down
1 change: 1 addition & 0 deletions contracts/bridges/scroll/IScrollMessenger.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.15;

/// @notice IScrollMessenger is the interface for Scroll's messenger contract
interface IScrollMessenger {
function xDomainMessageSender() external view returns (address);
}
15 changes: 12 additions & 3 deletions contracts/bridges/scroll/ScrollBridgeReceiver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,33 @@ pragma solidity 0.8.15;
import "../SweepableBridgeReceiver.sol";
import "./IScrollMessenger.sol";

/// @title Scroll Bridge Receiver
/// @notice Contract that processes messages passed from Compound governance using the Scroll bridge
contract ScrollBridgeReceiver is SweepableBridgeReceiver {
error InvalidL2Messenger();

event Newl2Messenger(address indexed oldL2Messenger, address indexed newL2Messenger);
event NewL2Messenger(address indexed oldL2Messenger, address indexed newL2Messenger);

/// @notice Address of Scroll L2 Messenger contract
address public l2Messenger;

/// @notice Construct a new ScrollBridgeReceiver instance
/// @param l2Messenger_ Address of Scroll L2 Messenger contract
constructor(address l2Messenger_) {
l2Messenger = l2Messenger_;
emit NewL2Messenger(address(0), l2Messenger_);
}

function changel2Messenger(address newL2Messenger) public {
/// @notice Update the L2 Messenger address
/// @param newL2Messenger New address for L2 Messenger contract
function changeL2Messenger(address newL2Messenger) public {
if (msg.sender != localTimelock) revert Unauthorized();
address oldL2Messenger = l2Messenger;
l2Messenger = newL2Messenger;
emit Newl2Messenger(oldL2Messenger, newL2Messenger);
emit NewL2Messenger(oldL2Messenger, newL2Messenger);
}

/// @notice Fallback function to handle messages
fallback() external payable {
if (msg.sender != l2Messenger) revert InvalidL2Messenger();
address messageSender = IScrollMessenger(msg.sender).xDomainMessageSender();
Expand Down
14 changes: 14 additions & 0 deletions deployments/mainnet/usdc/relations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,19 @@ export default {
slot: '0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc'
}
}
},
scrollMessenger: {
delegates: {
field: {
slot: '0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc'
}
}
},
scrollL1TokenBridge: {
delegates: {
field: {
slot: '0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc'
}
}
}
};
4 changes: 3 additions & 1 deletion deployments/mainnet/usdc/roots.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@
"CCTPTokenMessenger": "0xbd3fa81b58ba92a82136038b25adec7066af3155",
"CCTPMessageTransmitter": "0x0a992d191deec32afe36203ad87d7d289a738f81",
"baseL1CrossDomainMessenger": "0x866E82a600A1414e583f7F13623F1aC5d58b0Afa",
"baseL1StandardBridge": "0x3154Cf16ccdb4C6d922629664174b904d80F2C35"
"baseL1StandardBridge": "0x3154Cf16ccdb4C6d922629664174b904d80F2C35",
"scrollMessenger": "0x6774Bcbd5ceCeF1336b5300fb5186a12DDD8b367",
"scrollL1TokenBridge": "0xF8B1378579659D8F7EE5f3C929c2f3E332E41Fd6"
}
45 changes: 45 additions & 0 deletions deployments/scroll/usdc/configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "Compound USDC",
"symbol": "cUSDCv3",
"baseToken": "USDC",
"baseTokenAddress": "0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4",
"baseTokenPriceFeed": "0x43d12Fb3AfCAd5347fA764EeAB105478337b7200",
"borrowMin": "0.001e6",
"storeFrontPriceFactor": 0.6,
"targetReserves": "1000000e6",
"rates": {
"supplyKink": 0.85,
"supplySlopeLow": 0.048,
"supplySlopeHigh": 1.6,
"supplyBase": 0,
"borrowKink": 0.85,
"borrowSlopeLow": 0.053,
"borrowSlopeHigh": 1.8,
"borrowBase": 0.015
},
"tracking": {
"indexScale": "1e15",
"baseSupplySpeed": "0.000402083333333e15",
"baseBorrowSpeed": "0.000402083333333e15",
"baseMinForRewards": "1000e6"
},
"assets": {
"WETH": {
"address": "0x5300000000000000000000000000000000000004",
"priceFeed": "0x6bF14CB0A831078629D993FDeBcB182b21A8774C",
"decimals": "18",
"borrowCF": 0.8,
"liquidateCF": 0.85,
"liquidationFactor": 0.9,
"supplyCap": "300e18"
},
"wstETH": {
"address": "0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32",
"decimals": "18",
"borrowCF": 0.75,
"liquidateCF": 0.8,
"liquidationFactor": 0.85,
"supplyCap": "50e18"
}
}
}
86 changes: 86 additions & 0 deletions deployments/scroll/usdc/deploy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import { Deployed, DeploymentManager } from '../../../plugins/deployment_manager';
import { DeploySpec, deployComet, exp, wait } from '../../../src/deploy';

const secondsPerDay = 24 * 60 * 60;

const MAINNET_TIMELOCK = '0x6d903f6003cca6255d85cca4d3b5e5146dc33925'; // L1 contract

export default async function deploy(
deploymentManager: DeploymentManager,
deploySpec: DeploySpec
): Promise<Deployed> {
const trace = deploymentManager.tracer();
const ethers = deploymentManager.hre.ethers;

// Pull in existing assets
const WETH = await deploymentManager.existing('WETH','0x5300000000000000000000000000000000000004','scroll');
const wstETH = await deploymentManager.existing('wstETH', '0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32', 'scroll');

const l2Messenger = await deploymentManager.existing('l2Messenger','0x781e90f1c8Fc4611c9b7497C3B47F99Ef6969CbC','scroll');
const l2ERC20Gateway = await deploymentManager.existing('l2ERC20Gateway','0xE2b4795039517653c5Ae8C2A9BFdd783b48f447A','scroll');
const l2ETHGateway = await deploymentManager.existing('l2ETHGateway', '0x6EA73e05AdC79974B931123675ea8F78FfdacDF0', 'scroll');
const l2WETHGateway = await deploymentManager.existing('l2WETHGateway','0x7003E7B7186f0E6601203b99F7B8DECBfA391cf9','scroll');
const l2WstETHGateway = await deploymentManager.existing('l2WstETHGateway', '0x8aE8f22226B9d789A36AC81474e633f8bE2856c9', 'scroll');

// Deploy ScrollBridgeReceiver
const bridgeReceiver = await deploymentManager.deploy(
'bridgeReceiver',
'bridges/scroll/ScrollBridgeReceiver.sol',
[l2Messenger.address]
);

// Deploy Local Timelock
const localTimelock = await deploymentManager.deploy('timelock', 'vendor/Timelock.sol', [
bridgeReceiver.address, // admin
10 * 60, // delay
14 * secondsPerDay, // grace period
10 * 60, // minimum delay
30 * secondsPerDay // maximum delay
]);

// Deploy multiplicative price feed for wstETH / USD
const wstETHMultiplicativePriceFeed = await deploymentManager.deploy(
'wstETH:priceFeed',
'pricefeeds/MultiplicativePriceFeed.sol',
[
'0xe428fbdbd61CC1be6C273dC0E27a1F43124a86F3', // wstETH / ETH price feed
'0x6bF14CB0A831078629D993FDeBcB182b21A8774C', // ETH / USD price feed
8, // decimals
'wstETH / USD price feed' // description
]
);

// Initialize BridgeReceiver
await deploymentManager.idempotent(
async () => !(await bridgeReceiver.initialized()),
async () => {
trace(`Initializing BridgeReceiver`);
await bridgeReceiver.initialize(
MAINNET_TIMELOCK, // govTimelock
localTimelock.address // localTimelock
);
trace(`BridgeReceiver initialized`);
}
);

// Deploy Comet
const deployed = await deployComet(deploymentManager, deploySpec);
const { comet } = deployed;

// Deploy Bulker
const bulker = await deploymentManager.deploy('bulker','bulkers/BaseBulker.sol', [
await comet.governor(), // admin_
WETH.address, // weth_
]);

return {
...deployed,
bridgeReceiver,
l2Messenger,
l2ERC20Gateway,
l2ETHGateway,
l2WETHGateway,
l2WstETHGateway,
bulker,
};
}
Loading