Skip to content

Commit 0360c4e

Browse files
authored
Merge pull request #40 from sprintertech/feat-stash-tiers-v2
Redeploy stash with new tiers
2 parents 855d98b + 493ed29 commit 0360c4e

File tree

9 files changed

+103
-10
lines changed

9 files changed

+103
-10
lines changed

deployments/deploy-base.log

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,17 @@ Routes:
3838
│ 4 │ '0x7C255279c098fdF6c3116D2BecD9978002c09f4b' │ 'BASE' │ 'LOCAL' │
3939
│ 5 │ '0xB58Bb9643884abbbad64FA7eBc874c5481E5c032' │ 'BASE' │ 'LOCAL' │
4040
└─────────┴──────────────────────────────────────────────┴────────────────┴──────────┘
41+
42+
Deployment ID: MVP
43+
Redeployment ID: MVP2
44+
Redeploying to: BASE
45+
Admin: 0x4eA9E682BA79bC403523c9e8D98A05EaF3810636
46+
SprinterLiquidityMining: 0x479D158959B59328E89f0fbF7DfeBb198c313C21
47+
Tiers:
48+
┌─────────┬──────────┬────────────────┐
49+
│ (index) │ seconds │ multiplier │
50+
├─────────┼──────────┼────────────────┤
51+
│ 0 │ 7776000 │ '0.400000000x' │
52+
│ 1 │ 15552000 │ '1.0x' │
53+
│ 2 │ 31104000 │ '2.200000000x' │
54+
└─────────┴──────────┴────────────────┘

deployments/deploy-basesepolia.log

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,17 @@ Routes:
3838
│ 4 │ '0x7C255279c098fdF6c3116D2BecD9978002c09f4b' │ 'BASE_SEPOLIA' │ 'LOCAL' │
3939
│ 5 │ '0xB58Bb9643884abbbad64FA7eBc874c5481E5c032' │ 'BASE_SEPOLIA' │ 'LOCAL' │
4040
└─────────┴──────────────────────────────────────────────┴────────────────────┴──────────┘
41+
42+
Deployment ID: MVP
43+
Redeployment ID: MVP2
44+
Redeploying to: BASE_SEPOLIA
45+
Admin: 0xcf2d403c75ba3481ae7b190b1cd3246b5afe9120
46+
SprinterLiquidityMining: 0x479D158959B59328E89f0fbF7DfeBb198c313C21
47+
Tiers:
48+
┌─────────┬─────────┬────────────────┐
49+
│ (index) │ seconds │ multiplier │
50+
├─────────┼─────────┼────────────────┤
51+
│ 0 │ 600 │ '0.400000000x' │
52+
│ 1 │ 1200 │ '1.0x' │
53+
│ 2 │ 2400 │ '2.200000000x' │
54+
└─────────┴─────────┴────────────────┘

deployments/deployments.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
LiquidityPoolUSDC: 0xB58Bb9643884abbbad64FA7eBc874c5481E5c032
77
SprinterUSDCLPShare: 0xfa89929b30bC3132f9907CBCe3F2f6f4AC0903b6
88
LiquidityHub: 0xa593A9bBBc65be342FF610a01e96da2EB8539FF2
9-
SprinterLiquidityMining: 0x9EEe9B4a6750BAAb77D23476c2D0c50e4b2e068E
9+
SprinterLiquidityMining: 0x479D158959B59328E89f0fbF7DfeBb198c313C21
1010
CensoredTransferFromMulticall: 0x7C472EBa1945E970a23C903FC8812D469a29B6bb
1111
USDC: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
1212
Rebalancer: 0xA85Cf46c150db2600b1D03E437bedD5513869888
@@ -36,7 +36,7 @@
3636
LiquidityPoolUSDC: 0xB58Bb9643884abbbad64FA7eBc874c5481E5c032
3737
SprinterUSDCLPShare: 0xfa89929b30bC3132f9907CBCe3F2f6f4AC0903b6
3838
LiquidityHub: 0xa593A9bBBc65be342FF610a01e96da2EB8539FF2
39-
SprinterLiquidityMining: 0x9EEe9B4a6750BAAb77D23476c2D0c50e4b2e068E
39+
SprinterLiquidityMining: 0x479D158959B59328E89f0fbF7DfeBb198c313C21
4040
CensoredTransferFromMulticall: 0x7C472EBa1945E970a23C903FC8812D469a29B6bb
4141
USDC: 0x036CbD53842c5426634e7929541eC2318f3dCF7e
4242
Rebalancer: 0xA85Cf46c150db2600b1D03E437bedD5513869888

