Skip to content

Commit bf59d75

Browse files
committed
checks current ETH Balance on load
adds all test networks to oz config contains a deployed instance definition of an ADI token
1 parent 38ef095 commit bf59d75

File tree

7 files changed

+480
-1051
lines changed

7 files changed

+480
-1051
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ sketch
2222
.openzeppelin/.session
2323

2424
.openzeppelin/dev-*
25-
build
25+
build
26+
.secrets.json

.openzeppelin/goerli.json

Lines changed: 306 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,306 @@
1+
{
2+
"contracts": {
3+
"ADIToken": {
4+
"address": "0x444a25e1bCFD4bc9C57e69E0C0e24a0983fA24e2",
5+
"constructorCode": "608060405234801561001057600080fd5b506132e6806100206000396000f3fe",
6+
"bodyBytecodeHash": "1b410ccbfbd16950646ec358cc1a7e6b243a43eef7ff286bee2facd8ca7cf345",
7+
"localBytecodeHash": "782cb7bac9de5fe51892a8e2f149e2dded6d3d660952e847e89f7f0c14f67e53",
8+
"deployedBytecodeHash": "782cb7bac9de5fe51892a8e2f149e2dded6d3d660952e847e89f7f0c14f67e53",
9+
"types": {
10+
"t_bool": {
11+
"id": "t_bool",
12+
"kind": "elementary",
13+
"label": "bool"
14+
},
15+
"t_uint256": {
16+
"id": "t_uint256",
17+
"kind": "elementary",
18+
"label": "uint256"
19+
},
20+
"t_array:50<t_uint256>": {
21+
"id": "t_array:50<t_uint256>",
22+
"valueType": "t_uint256",
23+
"length": "50",
24+
"kind": "array",
25+
"label": "uint256[50]"
26+
},
27+
"t_struct<AccessControlUpgradeSafe.RoleData>": {
28+
"id": "t_struct<AccessControlUpgradeSafe.RoleData>",
29+
"kind": "struct",
30+
"label": "AccessControlUpgradeSafe.RoleData",
31+
"members": [
32+
{
33+
"label": "members",
34+
"astId": 154,
35+
"type": "t_struct<EnumerableSet.AddressSet>",
36+
"src": "1655:32:2"
37+
},
38+
{
39+
"label": "adminRole",
40+
"astId": 156,
41+
"type": "t_bytes32",
42+
"src": "1697:17:2"
43+
}
44+
]
45+
},
46+
"t_struct<EnumerableSet.AddressSet>": {
47+
"id": "t_struct<EnumerableSet.AddressSet>",
48+
"kind": "struct",
49+
"label": "EnumerableSet.AddressSet",
50+
"members": [
51+
{
52+
"label": "_inner",
53+
"astId": 1804,
54+
"type": "t_struct<EnumerableSet.Set>",
55+
"src": "4644:10:10"
56+
}
57+
]
58+
},
59+
"t_struct<EnumerableSet.Set>": {
60+
"id": "t_struct<EnumerableSet.Set>",
61+
"kind": "struct",
62+
"label": "EnumerableSet.Set",
63+
"members": [
64+
{
65+
"label": "_values",
66+
"astId": 1620,
67+
"type": "t_array:dyn<t_bytes32>",
68+
"src": "1213:17:10"
69+
},
70+
{
71+
"label": "_indexes",
72+
"astId": 1624,
73+
"type": "t_mapping<t_uint256>",
74+
"src": "1364:37:10"
75+
}
76+
]
77+
},
78+
"t_bytes32": {
79+
"id": "t_bytes32",
80+
"kind": "elementary",
81+
"label": "bytes32"
82+
},
83+
"t_array:dyn<t_bytes32>": {
84+
"id": "t_array:dyn<t_bytes32>",
85+
"valueType": "t_bytes32",
86+
"length": "dyn",
87+
"kind": "array",
88+
"label": "bytes32[]"
89+
},
90+
"t_mapping<t_uint256>": {
91+
"id": "t_mapping<t_uint256>",
92+
"valueType": "t_uint256",
93+
"label": "mapping(key => uint256)",
94+
"kind": "mapping"
95+
},
96+
"t_mapping<t_struct<AccessControlUpgradeSafe.RoleData>>": {
97+
"id": "t_mapping<t_struct<AccessControlUpgradeSafe.RoleData>>",
98+
"valueType": "t_struct<AccessControlUpgradeSafe.RoleData>",
99+
"label": "mapping(key => AccessControlUpgradeSafe.RoleData)",
100+
"kind": "mapping"
101+
},
102+
"t_array:49<t_uint256>": {
103+
"id": "t_array:49<t_uint256>",
104+
"valueType": "t_uint256",
105+
"length": "49",
106+
"kind": "array",
107+
"label": "uint256[49]"
108+
},
109+
"t_string": {
110+
"id": "t_string",
111+
"kind": "elementary",
112+
"label": "string"
113+
},
114+
"t_uint8": {
115+
"id": "t_uint8",
116+
"kind": "elementary",
117+
"label": "uint8"
118+
},
119+
"t_array:44<t_uint256>": {
120+
"id": "t_array:44<t_uint256>",
121+
"valueType": "t_uint256",
122+
"length": "44",
123+
"kind": "array",
124+
"label": "uint256[44]"
125+
}
126+
},
127+
"storage": [
128+
{
129+
"contract": "Initializable",
130+
"path": "@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol",
131+
"label": "initialized",
132+
"astId": 49,
133+
"type": "t_bool",
134+
"src": "757:24:1"
135+
},
136+
{
137+
"contract": "Initializable",
138+
"path": "@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol",
139+
"label": "initializing",
140+
"astId": 51,
141+
"type": "t_bool",
142+
"src": "876:25:1"
143+
},
144+
{
145+
"contract": "Initializable",
146+
"path": "@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol",
147+
"label": "______gap",
148+
"astId": 116,
149+
"type": "t_array:50<t_uint256>",
150+
"src": "1982:29:1"
151+
},
152+
{
153+
"contract": "ContextUpgradeSafe",
154+
"path": "@openzeppelin/contracts-ethereum-package/contracts/GSN/Context.sol",
155+
"label": "__gap",
156+
"astId": 43,
157+
"type": "t_array:50<t_uint256>",
158+
"src": "1277:25:0"
159+
},
160+
{
161+
"contract": "AccessControlUpgradeSafe",
162+
"path": "@openzeppelin/contracts-ethereum-package/contracts/access/AccessControl.sol",
163+
"label": "_roles",
164+
"astId": 161,
165+
"type": "t_mapping<t_struct<AccessControlUpgradeSafe.RoleData>>",
166+
"src": "1727:44:2"
167+
},
168+
{
169+
"contract": "AccessControlUpgradeSafe",
170+
"path": "@openzeppelin/contracts-ethereum-package/contracts/access/AccessControl.sol",
171+
"label": "__gap",
172+
"astId": 406,
173+
"type": "t_array:49<t_uint256>",
174+
"src": "6927:25:2"
175+
},
176+
{
177+
"contract": "ERC20UpgradeSafe",
178+
"path": "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol",
179+
"label": "_balances",
180+
"astId": 816,
181+
"type": "t_mapping<t_uint256>",
182+
"src": "1481:46:5"
183+
},
184+
{
185+
"contract": "ERC20UpgradeSafe",
186+
"path": "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol",
187+
"label": "_allowances",
188+
"astId": 822,
189+
"type": "t_mapping<t_uint256>",
190+
"src": "1534:69:5"
191+
},
192+
{
193+
"contract": "ERC20UpgradeSafe",
194+
"path": "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol",
195+
"label": "_totalSupply",
196+
"astId": 824,
197+
"type": "t_uint256",
198+
"src": "1610:28:5"
199+
},
200+
{
201+
"contract": "ERC20UpgradeSafe",
202+
"path": "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol",
203+
"label": "_name",
204+
"astId": 826,
205+
"type": "t_string",
206+
"src": "1645:20:5"
207+
},
208+
{
209+
"contract": "ERC20UpgradeSafe",
210+
"path": "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol",
211+
"label": "_symbol",
212+
"astId": 828,
213+
"type": "t_string",
214+
"src": "1671:22:5"
215+
},
216+
{
217+
"contract": "ERC20UpgradeSafe",
218+
"path": "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol",
219+
"label": "_decimals",
220+
"astId": 830,
221+
"type": "t_uint8",
222+
"src": "1699:23:5"
223+
},
224+
{
225+
"contract": "ERC20UpgradeSafe",
226+
"path": "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol",
227+
"label": "__gap",
228+
"astId": 1325,
229+
"type": "t_array:44<t_uint256>",
230+
"src": "11045:25:5"
231+
},
232+
{
233+
"contract": "ERC20BurnableUpgradeSafe",
234+
"path": "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20Burnable.sol",
235+
"label": "__gap",
236+
"astId": 1406,
237+
"type": "t_array:50<t_uint256>",
238+
"src": "1443:25:6"
239+
},
240+
{
241+
"contract": "PausableUpgradeSafe",
242+
"path": "@openzeppelin/contracts-ethereum-package/contracts/utils/Pausable.sol",
243+
"label": "_paused",
244+
"astId": 2030,
245+
"type": "t_bool",
246+
"src": "825:20:11"
247+
},
248+
{
249+
"contract": "PausableUpgradeSafe",
250+
"path": "@openzeppelin/contracts-ethereum-package/contracts/utils/Pausable.sol",
251+
"label": "__gap",
252+
"astId": 2119,
253+
"type": "t_array:49<t_uint256>",
254+
"src": "2073:25:11"
255+
},
256+
{
257+
"contract": "ERC20PausableUpgradeSafe",
258+
"path": "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20Pausable.sol",
259+
"label": "__gap",
260+
"astId": 1471,
261+
"type": "t_array:50<t_uint256>",
262+
"src": "1130:25:7"
263+
},
264+
{
265+
"contract": "ERC20PresetMinterPauserUpgradeSafe",
266+
"path": "@openzeppelin/contracts-ethereum-package/contracts/presets/ERC20PresetMinterPauser.sol",
267+
"label": "__gap",
268+
"astId": 791,
269+
"type": "t_array:50<t_uint256>",
270+
"src": "3454:25:4"
271+
}
272+
],
273+
"warnings": {
274+
"hasConstructor": false,
275+
"hasSelfDestruct": false,
276+
"hasDelegateCall": false,
277+
"hasInitialValuesInDeclarations": false,
278+
"uninitializedBaseContracts": []
279+
}
280+
}
281+
},
282+
"solidityLibs": {},
283+
"proxies": {
284+
"ledger-academy/ADIToken": [
285+
{
286+
"address": "0x7c9BeD2220B6A7545d31ad8911BAeB7003483337",
287+
"version": "1.0.0",
288+
"implementation": "0x444a25e1bCFD4bc9C57e69E0C0e24a0983fA24e2",
289+
"admin": "0x5c19BF66CC2c9386Cdf06d346F32F140A4559be9",
290+
"kind": "Upgradeable"
291+
}
292+
]
293+
},
294+
"manifestVersion": "2.2",
295+
"dependencies": {
296+
"@openzeppelin/contracts-ethereum-package": {
297+
"package": "0xCE3FB0777BABB88289088dfad6e82bF4eF74d7e8",
298+
"version": "3.0.0",
299+
"customDeploy": true
300+
}
301+
},
302+
"version": "1.0.0",
303+
"proxyAdmin": {
304+
"address": "0x5c19BF66CC2c9386Cdf06d346F32F140A4559be9"
305+
}
306+
}

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# The Ledger academy
2+
3+
## Deploy your contracts...
4+
5+
`yarn`
6+
create a mnemonic for you (npx mnemonic)
7+
add a `.secrets.json`:
8+
9+
```
10+
{
11+
"mnemonic": "choose your words wisely ...",
12+
"projectId": "YOUR_INFURA_POJECT_KEY"
13+
}
14+
```
15+
16+
then fund your 1st account with ether.
17+
https://goerli-faucet.slock.it/
18+
https://faucet.rinkeby.io/
19+
https://faucet.ropsten.be/
20+
21+
and send some test ether to your metamask instance on the same network
22+
23+
then
24+
25+
`oz deploy` take down its address, add it to your `.secrets.json` as `contractAddress`:
26+
27+
```
28+
{
29+
...,
30+
"contractAddress": "0x7c9BeD2220B6A7545d31ad8911BAeB7003483337"
31+
}
32+
```
33+
34+
after contract has been compiled copy / link the compiled json definition into the src folder:
35+
36+
```
37+
ln -s build/contracts/ADIToken.json src/contracts
38+
```
39+
40+
now you can read its ABI from Javascript
41+
42+
## live instances:
43+
44+
goerli: 0x7c9BeD2220B6A7545d31ad8911BAeB7003483337

