Skip to content

Commit d3e3672

Browse files
authored
Merge pull request #16 from rarimo/vaults_deploy
Vaults deploy
2 parents f3822c4 + d038f1e commit d3e3672

4 files changed

Lines changed: 155 additions & 1 deletion

File tree

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,21 @@ contracts
4848
└── VaultSubscriptionManager — "Vault-specific subscription manager"
4949
```
5050

51+
### Vaults deployment
52+
53+
To ensure that user vaults will always deploy at the same addresses with the same masterKey across different chains, we use the `CREATE3` approach via [CreateX](https://github.com/pcaversaccio/createx) to deploy the `VaultFactory` contract.
54+
55+
| Contract Name | Address | Chain |
56+
| ------------------------ | -------------------------------------------- | ----------------- |
57+
| VaultFactory | `0x54C239E71af51Fc141A2BDf5469dc992b7256AD8` | Ethereum Mainnet |
58+
| VaultSubscriptionManager | `0xdc8838478f49C212e68fD8b538B90c81D0f47621` | Ethereum Mainnet |
59+
60+
> [!NOTE]
61+
> The `VaultFactory` address will be the same on every supported chain, but other contract addresses may differ.
62+
63+
> [!IMPORTANT]
64+
> We used the salt `0x00D37f35Ec44ecC4e2F54de1FA3208F73d632E5900004e6f6e204f626c697461` during deployment. This ensures that only the protocol address `0x00D37f35Ec44ecC4e2F54de1FA3208F73d632E59` can deploy the VaultFactory contract across all chains.
65+
5166
### Setup
5267

5368
This project uses both Hardhat and Foundry. Follow these steps to set up the repository:

deploy/config/config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ export async function getConfig(): Promise<DeployConfig> {
1111
return validateConfig((await import("./sepolia")).deployConfig);
1212
}
1313

14+
if (hre.network.name == "ethereum") {
15+
return validateConfig((await import("./ethereum")).deployConfig);
16+
}
17+
1418
throw new Error(`Config for network ${hre.network.name} is not specified`);
1519
}
1620

deploy/config/ethereum.ts

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
import { ETHER_ADDR, wei } from "@scripts";
2+
3+
import { DeployConfig } from "./types";
4+
5+
const basePaymentPeriod = 2_629_800n; // 1 month
6+
const oneYear = basePaymentPeriod * 12n; // 1 year
7+
8+
export const deployConfig: DeployConfig = {
9+
contractsOwner: "0x00D37f35Ec44ecC4e2F54de1FA3208F73d632E59",
10+
reservedRMOConfig: {
11+
reservedTokensAmountPerAddress: wei(100, 18),
12+
},
13+
vaultSubscriptionManagerConfig: {
14+
paymentTokenModuleConfig: {
15+
basePaymentPeriod: basePaymentPeriod, // 1 month
16+
durationFactorEntries: [
17+
{
18+
duration: oneYear, // 1 year
19+
factor: 91666667000000000000000000n, // 0.91666667
20+
},
21+
{
22+
duration: oneYear * 2n, // 2 years
23+
factor: 87500000000000000000000000n, // 0.875
24+
},
25+
{
26+
duration: oneYear * 5n, // 5 years
27+
factor: 86666667000000000000000000n, // 0.86666667
28+
},
29+
{
30+
duration: oneYear * 10n, // 10 years
31+
factor: 83333333000000000000000000n, // 0.83333333
32+
},
33+
],
34+
paymentTokenEntries: [
35+
{
36+
paymentToken: ETHER_ADDR, // NATIVE ETH
37+
baseSubscriptionCost: 500000000000000n, // 0.0005 ETH
38+
},
39+
{
40+
paymentToken: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
41+
baseSubscriptionCost: 2000000n,
42+
},
43+
{
44+
paymentToken: "0xdAC17F958D2ee523a2206206994597C13D831ec7", // USDT
45+
baseSubscriptionCost: 2000000n,
46+
},
47+
],
48+
},
49+
sbtPaymentModuleConfig: {
50+
sbtEntries: [
51+
{
52+
sbt: "0xF6044AC164740c106246De210D03Bc04FE78cbAb", // ZK Recovery Waitlist SBT
53+
subscriptionDurationPerToken: oneYear, // 1 year
54+
},
55+
],
56+
},
57+
signatureSubscriptionModuleConfig: {
58+
subscriptionSigner: "0xE9a5a2f2Da84F02d92E82EbB0A0d875797c770e5",
59+
},
60+
crossChainModuleConfig: {
61+
subscriptionsSynchronizer: "0x0000000000000000000000000000000000000000",
62+
},
63+
},
64+
accountSubscriptionManagerConfig: {
65+
paymentTokenModuleConfig: {
66+
basePaymentPeriod: basePaymentPeriod, // 1 month
67+
durationFactorEntries: [
68+
{
69+
duration: oneYear, // 1 year
70+
factor: 91666667000000000000000000n, // 0.91666667
71+
},
72+
{
73+
duration: oneYear * 2n, // 2 years
74+
factor: 87500000000000000000000000n, // 0.875
75+
},
76+
{
77+
duration: oneYear * 5n, // 5 years
78+
factor: 86666667000000000000000000n, // 0.86666667
79+
},
80+
{
81+
duration: oneYear * 10n, // 10 years
82+
factor: 83333333000000000000000000n, // 0.83333333
83+
},
84+
],
85+
paymentTokenEntries: [
86+
{
87+
paymentToken: ETHER_ADDR, // NATIVE ETH
88+
baseSubscriptionCost: 500000000000000n, // 0.0005 ETH
89+
},
90+
{
91+
paymentToken: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
92+
baseSubscriptionCost: 2000000n,
93+
},
94+
{
95+
paymentToken: "0xdAC17F958D2ee523a2206206994597C13D831ec7", // USDT
96+
baseSubscriptionCost: 2000000n,
97+
},
98+
],
99+
},
100+
sbtPaymentModuleConfig: {
101+
sbtEntries: [
102+
{
103+
sbt: "0xF6044AC164740c106246De210D03Bc04FE78cbAb", // ZK Recovery Waitlist SBT
104+
subscriptionDurationPerToken: oneYear, // 1 year
105+
},
106+
],
107+
},
108+
signatureSubscriptionModuleConfig: {
109+
subscriptionSigner: "0xE9a5a2f2Da84F02d92E82EbB0A0d875797c770e5",
110+
},
111+
crossChainModuleConfig: {
112+
subscriptionsSynchronizer: "0x000000000000000000000000000000000000000",
113+
},
114+
},
115+
sideChainSubscriptionManagerConfig: {
116+
baseSideChainSubscriptionManagerConfig: {
117+
subscriptionsStateReceiver: "0x0000000000000000000000000000000000000000",
118+
sourceSubscriptionManager: "0x0000000000000000000000000000000000000000",
119+
},
120+
},
121+
crosschainConfig: {
122+
subscriptionsSynchronizerConfig: {
123+
wormholeRelayer: "0x27428DD2d3DD32A4D7f7C497eAaa23130d894911",
124+
crossChainTxGasLimit: 5_000_000n,
125+
SMTMaxDepth: 80,
126+
subscriptionManagers: [],
127+
destinations: [],
128+
},
129+
subscriptionsStateReceiverConfig: {
130+
wormholeRelayer: "0x27428DD2d3DD32A4D7f7C497eAaa23130d894911",
131+
subscriptionsSynchronizer: "0x0000000000000000000000000000000000000000",
132+
sourceChainId: 1,
133+
},
134+
},
135+
};

deploy/vaults/helpers/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ export async function getVaultFactoryAddr(createXDeployer: ICreateX, signerAddr:
1212
}
1313

1414
export function getVaultFactorySalt(signerAddr: string): string {
15-
return `${signerAddr}001231231231231231232226`;
15+
return `${signerAddr}00004e6f6e204f626c697461`;
1616
}

0 commit comments

Comments
 (0)