Skip to content

Commit d7e98f2

Browse files
committed
Open source contracts
0 parents  commit d7e98f2

File tree

95 files changed

+178758
-0
lines changed

Some content is hidden

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

95 files changed

+178758
-0
lines changed

.editorconfig

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
indent_size = 2
8+
indent_style = space
9+
insert_final_newline = true
10+
max_line_length = 80
11+
trim_trailing_whitespace = true
12+
13+
[*.md]
14+
max_line_length = 0
15+
trim_trailing_whitespace = false
16+
17+
[COMMIT_EDITMSG]
18+
max_line_length = 0

.eslintrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "standard-with-typescript",
3+
"parser": "@typescript-eslint/parser",
4+
"parserOptions": {
5+
"project": "./tsconfig.json"
6+
},
7+
}

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.gitignore

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
build
2+
build/contracts
3+
.idea/
4+
node_modules
5+
contracts/token/projects/
6+
test/token/projects/
7+
truffle-config.js
8+
9+
zos.dev*
10+
11+
.env
12+
13+
*~
14+
*.swp
15+
*.swo
16+
.zos.session
17+
*.log

.npmignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# ignore the .ts files
2+
*.ts
3+
4+
# include the .d.ts files
5+
!*.d.ts

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

.openzeppelin/.session

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"network": "kovan",
3+
"expires": "2019-08-14T00:45:53.033Z"
4+
}

@types/readline/index.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
declare module 'readline';

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT license
2+
3+
Copyright (C) 2019 Authereum
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9+
of the Software, and to permit persons to whom the Software is furnished to do
10+
so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.PHONY: test
2+
test:
3+
truffle test
4+
5+
zos-update:
6+
npx zos update -n development AuthereumAccount
7+
8+
zos-update/kovan:
9+
npx zos update -n kovan AuthereumAccount
10+
11+
push/kovan:
12+
npx zos push -n kovan
13+
14+
lint:
15+
standard --fix test/*.js
16+
17+
deploy:
18+
node scripts/deploy.js $(NETWORK)
19+
20+
copy:
21+
mkdir -p dist/contracts
22+
cp -r build/contracts/* dist/contracts
23+
(cd ../abi && $(MAKE) copy)

README.md

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
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)

brownie-config.json

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"network_defaults":{
3+
"name": "development",
4+
"gas_limit": false,
5+
"gas_price": false
6+
},
7+
"networks": {
8+
"development": {
9+
"test-rpc": "ganache-cli",
10+
"host": "http://127.0.0.1:8545",
11+
"broadcast_reverting_tx": true
12+
},
13+
"ropsten": {
14+
"host": "https://ropsten.infura.io/",
15+
"broadcast_reverting_tx": false
16+
}
17+
},
18+
"test":{
19+
"gas_limit": 6721975,
20+
"default_contract_owner": false,
21+
"broadcast_reverting_tx": true
22+
},
23+
"solc":{
24+
"optimize": true,
25+
"runs": 200,
26+
"version": "0.5.7"
27+
},
28+
"logging": {
29+
"test": {
30+
"tx": 0,
31+
"exc": [1, 2]
32+
33+
},
34+
"run": {
35+
"tx": [1, 2],
36+
"exc": 2
37+
},
38+
"console": {
39+
"tx": 1,
40+
"exc": 2
41+
},
42+
"coverage": {
43+
"tx": 0,
44+
"exc": [1, 2]
45+
}
46+
},
47+
"colors":{
48+
"key": "",
49+
"value": "bright blue",
50+
"callable": "bright cyan",
51+
"module": "bright blue",
52+
"contract": "bright magenta",
53+
"contract_method": "bright magenta",
54+
"string": "bright magenta",
55+
"dull": "dark white",
56+
"error": "bright red",
57+
"success": "bright green",
58+
"pending": "bright yellow"
59+
}
60+
}

config/contracts.goerli.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"logicAddress": "0xD220e1681368cdd4Bff39F5E9Be02A3B0eE0E19D",
3+
"accountProxyAddress": "0xAf73aeCC08e0D1e892615110BD7a5a1633CA4dB5",
4+
"ensRegistryAddress": "0x9604DD189B2d293d7f7fb540E273ac4daA0a48F7",
5+
"accountFactoryAddress": "0x3468A9D9dE4ED9Ed6f47b59e7185De14fD34b0d6",
6+
"ensManagerAddress": "0x203D879E8ADAcDe8225F75f8D8DC2Cd33528A6fa"
7+
}

config/contracts.kovan.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"logicAddress": "0x12309A2DeEd6F17fECFDD816A2F5D32dF577E4bB",
3+
"accountProxyAddress": "0xC93636E2b3Ecf7788E95c890cFB7FA81695931ca",
4+
"ensRegistryAddress": "0x4e6c84acb424a42fd0580fce0bababfbc360dee6",
5+
"accountFactoryAddress": "0x34fd4D8Fe1Ba7eAf06db2EF4f9c87116431800b2",
6+
"ensManagerAddress": "0xe21dcffcb15ed34d3c80d33e78845791023035e2"
7+
}

config/contracts.mainnet.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"logicAddress": "0x8cfC7923107bC11a3beD9ca82a80Da41d6393502",
3+
"accountProxyAddress": "0x5788138283e555b17028E76C408D7d44C6b60F3F",
4+
"ensRegistryAddress": "0x314159265dD8dbb310642f98f50C066173C1259b",
5+
"accountFactoryAddress": "0xfc8cC2eeC495D64a679E79a49713B7290eD5Fc04",
6+
"ensManagerAddress": "0x8016194885195C4eD3ff553D52F7234654FF098C"
7+
}

config/contracts.rinkeby.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"logicAddress": "0xC44cCbF4FD5dCF8A440a9853B711c9E45036c678",
3+
"accountProxyAddress": "0x2AF37B62593FE0dF8958FC602B7c69b5DF0D1418",
4+
"ensRegistryAddress": "0xc071320F5087668971736DfE9E915C95D934cd6F",
5+
"accountFactoryAddress": "0xCE0C99cCffd04C54F289f8196ce7CCeB22102498",
6+
"ensManagerAddress": "0xcC7d7F62826D5080af12B9cc9865240Efbd130A4"
7+
}

config/contracts.ropsten.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"logicAddress": "0xD220e1681368cdd4Bff39F5E9Be02A3B0eE0E19D",
3+
"accountProxyAddress": "0xAf73aeCC08e0D1e892615110BD7a5a1633CA4dB5",
4+
"ensRegistryAddress": "0x9604DD189B2d293d7f7fb540E273ac4daA0a48F7",
5+
"accountFactoryAddress": "0x3468A9D9dE4ED9Ed6f47b59e7185De14fD34b0d6",
6+
"ensManagerAddress": "0x203D879E8ADAcDe8225F75f8D8DC2Cd33528A6fa"
7+
}

contracts/Migrations.sol

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
pragma solidity ^0.5.2;
2+
3+
contract Migrations {
4+
address public owner;
5+
uint public last_completed_migration;
6+
7+
constructor() public {
8+
owner = msg.sender;
9+
}
10+
11+
modifier restricted() {
12+
if (msg.sender == owner) _;
13+
}
14+
15+
function setCompleted(uint completed) public restricted {
16+
last_completed_migration = completed;
17+
}
18+
19+
function upgrade(address new_address) public restricted {
20+
Migrations upgraded = Migrations(new_address);
21+
upgraded.setCompleted(last_completed_migration);
22+
}
23+
}

0 commit comments

Comments
 (0)