Skip to content

Commit

Permalink
Merge branch 'base-mainnet'
Browse files Browse the repository at this point in the history
  • Loading branch information
maxweng committed Dec 6, 2024
2 parents e9b293d + 34a5c48 commit e3b6d9c
Show file tree
Hide file tree
Showing 12 changed files with 188 additions and 10 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,14 @@ Built using [foundry](https://book.getfoundry.sh/) and [hardhat](https://hardhat

- Base Sepolia

- [contract addresses](https://github.com/unioncredit/union-v2-contracts/blob/master/deployments/optimism-goerli/deployment.json)
- [deployment config](https://github.com/unioncredit/union-v2-contracts/blob/master/deployments/optimism-goerli/config.json)
- [contract addresses](https://github.com/unioncredit/union-v2-contracts/blob/f6290f5d795e4498574a856dd3d165364dee2b34/deployments/base-sepolia/deployment.json)
- [deployment config](https://github.com/unioncredit/union-v2-contracts/blob/f6290f5d795e4498574a856dd3d165364dee2b34/deployments/base-sepolia/config.json)

- Base Mainnet

- [contract addresses](https://github.com/unioncredit/union-v2-contracts/blob/f6290f5d795e4498574a856dd3d165364dee2b34/deployments/base-mainnet/deployment.json)
- [deployment config](https://github.com/unioncredit/union-v2-contracts/blob/f6290f5d795e4498574a856dd3d165364dee2b34/deployments/base-mainnet/config.json)


## Install

Expand Down
49 changes: 49 additions & 0 deletions deploy/config/base-mainnet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import {DeployConfig} from "../optimism";
import {parseUSDC} from "../../utils";
import {parseUnits} from "ethers/lib/utils";

export default {
userManager: {
maxOverdue: "5184000", // in seconds, 60 day
effectiveCount: "0",
maxVouchers: "400",
maxVouchees: "1000"
},
uToken: {
name: "uUSDC",
symbol: "uUSDC",
initialExchangeRateMantissa: parseUnits("1"),
reserveFactorMantissa: parseUnits("1"),
originationFee: parseUnits("0.005"),
originationFeeMax: parseUnits("0.5"),
debtCeiling: parseUSDC("250000"),
maxBorrow: parseUSDC("25000"),
minBorrow: parseUSDC("100"),
overdueTime: "2592000", // in seconds, 30 day
mintFeeRate: parseUnits("0")
},
comptroller: {
halfDecayPoint: "1"
},
pureAdapter: {
floor: parseUSDC("1000"),
ceiling: parseUSDC("100000")
},
aaveAdapter: {
floor: parseUSDC("1000"),
ceiling: parseUSDC("100000")
},
addresses: {
guardian: "0xCbD1c32A1b3961cC43868B8bae431Ab0dA65beEb",
unionToken: "0x5Dfe42eEA70a3e6f93EE54eD9C321aF07A85535C", // mainnet address
usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", // USDC on base
aave: {
market: "0xf9cc4F0D883F1a1eb2c253bdb46c254Ca51E1F44",
lendingPool: "0xA238Dd80C259a72e81d7e4664a9801593F98d1c5"
},
opL2Bridge: "0x4200000000000000000000000000000000000010",
opL2CrossDomainMessenger: "0x4200000000000000000000000000000000000007",
timelock: "0xBBD3321f377742c4b3fe458b270c2F271d3294D8", // mainnet address
opAdminAddress: "0x567e418D831969142b52228b65a88f894e2D79a8" //use l2 multi-sig address
}
} as DeployConfig;
5 changes: 5 additions & 0 deletions deploy/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ import mainnetConfig from "./mainnet";
// Base Sepolia configs
import baseSepoliaConfig from "./base-sepolia";

// Base Mainnet configs
import baseMainnetConfig from "./base-mainnet";

export const baseConfig = {
addresses: {
aave: {
Expand Down Expand Up @@ -77,6 +80,8 @@ export const getConfig = (network: string) => {
return {...baseConfig, ...mainnetConfig};
case "base-sepolia":
return {...baseConfig, ...baseSepoliaConfig};
case "base-mainnet":
return {...baseConfig, ...baseMainnetConfig};
default:
return baseConfig;
}
Expand Down
3 changes: 2 additions & 1 deletion deploy/config/mainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export default {
addresses: {
unionToken: "0x5Dfe42eEA70a3e6f93EE54eD9C321aF07A85535C",
opUnion: "0xB025ee78b54B5348BD638Fe4a6D77Ec2F813f4f9",
opL1Bridge: "0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1"
opL1Bridge: "0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1",
baseL1Bridge: "0x3154Cf16ccdb4C6d922629664174b904d80F2C35"
}
} as DeployConfig;
89 changes: 89 additions & 0 deletions deployments/base-mainnet/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"addresses": {
"guardian": "0xCbD1c32A1b3961cC43868B8bae431Ab0dA65beEb",
"unionToken": "0x5Dfe42eEA70a3e6f93EE54eD9C321aF07A85535C",
"usdc": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"aave": {
"market": "0xf9cc4F0D883F1a1eb2c253bdb46c254Ca51E1F44",
"lendingPool": "0xA238Dd80C259a72e81d7e4664a9801593F98d1c5"
},
"opL2Bridge": "0x4200000000000000000000000000000000000010",
"opL2CrossDomainMessenger": "0x4200000000000000000000000000000000000007",
"timelock": "0xBBD3321f377742c4b3fe458b270c2F271d3294D8",
"opAdminAddress": "0x567e418D831969142b52228b65a88f894e2D79a8",
"opUnion": "0x946A2C918F3D928B918C01D813644f27Bcd29D96",
"opOwner": "0x20473Af81162B3E79F0333A2d8D64C88a71B88e8",
"marketRegistry": "0x46A48D1e81F6002501251AD563a0e16655525E85",
"comptroller": "0x37C092D275E48e3c9001059D9B7d55802CbDbE04",
"assetManager": "0x393d7299c2caA940b777b014a094C3B2ea45ee2B"
},
"userManager": {
"maxOverdue": "5184000",
"effectiveCount": "0",
"maxVouchers": "400",
"maxVouchees": "1000"
},
"uToken": {
"name": "uUSDC",
"symbol": "uUSDC",
"initialExchangeRateMantissa": {
"type": "BigNumber",
"hex": "0x0de0b6b3a7640000"
},
"reserveFactorMantissa": {
"type": "BigNumber",
"hex": "0x0de0b6b3a7640000"
},
"originationFee": {
"type": "BigNumber",
"hex": "0x11c37937e08000"
},
"originationFeeMax": {
"type": "BigNumber",
"hex": "0x06f05b59d3b20000"
},
"debtCeiling": {
"type": "BigNumber",
"hex": "0x3a35294400"
},
"maxBorrow": {
"type": "BigNumber",
"hex": "0x05d21dba00"
},
"minBorrow": {
"type": "BigNumber",
"hex": "0x05f5e100"
},
"overdueTime": "2592000",
"mintFeeRate": {
"type": "BigNumber",
"hex": "0x00"
}
},
"fixedInterestRateModel": {
"interestRatePerSecond": "3170979198"
},
"comptroller": {
"halfDecayPoint": "1"
},
"pureAdapter": {
"floor": {
"type": "BigNumber",
"hex": "0x3b9aca00"
},
"ceiling": {
"type": "BigNumber",
"hex": "0x174876e800"
}
},
"aaveAdapter": {
"floor": {
"type": "BigNumber",
"hex": "0x3b9aca00"
},
"ceiling": {
"type": "BigNumber",
"hex": "0x174876e800"
}
}
}
15 changes: 15 additions & 0 deletions deployments/base-mainnet/deployment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"opUnion": "0x946A2C918F3D928B918C01D813644f27Bcd29D96",
"opOwner": "0x20473Af81162B3E79F0333A2d8D64C88a71B88e8",
"userManager": "0xfd745A1e2A220C6aC327EC55d2Cb404CD939f56b",
"uToken": "0xc2447f36FfdA08E278D25D08Ea91D942f0C2d6ea",
"marketRegistry": "0x46A48D1e81F6002501251AD563a0e16655525E85",
"fixedRateInterestModel": "0xd5A9E13e70634c7567121681a74039638a0A3f75",
"comptroller": "0x37C092D275E48e3c9001059D9B7d55802CbDbE04",
"assetManager": "0x393d7299c2caA940b777b014a094C3B2ea45ee2B",
"underlying": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"adapters": {
"pureTokenAdapter": "0xFBb5c34b07793caAeA7b359edc5142dB42c58992",
"aaveV3Adapter": "0x5Dd90D3Ca8b699A9058A69ac41fb80E3b33dc61c"
}
}
3 changes: 3 additions & 0 deletions deployments/base-mainnet/lens.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"lens": "0x97F8903177300aDDF7b92431DE104ce610768B19"
}
5 changes: 3 additions & 2 deletions deployments/mainnet/connector.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"opConnector": "0xF5690129Bf7AD35358Eb2304f4F5B10E0a9B9d65"
}
"opConnector": "0xF5690129Bf7AD35358Eb2304f4F5B10E0a9B9d65",
"baseConnector": "0x08447c9a86efe321fc3c54b8cddb7d5d516ce121"
}
3 changes: 3 additions & 0 deletions deployments/sepolia/connector.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"baseConnector": "0xC5b9BB5b85BD5659fAB88c85DA619d8E6C54b9f3"
}
6 changes: 5 additions & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ export default {
},
"base-sepolia": {
url: process.env.NODE_URL || "https://sepolia.base.org"
},
"base-mainnet": {
url: process.env.NODE_URL || "https://mainnet.base.org"
}
},
solidity: {
Expand All @@ -56,7 +59,8 @@ export default {
apiKey: {
sepolia: process.env.BASE_SEPOLIA_API_KEY,
"base-sepolia": process.env.BASE_SEPOLIA_API_KEY,
optimisticEthereum: process.env.ETHERSCAN_API_KEY
optimisticEthereum: process.env.ETHERSCAN_API_KEY,
"base-mainnet": process.env.BASE_MAINNET_API_KEY
},
customChains: [
{
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"clean": "forge clean && yarn hardhat clean && rm -rf ./typechain-types",
"coverage": "./run-coverage.sh",
"deploy:op": "yarn clean && yarn hardhat compile && CONFIG=optimism-goerli yarn hardhat --config hardhat-task.config.ts deploy:op --network optimism-goerli",
"deploy:base-sepolia": "yarn clean && yarn hardhat compile && yarn hardhat --config hardhat-task.config.ts deploy --network base-sepolia"
"deploy:base-sepolia": "yarn clean && yarn hardhat compile && yarn hardhat --config hardhat-task.config.ts deploy --network base-sepolia",
"deploy:base-mainnet": "yarn clean && yarn hardhat compile && yarn hardhat --config hardhat-task.config.ts deploy --network base-mainnet"
},
"repository": {
"type": "git",
Expand Down
7 changes: 4 additions & 3 deletions tasks/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ const getDeployer = (privateKey: string, provider: Provider) => {
return new ethers.Wallet(privateKey, provider);
};

task("deploy:opConnector", "Deploy L1 connector for Optimism UNION token")
task("deploy:connector", "Deploy L1 connector for L2 UNION token")
.addParam("pk", "Private key to use for deployment")
.addParam("confirmations", "How many confirmations to wait for")
.addParam("l2comptroller", "Receive token address")
.addParam("l1bridge", "L1 bridge address")
// .addParam("members", "Initial union members")
.setAction(async (taskArguments: TaskArguments, hre: HardhatRuntimeEnvironment) => {
// ------------------------------------------------------
Expand Down Expand Up @@ -91,7 +92,7 @@ task("deploy:opConnector", "Deploy L1 connector for Optimism UNION token")
}

// validate addresses
if (!config.addresses.unionToken || !config.addresses.opUnion || !config.addresses.opL1Bridge) {
if (!config.addresses.unionToken || !config.addresses.opUnion || !taskArguments.l1bridge) {
console.log("[!] Required address null");
process.exit();
}
Expand All @@ -103,7 +104,7 @@ task("deploy:opConnector", "Deploy L1 connector for Optimism UNION token")
config.addresses.unionToken,
config.addresses.opUnion,
taskArguments.l2comptroller,
config.addresses.opL1Bridge
taskArguments.l1bridge
],
true,
waitForBlocks
Expand Down

0 comments on commit e3b6d9c

Please sign in to comment.