Skip to content

Commit

Permalink
checks current ETH Balance on load
Browse files Browse the repository at this point in the history
adds all test networks to oz config
contains a deployed instance definition of an ADI token
  • Loading branch information
elmariachi111 committed May 19, 2020
1 parent 38ef095 commit bf59d75
Show file tree
Hide file tree
Showing 7 changed files with 480 additions and 1,051 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ sketch
.openzeppelin/.session

.openzeppelin/dev-*
build
build
.secrets.json
306 changes: 306 additions & 0 deletions .openzeppelin/goerli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,306 @@
{
"contracts": {
"ADIToken": {
"address": "0x444a25e1bCFD4bc9C57e69E0C0e24a0983fA24e2",
"constructorCode": "608060405234801561001057600080fd5b506132e6806100206000396000f3fe",
"bodyBytecodeHash": "1b410ccbfbd16950646ec358cc1a7e6b243a43eef7ff286bee2facd8ca7cf345",
"localBytecodeHash": "782cb7bac9de5fe51892a8e2f149e2dded6d3d660952e847e89f7f0c14f67e53",
"deployedBytecodeHash": "782cb7bac9de5fe51892a8e2f149e2dded6d3d660952e847e89f7f0c14f67e53",
"types": {
"t_bool": {
"id": "t_bool",
"kind": "elementary",
"label": "bool"
},
"t_uint256": {
"id": "t_uint256",
"kind": "elementary",
"label": "uint256"
},
"t_array:50<t_uint256>": {
"id": "t_array:50<t_uint256>",
"valueType": "t_uint256",
"length": "50",
"kind": "array",
"label": "uint256[50]"
},
"t_struct<AccessControlUpgradeSafe.RoleData>": {
"id": "t_struct<AccessControlUpgradeSafe.RoleData>",
"kind": "struct",
"label": "AccessControlUpgradeSafe.RoleData",
"members": [
{
"label": "members",
"astId": 154,
"type": "t_struct<EnumerableSet.AddressSet>",
"src": "1655:32:2"
},
{
"label": "adminRole",
"astId": 156,
"type": "t_bytes32",
"src": "1697:17:2"
}
]
},
"t_struct<EnumerableSet.AddressSet>": {
"id": "t_struct<EnumerableSet.AddressSet>",
"kind": "struct",
"label": "EnumerableSet.AddressSet",
"members": [
{
"label": "_inner",
"astId": 1804,
"type": "t_struct<EnumerableSet.Set>",
"src": "4644:10:10"
}
]
},
"t_struct<EnumerableSet.Set>": {
"id": "t_struct<EnumerableSet.Set>",
"kind": "struct",
"label": "EnumerableSet.Set",
"members": [
{
"label": "_values",
"astId": 1620,
"type": "t_array:dyn<t_bytes32>",
"src": "1213:17:10"
},
{
"label": "_indexes",
"astId": 1624,
"type": "t_mapping<t_uint256>",
"src": "1364:37:10"
}
]
},
"t_bytes32": {
"id": "t_bytes32",
"kind": "elementary",
"label": "bytes32"
},
"t_array:dyn<t_bytes32>": {
"id": "t_array:dyn<t_bytes32>",
"valueType": "t_bytes32",
"length": "dyn",
"kind": "array",
"label": "bytes32[]"
},
"t_mapping<t_uint256>": {
"id": "t_mapping<t_uint256>",
"valueType": "t_uint256",
"label": "mapping(key => uint256)",
"kind": "mapping"
},
"t_mapping<t_struct<AccessControlUpgradeSafe.RoleData>>": {
"id": "t_mapping<t_struct<AccessControlUpgradeSafe.RoleData>>",
"valueType": "t_struct<AccessControlUpgradeSafe.RoleData>",
"label": "mapping(key => AccessControlUpgradeSafe.RoleData)",
"kind": "mapping"
},
"t_array:49<t_uint256>": {
"id": "t_array:49<t_uint256>",
"valueType": "t_uint256",
"length": "49",
"kind": "array",
"label": "uint256[49]"
},
"t_string": {
"id": "t_string",
"kind": "elementary",
"label": "string"
},
"t_uint8": {
"id": "t_uint8",
"kind": "elementary",
"label": "uint8"
},
"t_array:44<t_uint256>": {
"id": "t_array:44<t_uint256>",
"valueType": "t_uint256",
"length": "44",
"kind": "array",
"label": "uint256[44]"
}
},
"storage": [
{
"contract": "Initializable",
"path": "@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol",
"label": "initialized",
"astId": 49,
"type": "t_bool",
"src": "757:24:1"
},
{
"contract": "Initializable",
"path": "@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol",
"label": "initializing",
"astId": 51,
"type": "t_bool",
"src": "876:25:1"
},
{
"contract": "Initializable",
"path": "@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol",
"label": "______gap",
"astId": 116,
"type": "t_array:50<t_uint256>",
"src": "1982:29:1"
},
{
"contract": "ContextUpgradeSafe",
"path": "@openzeppelin/contracts-ethereum-package/contracts/GSN/Context.sol",
"label": "__gap",
"astId": 43,
"type": "t_array:50<t_uint256>",
"src": "1277:25:0"
},
{
"contract": "AccessControlUpgradeSafe",
"path": "@openzeppelin/contracts-ethereum-package/contracts/access/AccessControl.sol",
"label": "_roles",
"astId": 161,
"type": "t_mapping<t_struct<AccessControlUpgradeSafe.RoleData>>",
"src": "1727:44:2"
},
{
"contract": "AccessControlUpgradeSafe",
"path": "@openzeppelin/contracts-ethereum-package/contracts/access/AccessControl.sol",
"label": "__gap",
"astId": 406,
"type": "t_array:49<t_uint256>",
"src": "6927:25:2"
},
{
"contract": "ERC20UpgradeSafe",
"path": "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol",
"label": "_balances",
"astId": 816,
"type": "t_mapping<t_uint256>",
"src": "1481:46:5"
},
{
"contract": "ERC20UpgradeSafe",
"path": "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol",
"label": "_allowances",
"astId": 822,
"type": "t_mapping<t_uint256>",
"src": "1534:69:5"
},
{
"contract": "ERC20UpgradeSafe",
"path": "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol",
"label": "_totalSupply",
"astId": 824,
"type": "t_uint256",
"src": "1610:28:5"
},
{
"contract": "ERC20UpgradeSafe",
"path": "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol",
"label": "_name",
"astId": 826,
"type": "t_string",
"src": "1645:20:5"
},
{
"contract": "ERC20UpgradeSafe",
"path": "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol",
"label": "_symbol",
"astId": 828,
"type": "t_string",
"src": "1671:22:5"
},
{
"contract": "ERC20UpgradeSafe",
"path": "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol",
"label": "_decimals",
"astId": 830,
"type": "t_uint8",
"src": "1699:23:5"
},
{
"contract": "ERC20UpgradeSafe",
"path": "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol",
"label": "__gap",
"astId": 1325,
"type": "t_array:44<t_uint256>",
"src": "11045:25:5"
},
{
"contract": "ERC20BurnableUpgradeSafe",
"path": "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20Burnable.sol",
"label": "__gap",
"astId": 1406,
"type": "t_array:50<t_uint256>",
"src": "1443:25:6"
},
{
"contract": "PausableUpgradeSafe",
"path": "@openzeppelin/contracts-ethereum-package/contracts/utils/Pausable.sol",
"label": "_paused",
"astId": 2030,
"type": "t_bool",
"src": "825:20:11"
},
{
"contract": "PausableUpgradeSafe",
"path": "@openzeppelin/contracts-ethereum-package/contracts/utils/Pausable.sol",
"label": "__gap",
"astId": 2119,
"type": "t_array:49<t_uint256>",
"src": "2073:25:11"
},
{
"contract": "ERC20PausableUpgradeSafe",
"path": "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20Pausable.sol",
"label": "__gap",
"astId": 1471,
"type": "t_array:50<t_uint256>",
"src": "1130:25:7"
},
{
"contract": "ERC20PresetMinterPauserUpgradeSafe",
"path": "@openzeppelin/contracts-ethereum-package/contracts/presets/ERC20PresetMinterPauser.sol",
"label": "__gap",
"astId": 791,
"type": "t_array:50<t_uint256>",
"src": "3454:25:4"
}
],
"warnings": {
"hasConstructor": false,
"hasSelfDestruct": false,
"hasDelegateCall": false,
"hasInitialValuesInDeclarations": false,
"uninitializedBaseContracts": []
}
}
},
"solidityLibs": {},
"proxies": {
"ledger-academy/ADIToken": [
{
"address": "0x7c9BeD2220B6A7545d31ad8911BAeB7003483337",
"version": "1.0.0",
"implementation": "0x444a25e1bCFD4bc9C57e69E0C0e24a0983fA24e2",
"admin": "0x5c19BF66CC2c9386Cdf06d346F32F140A4559be9",
"kind": "Upgradeable"
}
]
},
"manifestVersion": "2.2",
"dependencies": {
"@openzeppelin/contracts-ethereum-package": {
"package": "0xCE3FB0777BABB88289088dfad6e82bF4eF74d7e8",
"version": "3.0.0",
"customDeploy": true
}
},
"version": "1.0.0",
"proxyAdmin": {
"address": "0x5c19BF66CC2c9386Cdf06d346F32F140A4559be9"
}
}
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# The Ledger academy

