|
| 1 | +# Authereum Contracts |
| 2 | + |
| 3 | +> Ethereum smart contract for [Authereum](http://authereum.org) |
| 4 | +
|
| 5 | +## Config |
| 6 | + |
| 7 | +Environment variables: |
| 8 | + |
| 9 | +``` |
| 10 | +NETWORK_NAME=kovan |
| 11 | +ETH_HTTP_PROVIDER_URI='https://kovan.infura.io/v3/{infuraId}' |
| 12 | +SENDER_ADDRESS=0x... |
| 13 | +SENDER_PRIVATE_KEY=0x... |
| 14 | +LOGIC_ADDRESS=0x... |
| 15 | +ZOS_SESSION_PATH=/absolute-path-to/.openzeppelin/.session |
| 16 | +``` |
| 17 | + |
| 18 | +You may also set the config by invoking the `setConfig(config)` static method. |
| 19 | + |
| 20 | +## Deploy |
| 21 | + |
| 22 | +The first thing required for deployment of the proxy accounts is the deployment and setup of ENS on the appropriate network. To do this, run the deploy script in 'monorepo/packages/backend/src/deploy/deploy.ts'. Once this has been completed, the ENS Manager addresses can be used in the initialization of the AuthereumAccount. |
| 23 | + |
| 24 | + |
| 25 | +```bash |
| 26 | +# Deploy the logic contract. Should only be called once. |
| 27 | +npx zos push --network development |
| 28 | + |
| 29 | +# Deploy a user's account |
| 30 | +npx zos create2 AuthereumAccount --salt 0x1112 --from 0x0000000000000000000000000000000000000000 --network kovan --init initialize --args 0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,ensname |
| 31 | +``` |
| 32 | + |
| 33 | +### Addresses |
| 34 | + |
| 35 | +#### Kovan |
| 36 | +* ensRegistry = 0x455C52FE20DC395E850b3ED9b82c9d1A05BFc471 |
| 37 | +* authereumEnsResolver = 0x9604DD189B2d293d7f7fb540E273ac4daA0a48F7 |
| 38 | +* ensReverseRegistrar = 0x082D5E17d8773287115741d73bD3cE8232D83467 |
| 39 | +* authereumEnsManager = 0x8016194885195C4eD3ff553D52F7234654FF098C |
| 40 | +* proxyContract = 0x6b4d70B5106fdAF95C5Bd00D8f72443AbDee6358 |
| 41 | + |
| 42 | +#### Rinkeby |
| 43 | +* ensRegistry = 0xc071320F5087668971736DfE9E915C95D934cd6F |
| 44 | +* authereumEnsResolver = 0xba52cA1B6f8Dbf80107dE59c82950b2f792a14C5 |
| 45 | +* ensReverseRegistrar = 0xB04f99FeD779CA143090CcDA228A77659Fd1F8C9 |
| 46 | +* authereumEnsManager = 0xcC7d7F62826D5080af12B9cc9865240Efbd130A4 |
| 47 | +* proxyContract = 0xD220e1681368cdd4Bff39F5E9Be02A3B0eE0E19D |
| 48 | + |
| 49 | +#### Ropsten |
| 50 | +* ensRegistry = 0x9604DD189B2d293d7f7fb540E273ac4daA0a48F7 |
| 51 | +* authereumEnsResolver = 0x8016194885195C4eD3ff553D52F7234654FF098C |
| 52 | +* ensReverseRegistrar = 0xeb5acb4d359aA939e2DC4BB68b4B9532DED4860D |
| 53 | +* authereumEnsManager = 0x203D879E8ADAcDe8225F75f8D8DC2Cd33528A6fa |
| 54 | +* proxyContract = 0x3468A9D9dE4ED9Ed6f47b59e7185De14fD34b0d6 |
| 55 | + |
| 56 | +#### Goerli |
| 57 | +* ensRegistry = 0x9604DD189B2d293d7f7fb540E273ac4daA0a48F7 |
| 58 | +* authereumEnsResolver = 0x8016194885195C4eD3ff553D52F7234654FF098C |
| 59 | +* ensReverseRegistrar = 0xeb5acb4d359aA939e2DC4BB68b4B9532DED4860D |
| 60 | +* authereumEnsManager = 0x203D879E8ADAcDe8225F75f8D8DC2Cd33528A6fa |
| 61 | +* proxyContract = 0x3468A9D9dE4ED9Ed6f47b59e7185De14fD34b0d6 |
| 62 | + |
| 63 | +## Test |
| 64 | +```bash |
| 65 | +ganache-cli --port 8545 --deterministic --accounts 11 |
| 66 | +``` |
| 67 | + |
| 68 | +```bash |
| 69 | +make tests |
| 70 | +``` |
| 71 | + |
| 72 | + |
| 73 | +## Upgrading |
| 74 | +Set up upgrade environment: |
| 75 | +```bash |
| 76 | +npm install |
| 77 | +npx zos init authereumContracts |
| 78 | +npx zos add AuthereumAccount |
| 79 | +``` |
| 80 | +_Note: If the process hangs at `Updated zos.json`, simply end the process. The action has already been completed._ |
| 81 | + |
| 82 | +Update a contract: |
| 83 | +```bash |
| 84 | +make zos-update |
| 85 | +``` |
| 86 | +_When asked "Do you want to run a function after updating the instance", type "N"_ |
| 87 | + |
| 88 | +# FAQ |
| 89 | + |
| 90 | +* Why am I getting the following when I update my zos project (or run a test)? |
| 91 | + ```bash |
| 92 | + connection not open on send() |
| 93 | + connection not open |
| 94 | + ``` |
| 95 | + * Try running ganache-cli on a different port (either `8545` or `9545`) |
| 96 | + |
| 97 | +* Why is my test failing on a simple test? It seemingly reverts even when it shouldn't. |
| 98 | +
|
| 99 | + * It is because you are running out of gas. There is an issue with zos (<2.4.0) and ganache (>= 6.4.0) where gas estimation does not work. You must manually set the gasLimit in the transaction, for now. See [herre](https://github.com/zeppelinos/zos/commit/4c2900ac3af6fd0a911c4bfeadd40631846102d7#diff-9594d32e7d1539a3d64960ff2cef07a1R220) for the proposed fix in 2.4.0rc2. |
| 100 | +
|
| 101 | +* Why are my tests not running with `Returned values aren't valid, did it run Out of Gas?` |
| 102 | +
|
| 103 | + * You are trying to deploy on a different network. Try changing the `.env` file to reflect the network you are trying to depoy on. |
| 104 | +
|
| 105 | + * Delete the `build` folder and run `truffle complie && truffle migrate --reset` |
| 106 | +
|
| 107 | +* Why am I getting the following error when running tests? |
| 108 | +``` |
| 109 | +Error: EnsRegistry error: contract binary not set. Can't deploy new instance. |
| 110 | +This contract may be abstract, not implement an abstract parent's methods completely |
| 111 | +or not invoke an inherited contract's constructor correctly |
| 112 | +``` |
| 113 | + * Delete the `build` folder and run `truffle complie && truffle migrate --reset` |
| 114 | +
|
| 115 | +# License |
| 116 | +
|
| 117 | +[MIT](LICENSE) |
0 commit comments