networks.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
const { projectId, mnemonic } = require('./.secrets.json');
2+
const HDWalletProvider = require('@truffle/hdwallet-provider');
3+
14
module.exports = {
25
networks: {
36
development: {
@@ -8,5 +11,22 @@ module.exports = {
811
gasPrice: 5e9,
912
networkId: '*',
1013
},
14+
ropsten: {
15+
provider: () => new HDWalletProvider(mnemonic, "https://ropsten.infura.io/v3/" + projectId),
16+
networkId: 3, // Ropsten's id
17+
},
18+
rinkeby: {
19+
provider: () => new HDWalletProvider(mnemonic, "https://rinkeby.infura.io/v3/" + projectId),
20+
networkId: 4, // Rinkeby's id
21+
},
22+
kovan: {
23+
provider: () => new HDWalletProvider(mnemonic, "https://kovan.infura.io/v3/" + projectId),
24+
networkId: 42, // Kovan's id
25+
},
26+
goerli: {
27+
provider: () => new HDWalletProvider(mnemonic, "https://goerli.infura.io/v3/" + projectId),
28+
networkId: 5, // Goerli's id
29+
gas: 7500000,
30+
},
1131
},
1232
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"last 3 Chrome versions"
2525
],
2626
"devDependencies": {
27+
"@truffle/hdwallet-provider": "^1.0.35",
2728
"parcel-bundler": "^1.12.4",
2829
"typescript": "^3.9.2"
2930
}

0 commit comments

Comments
 (0)