Skip to content

Commit 4bc0aa8

Browse files
authored
Merge pull request #258 from sprintertech/chore/deploy-stashdex-prod
Deploy StashStablecoinDex Ethereum Prod
2 parents 776a9c0 + d6bc7d4 commit 4bc0aa8

8 files changed

Lines changed: 239 additions & 9 deletions

File tree

deployments/deploy-base.log

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,20 @@ Success.
159159
To finalize upgrade send the following transaction from ProxyAdmin owner: 0x4eA9E682BA79bC403523c9e8D98A05EaF3810636
160160
To: 0x2B5D04eF6b3279bCdA4B219b02FAF627dA1664CB
161161
Value: 0
162-
Data: 0x9623609d00000000000000000000000036364acc7b9c67692ca215af09a41cbd1043951100000000000000000000000097611394ffc80228d8422ddd19cdf759a3d099ab00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000
162+
Data: 0x9623609d00000000000000000000000036364acc7b9c67692ca215af09a41cbd1043951100000000000000000000000097611394ffc80228d8422ddd19cdf759a3d099ab00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000
163+
164+
update-routes-rebalancer
165+
Using config for: BASE
166+
To allow missing routes execute the following transaction.
167+
To: 0xA85Cf46c150db2600b1D03E437bedD5513869888
168+
Function: setRoute
169+
Params:
170+
isAllowed: true
171+
┌─────────┬──────────────────────────────────────────────┬────────────────┬───────────────┐
172+
│ (index) │ pools │ domains │ providers │
173+
├─────────┼──────────────────────────────────────────────┼────────────────┼───────────────┤
174+
│ 0 │ '0x63Ff95c79bF61486c600Eb8aF4CcE4c0a9a4068B' │ '0 (ETHEREUM)' │ '1 (CCTP)' │
175+
│ 1 │ '0x63Ff95c79bF61486c600Eb8aF4CcE4c0a9a4068B' │ '0 (ETHEREUM)' │ '9 (CCTP_V2)' │
176+
└─────────┴──────────────────────────────────────────────┴────────────────┴───────────────┘
177+
Raw data: 0xee108544000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000063ff95c79bf61486c600eb8af4cce4c0a9a4068b00000000000000000000000063ff95c79bf61486c600eb8af4cce4c0a9a4068b000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000009
178+
There are no excess routes to deny.

deployments/deploy-ethereum.log

Lines changed: 156 additions & 0 deletions
Large diffs are not rendered by default.

deployments/deployments.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,22 @@ eip155:1:
5050
LiquidityPoolAaveUSDCLongTerm_v2: "0x52D0EE7a870824FC683Ea19C714c7Bd110257788"
5151
LiquidityPoolUSDC: "0xB58Bb9643884abbbad64FA7eBc874c5481E5c032"
5252
LiquidityPoolUSDC_v2: "0x0E16326e6921395edA2575740374E754b22810eb"
53+
LiquidityPoolAaveUSDCProxy: "0x63Ff95c79bF61486c600Eb8aF4CcE4c0a9a4068B"
5354
CensoredTransferFromMulticall: "0x7C472EBa1945E970a23C903FC8812D469a29B6bb"
5455
USDC: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
5556
Rebalancer: "0xA85Cf46c150db2600b1D03E437bedD5513869888"
5657
Repayer: "0x36364Acc7B9c67692CA215af09A41CBd10439511"
5758
ProcessorUSDC: "0xFFDB380C79D9BF412a61d63060388d761D16286D"
59+
PaxosOracle: "0xBbbDdf4B6029A61FCcF82d78eFcBedCF223ac4fc"
60+
StashStablecoinDex: "0x77C8093B4AA70f614f95A490246bD7C40C47dCF2"
61+
StashDexProcessorUSDC: "0x59f457A8BeAf36bB66241475FfAC79F8B5338C85"
62+
StashDexProcessorUSDG: "0x213a86C3CAa954A0343e24686CDEB6D7d0FB16cb"
63+
StashDexProcessorUSDT: "0x987203Be4450932F9C0d6cFED8383A894c70E391"
64+
StashDexProcessorPYUSD: "0x8Cb72081E1eEF579c62d0C3d642CCeB7B355c457"
65+
StashDexSubProcessorUSDC: "0x3A60342cb0307cC4DD5112d6c07983E7C7c90f8d"
66+
StashDexSubProcessorUSDG: "0x5e0f446317f9C544F55a0FD23E27FF95C8bb6bA8"
67+
StashDexSubProcessorUSDT: "0xf9b7639Ca2A899be04ef94730711Aa866474449f"
68+
StashDexSubProcessorPYUSD: "0x9e6C9A5EF86BBe1594982289eC182DD355D0835E"
5869