hardhat.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@ const config: HardhatUserConfig = {
257257
accounts: isSet(process.env.DRY_RUN)
258258
? [{privateKey: process.env.PRIVATE_KEY!, balance: "1000000000000000000"}]
259259
: undefined,
260+
chains: isSet(process.env.DRY_RUN) // https://github.com/NomicFoundation/hardhat/issues/5511
261+
? {[networkConfig[`${process.env.DRY_RUN}` as Network]!.chainId]: {hardforkHistory: {cancun: 0}}}
262+
: undefined,
260263
},
261264
},
262265
sourcify: {

network.config.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,9 @@ export const networkConfig: NetworksConfig = {
189189
DepositProfit: "0x83B8D2eAda788943c3e80892f37f9c102271C1D6",
190190
AssetsLimit: 10_000_000,
191191
Tiers: [
192-
{period: 7776000n, multiplier: 300000000n},
193-
{period: 15552000n, multiplier: 800000000n},
194-
{period: 31104000n, multiplier: 1666666667n},
192+
{period: 7776000n, multiplier: 400000000n},
193+
{period: 15552000n, multiplier: 1000000000n},
194+
{period: 31104000n, multiplier: 2200000000n},
195195
]
196196
},
197197
Routes: {
@@ -328,9 +328,9 @@ export const networkConfig: NetworksConfig = {
328328
DepositProfit: "0x6c663396827e68d10c58691f9c4bb58ae9ec85e3",
329329
AssetsLimit: 1000,
330330
Tiers: [
331-
{period: 600n, multiplier: 300000000n},
332-
{period: 1200n, multiplier: 800000000n},
333-
{period: 2400n, multiplier: 1666666667n},
331+
{period: 600n, multiplier: 400000000n},
332+
{period: 1200n, multiplier: 1000000000n},
333+
{period: 2400n, multiplier: 2200000000n},
334334
]
335335
},
336336
Routes: {

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
"deploy-ethereum": "hardhat run ./scripts/deploy.ts --network ETHEREUM",
1616
"deploy-arbitrumone": "hardhat run ./scripts/deploy.ts --network ARBITRUM_ONE",
1717
"deploy-opmainnet": "hardhat run ./scripts/deploy.ts --network OP_MAINNET",
18+
"redeploy-stash-basesepolia": "hardhat run ./scripts/redeployStash.ts --network BASE_SEPOLIA",
19+
"redeploy-stash-base": "hardhat run ./scripts/redeployStash.ts --network BASE",
1820
"upgrade-liquiditypool": "hardhat run ./scripts/upgradeLiquidityPool.ts",
1921
"upgrade-liquiditypool-basesepolia": "hardhat run ./scripts/upgradeLiquidityPool.ts --network BASE_SEPOLIA",
2022
"upgrade-liquiditypool-ethereumsepolia": "hardhat run ./scripts/upgradeLiquidityPool.ts --network ETHEREUM_SEPOLIA",
@@ -28,12 +30,13 @@
2830
"dry:deploy-ethereum": "DRY_RUN=ETHEREUM VERIFY=false ts-node --files ./scripts/deploy.ts",
2931
"dry:deploy-arbitrumone": "DRY_RUN=ARBITRUM_ONE VERIFY=false ts-node --files ./scripts/deploy.ts",
3032
"dry:deploy-opmainnet": "DRY_RUN=OP_MAINNET VERIFY=false ts-node --files ./scripts/deploy.ts",
33+
"dry:redeploy-stash-basesepolia": "DRY_RUN=BASE_SEPOLIA VERIFY=false ts-node --files ./scripts/redeployStash.ts",
34+
"dry:redeploy-stash-base": "DRY_RUN=BASE VERIFY=false ts-node --files ./scripts/redeployStash.ts",
3135
"lint": "npm run lint:solidity && npm run lint:ts",
3236
"lint:solidity": "solhint 'contracts/**/*.sol'",
3337
"lint:ts": "eslint",
3438
"test": "hardhat test --typecheck",
3539
"test:deploy": "ts-node --files ./scripts/deploy.ts",
36-
"test:upgrade": "ts-node --files ./scripts/upgradeLiquidityPool.ts",
3740
"test:scripts": "SCRIPT_ENV=CI DEPLOY_ID=CI ts-node --files ./scripts/test.ts"
3841
},
3942
"repository": {

scripts/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export function assert(condition: boolean, message: string): void {
1+
export function assert(condition: any, message: string): void {
22
if (condition) return;
33
throw new Error(message);
44
}

scripts/redeployStash.ts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import dotenv from "dotenv";
2+
dotenv.config();
3+
import hre from "hardhat";
4+
import {getVerifier} from "./helpers";
5+
import {resolveProxyXAddress} from "../test/helpers";
6+
import {isSet, assert} from "./common";
7+
import {SprinterLiquidityMining} from "../typechain-types";
8+
import {networkConfig, Network, NetworkConfig} from "../network.config";
9+
10+
export async function main() {
11+
const [deployer] = await hre.ethers.getSigners();
12+
13+
assert(isSet(process.env.DEPLOY_ID), "DEPLOY_ID must be set");
14+
assert(isSet(process.env.UPGRADE_ID), "UPGRADE_ID must be set");
15+
const verifier = getVerifier(process.env.UPGRADE_ID);
16+
console.log(`Deployment ID: ${process.env.DEPLOY_ID}`);
17+
console.log(`Redeployment ID: ${process.env.UPGRADE_ID}`);
18+
19+
let network: Network;
20+
let config: NetworkConfig;
21+
console.log(`Redeploying to: ${hre.network.name}`);
22+
if (hre.network.name === "hardhat" && Object.values(Network).includes(process.env.DRY_RUN as Network)) {
23+
network = process.env.DRY_RUN as Network;
24+
config = networkConfig[network];
25+
console.log(`Dry run on fork: ${network}`);
26+
} else if (Object.values(Network).includes(hre.network.name as Network)) {
27+
network = hre.network.name as Network;
28+
config = networkConfig[network];
29+
} else {
30+
console.log(`Nothing to redeploy on ${hre.network.name} network`);
31+
return;
32+
}
33+
34+
assert(config.Hub, "Must be a network with a hub");
35+
36+
const liquidityHub = await resolveProxyXAddress("LiquidityHub");
37+
38+
const tiers = config.Hub!.Tiers;
39+
const liquidityMining = (
40+
await verifier.deployX("SprinterLiquidityMining", deployer, {}, [config.Admin, liquidityHub, tiers])
41+
) as SprinterLiquidityMining;
42+
43+
console.log(`Admin: ${config.Admin}`);
44+
console.log(`SprinterLiquidityMining: ${liquidityMining.target}`);
45+
console.log("Tiers:");
46+
console.table(tiers.map(el => {
47+
const multiplier = `${el.multiplier / 1000000000n}.${el.multiplier % 1000000000n}x`;
48+
return {seconds: Number(el.period), multiplier};
49+
}));
50+
51+
await verifier.verify(process.env.VERIFY === "true");
52+
}
53+
54+
if (process.env.SCRIPT_ENV !== "CI") {
55+
main();
56+
}

scripts/test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ dotenv.config();
33
import {assert} from "./common";
44
import {main as deploy} from "./deploy";
55
import {main as upgradeRebalancer} from "./upgradeRebalancer";
6+
import {main as redeployStash} from "./redeployStash";
67

78
async function main() {
89
console.log("Test deploy.")
910
await deploy();
1011
console.log("Test upgradeRebalancer.")
1112
await upgradeRebalancer();
13+
console.log("Test redeployStash.")
14+
await redeployStash();
1215
console.log("Success.");
1316
}
1417

0 commit comments

Comments
 (0)