## Deploy your contracts...

`yarn`
create a mnemonic for you (npx mnemonic)
add a `.secrets.json`:

```
{
"mnemonic": "choose your words wisely ...",
"projectId": "YOUR_INFURA_POJECT_KEY"
}
```

then fund your 1st account with ether.
https://goerli-faucet.slock.it/
https://faucet.rinkeby.io/
https://faucet.ropsten.be/

and send some test ether to your metamask instance on the same network

then

`oz deploy` take down its address, add it to your `.secrets.json` as `contractAddress`:

```
{
...,
"contractAddress": "0x7c9BeD2220B6A7545d31ad8911BAeB7003483337"
}
```

after contract has been compiled copy / link the compiled json definition into the src folder:

```
ln -s build/contracts/ADIToken.json src/contracts
```

now you can read its ABI from Javascript

## live instances:

goerli: 0x7c9BeD2220B6A7545d31ad8911BAeB7003483337
20 changes: 20 additions & 0 deletions networks.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
const { projectId, mnemonic } = require('./.secrets.json');
const HDWalletProvider = require('@truffle/hdwallet-provider');

module.exports = {
networks: {
development: {
Expand All @@ -8,5 +11,22 @@ module.exports = {
gasPrice: 5e9,
networkId: '*',
},
ropsten: {
provider: () => new HDWalletProvider(mnemonic, "https://ropsten.infura.io/v3/" + projectId),
networkId: 3, // Ropsten's id
},
rinkeby: {
provider: () => new HDWalletProvider(mnemonic, "https://rinkeby.infura.io/v3/" + projectId),
networkId: 4, // Rinkeby's id
},
kovan: {
provider: () => new HDWalletProvider(mnemonic, "https://kovan.infura.io/v3/" + projectId),
networkId: 42, // Kovan's id
},
goerli: {
provider: () => new HDWalletProvider(mnemonic, "https://goerli.infura.io/v3/" + projectId),
networkId: 5, // Goerli's id
gas: 7500000,
},
},
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"last 3 Chrome versions"
],
"devDependencies": {
"@truffle/hdwallet-provider": "^1.0.35",
"parcel-bundler": "^1.12.4",
"typescript": "^3.9.2"
}
Expand Down
Loading

0 comments on commit bf59d75

Please sign in to comment.