5970
eip155:137:
6071
deployment id: MVP

network.config.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export const PYUSDStashDexProcessorProxy = DEFAULT_PROXY_TYPE + "StashDexProcess
8484
export const USDCStashDexProcessorProxy = DEFAULT_PROXY_TYPE + "StashDexProcessorUSDC";
8585
export const USDGStashDexProcessorProxy = DEFAULT_PROXY_TYPE + "StashDexProcessorUSDG";
8686
export const USDTStashDexProcessorProxy = DEFAULT_PROXY_TYPE + "StashDexProcessorUSDT";
87+
export const StashStablecoinDexProxy = DEFAULT_PROXY_TYPE + "StashStablecoinDex";
8788
const SUPPORTS_ONLY_USDC = false;
8889

8990
export enum Network {
@@ -171,6 +172,7 @@ interface AavePoolConfig {
171172
TokenLTVs?: {
172173
[token: string]: number;
173174
};
175+
DirectBorrowCaller?: string;
174176
}
175177

176178
interface AavePoolLongTermConfig extends AavePoolConfig {
@@ -430,6 +432,21 @@ export const networkConfig: NetworksConfig = {
430432
BorrowLongTermAdmin: "0x83B8D2eAda788943c3e80892f37f9c102271C1D6",
431433
RepayCaller: "0x9A5B33bd11329116A55F764c604a5152eE8Ca292",
432434
},
435+
AavePool: {
436+
AaveAddressesProvider: AAVEPools.AaveV3Ethereum.POOL_ADDRESSES_PROVIDER,
437+
MinHealthFactor: 150,
438+
DefaultLTV: 0,
439+
TokenLTVs: {
440+
"0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599": 100, // WBTC
441+
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2": 100, // WETH
442+
"0x6b175474e89094c44da98b954eedeac495271d0f": 100, // DAI
443+
"0x6c3ea9036406852006290770BEdFcAbA0e23A0e8": 100, // PYUSD
444+
"0xe343167631d89B6Ffc58B88d6b7fB0228795491D": 100, // USDG
445+
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48": 100, // USDC
446+
"0xdAC17F958D2ee523a2206206994597C13D831ec7": 100, // USDT
447+
},
448+
DirectBorrowCaller: StashStablecoinDexProxy,
449+
},
433450
USDCPool: true,
434451
StashDex: {
435452
Oracle: "PaxosOracle",
@@ -1478,6 +1495,9 @@ export const networkConfig: NetworksConfig = {
14781495
[LiquidityPoolAaveUSDCLongTermV3]: {
14791496
[Network.ETHEREUM]: [Provider.CCTP, Provider.CCTP_V2],
14801497
},
1498+
[LiquidityPoolAaveUSDCProxy]: {
1499+
[Network.ETHEREUM]: [Provider.CCTP, Provider.CCTP_V2],
1500+
},
14811501
},
14821502
RepayerRoutes: {
14831503
[LiquidityPoolAaveUSDCV4]: {

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"deploy-usdcpoolaave-base": "hardhat run ./scripts/deployUSDCPoolAave.ts --network BASE",
3636
"deploy-usdcpoolaave-opmainnet": "hardhat run ./scripts/deployUSDCPoolAave.ts --network OP_MAINNET",
3737
"deploy-usdcpoolaave-arbitrumone": "hardhat run ./scripts/deployUSDCPoolAave.ts --network ARBITRUM_ONE",
38+
"deploy-usdcpoolaave-ethereum": "hardhat run ./scripts/deployUSDCPoolAave.ts --network ETHEREUM",
3839
"deploy-usdcpoolstablecoin-ethereum": "hardhat run ./scripts/deployUSDCStablecoinPool.ts --network ETHEREUM",
3940
"deploy-usdcpoolstablecoin-unichain": "hardhat run ./scripts/deployUSDCStablecoinPool.ts --network UNICHAIN",
4041
"deploy-usdcpublicpool-arbitrumone": "hardhat run ./scripts/deployUSDCPublicPool.ts --network ARBITRUM_ONE",
@@ -80,6 +81,8 @@
8081
"deploy-usdt-stashdex-processor-ethereum-stage": "PROCESSOR_TOKEN=USDT DEPLOY_TYPE=STAGE hardhat run ./scripts/deployStashDexProcessor.ts --network ETHEREUM",
8182
"deploy-pyusd-stashdex-processor-ethereum": "PROCESSOR_TOKEN=PYUSD hardhat run ./scripts/deployStashDexProcessor.ts --network ETHEREUM",
8283
"deploy-pyusd-stashdex-processor-ethereum-stage": "PROCESSOR_TOKEN=PYUSD DEPLOY_TYPE=STAGE hardhat run ./scripts/deployStashDexProcessor.ts --network ETHEREUM",
84+
"deploy-stashdex-ethereum": "hardhat run ./scripts/deployStashDex.ts --network ETHEREUM",
85+
"deploy-stashdex-ethereum-stage": "DEPLOY_TYPE=STAGE hardhat run ./scripts/deployStashDex.ts --network ETHEREUM",
8386
"deploy-paxosoracle-ethereum": "hardhat run ./scripts/deployPaxosOracle.ts --network ETHEREUM",
8487
"deploy-paxosoracle-ethereum-stage": "DEPLOY_TYPE=STAGE hardhat run ./scripts/deployPaxosOracle.ts --network ETHEREUM",
8588
"upgrade-liquidityhub-basesepolia": "hardhat run ./scripts/upgradeLiquidityHub.ts --network BASE_SEPOLIA",
@@ -204,6 +207,7 @@
204207
"dry:deploy-usdcpoolaave-opmainnet": "DRY_RUN=OP_MAINNET VERIFY=false ts-node --files ./scripts/deployUSDCPoolAave.ts",
205208
"dry:deploy-usdcpoolaave-arbitrumone": "DRY_RUN=ARBITRUM_ONE VERIFY=false ts-node --files ./scripts/deployUSDCPoolAave.ts",
206209
"dry:deploy-usdcpoolaave-polygon": "DRY_RUN=POLYGON_MAINNET VERIFY=false ts-node --files ./scripts/deployUSDCPoolAave.ts",
210+
"dry:deploy-usdcpoolaave-ethereum": "DRY_RUN=ETHEREUM VERIFY=false ts-node --files ./scripts/deployUSDCPoolAave.ts",
207211
"dry:deploy-usdcpoolstablecoin-ethereum": "DRY_RUN=ETHEREUM VERIFY=false ts-node --files ./scripts/deployUSDCStablecoinPool.ts",
208212
"dry:deploy-usdcpoolstablecoin-unichain": "DRY_RUN=UNICHAIN VERIFY=false ts-node --files ./scripts/deployUSDCStablecoinPool.ts",
209213
"dry:deploy-usdcpublicpool-arbitrumone": "DRY_RUN=ARBITRUM_ONE VERIFY=false ts-node --files ./scripts/deployUSDCPublicPool.ts",
@@ -251,6 +255,8 @@
251255
"dry:deploy-usdt-stashdex-processor-ethereum": "DRY_RUN=ETHEREUM VERIFY=false PROCESSOR_TOKEN=USDT ts-node --files ./scripts/deployStashDexProcessor.ts",
252256
"dry:deploy-pyusd-stashdex-processor-ethereum-stage": "DRY_RUN=ETHEREUM VERIFY=false DEPLOY_TYPE=STAGE PROCESSOR_TOKEN=PYUSD ts-node --files ./scripts/deployStashDexProcessor.ts",
253257
"dry:deploy-pyusd-stashdex-processor-ethereum": "DRY_RUN=ETHEREUM VERIFY=false PROCESSOR_TOKEN=PYUSD ts-node --files ./scripts/deployStashDexProcessor.ts",
258+
"dry:deploy-stashdex-ethereum": "DRY_RUN=ETHEREUM VERIFY=false ts-node --files ./scripts/deployStashDex.ts",
259+
"dry:deploy-stashdex-ethereum-stage": "DRY_RUN=ETHEREUM DEPLOY_TYPE=STAGE VERIFY=false ts-node --files ./scripts/deployStashDex.ts",
254260
"dry:upgrade-liquidityhub-basesepolia": "DRY_RUN=BASE_SEPOLIA VERIFY=false ts-node --files ./scripts/upgradeLiquidityHub.ts",
255261
"dry:upgrade-liquidityhub-base": "DRY_RUN=BASE VERIFY=false ts-node --files ./scripts/upgradeLiquidityHub.ts",
256262
"dry:upgrade-liquidityhub-base-stage": "DRY_RUN=BASE DEPLOY_TYPE=STAGE VERIFY=false ts-node --files ./scripts/upgradeLiquidityHub.ts",

scripts/deployStashDex.ts

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,26 @@ export async function main() {
105105

106106
if (initialPools.length > 0) {
107107
const DIRECT_BORROW_ROLE = hre.ethers.encodeBytes32String("DIRECT_BORROW_ROLE");
108-
const calldata = (await stashDex.grantRole.populateTransaction(DIRECT_BORROW_ROLE, stashDex.target)).data;
108+
const calldata = (await stashDex.grantRole.populateTransaction(DIRECT_BORROW_ROLE, stashDex)).data;
109109
const poolTokenNames = Object.keys(stashDexConfig.Pools) as Token[];
110-
console.log("NEXT STEPS — grant DIRECT_BORROW_ROLE on each pool so StashDex can borrow:");
111-
console.log(`Calldata: ${calldata}`);
112-
console.table(initialPools.map(({pool}, i) => ({
113-
token: poolTokenNames[i],
114-
to: pool,
115-
})));
110+
111+
const grouped = new Map<string, string[]>();
112+
for (let i = 0; i < initialPools.length; i++) {
113+
const {pool} = initialPools[i];
114+
const poolContract = await hre.ethers.getContractAt("AccessControlUpgradeable", pool);
115+
if (await poolContract.hasRole(DIRECT_BORROW_ROLE, stashDex)) continue;
116+
const tokens = grouped.get(pool) ?? [];
117+
tokens.push(poolTokenNames[i]);
118+
grouped.set(pool, tokens);
119+
}
120+
121+
if (grouped.size > 0) {
122+
console.log("NEXT STEPS — grant DIRECT_BORROW_ROLE on each pool so StashDex can borrow:");
123+
console.log(`Calldata: ${calldata}`);
124+
console.table([...grouped.entries()].map(([pool, tokens]) => ({tokens: tokens.join(", "), to: pool})));
125+
} else {
126+
console.log("DIRECT_BORROW_ROLE already granted on all pools — no action needed.");
127+
}
116128
}
117129

118130
await verifier.verify(process.env.VERIFY === "true");

scripts/deployStashDexProcessor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export async function main() {
3737
assertAddress(tokenInfo.Address, `${targetAsset}.Address must be an address`);
3838
assertAddress(config.Admin, "Admin must be an address");
3939
assertAddress(config.RepayerCaller, "RepayerCaller must be an address");
40+
assertAddress(config.SignerAddress, "SignerAddress must be an address");
4041
assert(config.StashDex, "StashDex must be in config");
4142

4243
const id = `StashDexProcessor${targetAsset}`;

scripts/deployUSDCPoolAave.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {NonceManager} from "ethers";
55
import {
66
getVerifier, getHardhatNetworkConfig, getNetworkConfig, percentsToBps, logDeployers, deployProxyX,
77
} from "./helpers";
8-
import {resolveProxyXAddress, toBytes32} from "../test/helpers";
8+
import {resolveProxyXAddress, resolveXAddress, toBytes32} from "../test/helpers";
99
import {isSet, assert, assertAddress, DEFAULT_ADMIN_ROLE, sameAddress} from "./common";
1010
import {LiquidityPoolAave, ProxyAdmin} from "../typechain-types";
1111
import {Network, NetworkConfig, LiquidityPoolAaveUSDCVersions} from "../network.config";
@@ -16,6 +16,7 @@ export async function main() {
1616

1717
const LIQUIDITY_ADMIN_ROLE = toBytes32("LIQUIDITY_ADMIN_ROLE");
1818
const WITHDRAW_PROFIT_ROLE = toBytes32("WITHDRAW_PROFIT_ROLE");
19+
const DIRECT_BORROW_ROLE = toBytes32("DIRECT_BORROW_ROLE");
1920
const PAUSER_ROLE = toBytes32("PAUSER_ROLE");
2021

2122
assert(isSet(process.env.DEPLOY_ID), "DEPLOY_ID must be set");
@@ -43,6 +44,10 @@ export async function main() {
4344
assertAddress(config.MpcAddress, "MpcAddress must be an address");
4445
assertAddress(config.WrappedNativeToken, "WrappedNativeToken must be an address");
4546
assertAddress(config.SignerAddress, "SignerAddress must be an address");
47+
let directBorrowCaller = "";
48+
if (config.AavePool.DirectBorrowCaller) {
49+
directBorrowCaller = await resolveXAddress(config.AavePool.DirectBorrowCaller, false);
50+
}
4651

4752
const rebalancer = await resolveProxyXAddress("Rebalancer");
4853
console.log(`Rebalancer: ${rebalancer}`);
@@ -75,6 +80,9 @@ export async function main() {
7580

7681
await aavePool.grantRole(LIQUIDITY_ADMIN_ROLE, rebalancer);
7782
await aavePool.grantRole(WITHDRAW_PROFIT_ROLE, config.WithdrawProfit);
83+
if (directBorrowCaller !== "") {
84+
await aavePool.grantRole(DIRECT_BORROW_ROLE, directBorrowCaller);
85+
}
7886
let lastTx = await aavePool.grantRole(PAUSER_ROLE, config.Pauser);
7987

8088
if (!sameAddress(deployer.address, config.Admin)) {

0 commit comments

Comments
 (0)