Skip to content

Commit 46a3cc3

Browse files
committed
publish most recent smart contracts
1 parent 5e8a64f commit 46a3cc3

File tree

179 files changed

+48152
-846
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+48152
-846
lines changed

.env_sample

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
DEFENDER_KEY=
2+
DEFENDER_SECRET=

.github/workflows/test.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types:
9+
- opened
10+
- synchronize
11+
- reopened
12+
- labeled
13+
14+
concurrency:
15+
group: ci-${{ github.ref }}-tests
16+
cancel-in-progress: true
17+
18+
env:
19+
FOUNDRY_PROFILE: "ci"
20+
21+
jobs:
22+
check:
23+
strategy:
24+
fail-fast: true
25+
26+
name: Foundry project
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v3
30+
with:
31+
submodules: recursive
32+
33+
- name: Install Foundry
34+
uses: foundry-rs/foundry-toolchain@v1
35+
36+
- name: Install deps
37+
run: |
38+
npm i
39+
forge install
40+
41+
#- name: Run Forge build
42+
# run: |
43+
# forge build --sizes
44+
45+
- name: Run fmt check
46+
run: |
47+
npm run fmt:check
48+
49+
- name: Run Forge tests
50+
run: |
51+
forge test -vvv

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
node_modules
2+
.env
3+
coverage
4+
coverage.json
5+
typechain
6+
typechain-types
7+
8+
# Hardhat files
9+
cache
10+
artifacts
11+
12+
# Foundry files
13+
cache_forge
14+
out
15+
broadcast
16+
cache_hardhat
17+
artifacts
18+
exports/abis/local.json
19+
exports/addresses/local.json
20+
21+
# misc
22+
.vscode
23+
.idea
24+
.DS_Store
25+
_playground/*.json
26+
.env_mainnet
27+
.env_testnet

.gitmodules

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[submodule "lib/forge-std"]
2+
path = lib/forge-std
3+
url = https://github.com/foundry-rs/forge-std
4+
[submodule "lib/solmate"]
5+
path = lib/solmate
6+
url = https://github.com/transmissions11/solmate
7+
[submodule "lib/solady"]
8+
path = lib/solady
9+
url = https://github.com/Vectorized/solady
10+
[submodule "lib/council"]
11+
path = lib/council
12+
url = https://github.com/delvtech/council
13+
[submodule "lib/openzeppelin-contracts"]
14+
path = lib/openzeppelin-contracts
15+
url = https://github.com/OpenZeppelin/openzeppelin-contracts
16+
[submodule "lib/openzeppelin-contracts-upgradeable"]
17+
path = lib/openzeppelin-contracts-upgradeable
18+
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
19+
[submodule "lib/openzeppelin-foundry-upgrades"]
20+
path = lib/openzeppelin-foundry-upgrades
21+
url = https://github.com/OpenZeppelin/openzeppelin-foundry-upgrades

_playground/DeployAtomWallet.ts

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
import { ethers } from "ethers";
2+
require('dotenv').config();
3+
4+
const API_URL = "<< RPC URL>>";
5+
const PROXY_ADDRESS = "0x0000000000000000000000000000000000000000"; // Transparent Upgradable Proxy
6+
const CHAIN_ID = 84532; // Base Sepolia (84532), Base Mainnet (8453)
7+
8+
async function main() {
9+
10+
const private_key = process.env.PRIVATE_KEY ? String(process.env.PRIVATE_KEY) : "";
11+
12+
// ABI of the EthMultiVault contract (reduced)
13+
const abi = [
14+
{
15+
"type": "function",
16+
"name": "count",
17+
"inputs": [],
18+
"outputs": [
19+
{
20+
"name": "",
21+
"type": "uint256",
22+
"internalType": "uint256"
23+
}
24+
],
25+
"stateMutability": "view"
26+
},
27+
{
28+
"type": "function",
29+
"name": "getAtomCost",
30+
"inputs": [],
31+
"outputs": [
32+
{
33+
"name": "",
34+
"type": "uint256",
35+
"internalType": "uint256"
36+
}
37+
],
38+
"stateMutability": "view"
39+
},
40+
{
41+
"type": "function",
42+
"name": "createAtom",
43+
"inputs": [
44+
{
45+
"name": "atomUri",
46+
"type": "bytes",
47+
"internalType": "bytes"
48+
}
49+
],
50+
"outputs": [
51+
{
52+
"name": "",
53+
"type": "uint256",
54+
"internalType": "uint256"
55+
}
56+
],
57+
"stateMutability": "payable"
58+
},
59+
{
60+
"type": "function",
61+
"name": "deployAtomWallet",
62+
"inputs": [
63+
{
64+
"name": "atomId",
65+
"type": "uint256",
66+
"internalType": "uint256"
67+
}
68+
],
69+
"outputs": [
70+
{
71+
"name": "",
72+
"type": "address",
73+
"internalType": "address"
74+
}
75+
],
76+
"stateMutability": "nonpayable"
77+
},
78+
];
79+
80+
// Connect to the network
81+
let provider = new ethers.providers.JsonRpcProvider(API_URL, CHAIN_ID);
82+
83+
// We connect to the Contract using a Provider, so we will only
84+
// have read-only access to the Contract
85+
let contract = new ethers.Contract(PROXY_ADDRESS, abi, provider);
86+
87+
// Check the current vault counter
88+
let counter = await contract.count();
89+
console.log("counter:", counter.toNumber());
90+
91+
let vaultId = counter.toNumber() + 1;
92+
console.log("vaultId:", vaultId);
93+
94+
let atomId = `atom${vaultId}`;
95+
console.log("atomId:", atomId);
96+
97+
// Get the current value
98+
let atomCost = await contract.getAtomCost();
99+
console.log("atomCost:", atomCost.toNumber());
100+
101+
// Load the wallet to deploy the contract with
102+
let wallet = new ethers.Wallet(private_key, provider);
103+
104+
// Create a new instance of the Contract with a Signer, which allows
105+
// update methods
106+
let contractWithSigner = contract.connect(wallet);
107+
108+
let atomURI = ethers.utils.solidityPack(["string"], [atomId]);
109+
110+
let tx = await contractWithSigner.createAtom(
111+
atomURI, {
112+
value: atomCost,
113+
gasPrice: ethers.utils.parseUnits("0.5", "gwei"),
114+
}
115+
);
116+
117+
console.log("Tx hash:", tx.hash);
118+
119+
// The operation is NOT complete yet; we must wait until it is mined
120+
await tx.wait();
121+
122+
console.log("tx:", tx);
123+
124+
let tx2 = await contractWithSigner.deployAtomWallet(
125+
vaultId, {
126+
gasPrice: ethers.utils.parseUnits("0.5", "gwei"),
127+
}
128+
);
129+
130+
await tx2.wait();
131+
132+
console.log("tx2:", tx2);
133+
}
134+
135+
main()
136+
.then(() => process.exit(0))
137+
.catch((e) => {
138+
console.error(e)
139+
process.exit(1)
140+
})

0 commit comments

Comments
 (0)