Skip to content

Commit

Permalink
Deploy new version to kovan, rinkeby and mainnet
Browse files Browse the repository at this point in the history
  • Loading branch information
rmeissner committed Nov 24, 2018
1 parent 7e2eeb3 commit bbde1b0
Show file tree
Hide file tree
Showing 14 changed files with 627 additions and 75 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ export MNEMONIC="<mnemonic>"
```

zOS:
- Make sure that all dependencies use solcjs >0.5.0
- Add `txParams['from'] = txParams['from'] || web3.currentProvider.getAddress(0)` in `Transactions.js` of the `zos-lib` module
```bash
zos push --network=<network>
truffle --network=<network> exec scripts/init_contracts.js
virtualenv env -p python3
. env/bin/activate
python ./scripts/deploy_safe.py
```

Truffle:
Expand All @@ -36,7 +39,7 @@ truffle deploy
```

Verify Contracts:

- requires installed solc (>0.5.0)
```bash
virtualenv env -p python3
. env/bin/activate
Expand Down
2 changes: 1 addition & 1 deletion contracts/GnosisSafe.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ contract GnosisSafe is MasterCopy, BaseSafe, SignatureDecoder, SecuredTokenTrans
using SafeMath for uint256;

string public constant NAME = "Gnosis Safe";
string public constant VERSION = "0.0.2";
string public constant VERSION = "0.1.0";

//keccak256(
// "EIP712Domain(address verifyingContract)"
Expand Down
2 changes: 1 addition & 1 deletion contracts/modules/DailyLimitModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import "../common/Enum.sol";
contract DailyLimitModule is Module {

string public constant NAME = "Daily Limit Module";
string public constant VERSION = "0.0.2";
string public constant VERSION = "0.1.0";

// dailyLimits mapping maps token address to daily limit settings.
mapping (address => DailyLimit) public dailyLimits;
Expand Down
2 changes: 1 addition & 1 deletion contracts/modules/SocialRecoveryModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import "../common/Enum.sol";
contract SocialRecoveryModule is Module {

string public constant NAME = "Social Recovery Module";
string public constant VERSION = "0.0.2";
string public constant VERSION = "0.1.0";

uint256 public threshold;
address[] public friends;
Expand Down
2 changes: 1 addition & 1 deletion contracts/modules/StateChannelModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import "../common/SignatureDecoder.sol";
contract StateChannelModule is Module, SignatureDecoder {

string public constant NAME = "State Channel Module";
string public constant VERSION = "0.0.2";
string public constant VERSION = "0.1.0";

// isExecuted mapping allows to check if a transaction (by hash) was already executed.
mapping (bytes32 => uint256) public isExecuted;
Expand Down
2 changes: 1 addition & 1 deletion contracts/modules/WhitelistModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import "../common/Enum.sol";
contract WhitelistModule is Module {

string public constant NAME = "Whitelist Module";
string public constant VERSION = "0.0.2";
string public constant VERSION = "0.1.0";

// isWhitelisted mapping maps destination address to boolean.
mapping (address => bool) public isWhitelisted;
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"name": "gnosis-safe",
"version": "0.0.2",
"version": "0.1.0",
"description": "Ethereum multisig contract",
"license": "GPL-3.0",
"main": "index.js",
"files": [
"contracts",
"test"
"test",
"zos.json",
"zos.*.json"
],
"scripts": {
"test-norpc": "truffle test",
Expand Down
61 changes: 61 additions & 0 deletions scripts/deploy_safe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import os
import sys
import json
from subprocess import run

network = os.environ.get('NETWORK')
if not network:
sys.exit("NETWORK not set in env")

print("Deploy Safe to", network)

with open('package.json') as f:
package = json.load(f)

if os.path.exists("zos.json"):
os.remove("zos.json")

run(["npx", "zos", "init", package.get("name"), package.get("version")])

run(["npx", "truffle", "compile"])

# Add and deploy GnosisSafe
run(["npx", "zos", "add", "GnosisSafe", "--skip-compile"])
run(["npx", "zos", "push", "--network=" + network, "--skip-compile"])

# Add and deploy ProxyFactory
run(["npx", "zos", "add", "ProxyFactory", "--skip-compile"])
run(["npx", "zos", "push", "--network=" + network, "--skip-compile"])

# Add and deploy CreateAndAddModules
run(["npx", "zos", "add", "CreateAndAddModules", "--skip-compile"])
run(["npx", "zos", "push", "--network=" + network, "--skip-compile"])

# Add and deploy MultiSend
run(["npx", "zos", "add", "MultiSend", "--skip-compile"])
run(["npx", "zos", "push", "--network=" + network, "--skip-compile"])

# Init contracts
run(["npx", "truffle", "--network=" + network, "exec", "scripts/init_contracts.js"])

# Publish zos package
run(["npx", "zos", "publish", "--network=" + network])

'''
Modules are disabled for now
'''
# Add and deploy DailyLimitModule
# run(["npx", "zos", "add", "DailyLimitModule", "--skip-compile"])
# run(["npx", "zos", "push", "--network=" + network, "--skip-compile"])

# Add and deploy SocialRecoveryModule
# run(["npx", "zos", "add", "SocialRecoveryModule", "--skip-compile"])
# run(["npx", "zos", "push", "--network=" + network, "--skip-compile"])

# Add and deploy StateChannelModule
# run(["npx", "zos", "add", "StateChannelModule", "--skip-compile"])
# run(["npx", "zos", "push", "--network=" + network, "--skip-compile"])

# Add and deploy WhitelistModule
# run(["npx", "zos", "add", "WhitelistModule", "--skip-compile"])
# run(["npx", "zos", "push", "--network=" + network, "--skip-compile"])
10 changes: 5 additions & 5 deletions scripts/init_contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const notOwnedAddress2 = "0x0000000000000000000000000000000000000003"

const ignoreErrors = function(promise) {
return promise.catch(function(error){
console.log("Failed:", error.tx)
console.log("Failed:", error.tx || error.message)
})
}

Expand All @@ -31,10 +31,10 @@ module.exports = function(callback) {
var zos = JSON.parse(fs.readFileSync('./zos.' + network + '.json'));
Promise.all([
ignoreErrors(GnosisSafe.at(zos.contracts['GnosisSafe'].address).setup([notOwnedAddress, notOwnedAddress2], 2, 0, 0)),
ignoreErrors(StateChannelModule.at(zos.contracts['StateChannelModule'].address).setup()),
ignoreErrors(DailyLimitModule.at(zos.contracts['DailyLimitModule'].address).setup([],[])),
ignoreErrors(SocialRecoveryModule.at(zos.contracts['SocialRecoveryModule'].address).setup([notOwnedAddress, notOwnedAddress2], 2)),
ignoreErrors(WhitelistModule.at(zos.contracts['WhitelistModule'].address).setup([])),
//ignoreErrors(StateChannelModule.at(zos.contracts['StateChannelModule'].address).setup()),
//ignoreErrors(DailyLimitModule.at(zos.contracts['DailyLimitModule'].address).setup([],[])),
//ignoreErrors(SocialRecoveryModule.at(zos.contracts['SocialRecoveryModule'].address).setup([notOwnedAddress, notOwnedAddress2], 2)),
//ignoreErrors(WhitelistModule.at(zos.contracts['WhitelistModule'].address).setup([])),
])
.then(function(values) {
values.forEach(function(resp) {
Expand Down
13 changes: 9 additions & 4 deletions truffle.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,26 @@ module.exports = {
return new HDWalletProvider(mnemonic, 'https://rinkeby.infura.io/' + token)
},
network_id: '4',
gas: 6700000,
gasPrice: 1000000000, // 1 Gwei
gasPrice: 25000000000, // 25 Gwei
},
kovan: {
provider: () => {
return new HDWalletProvider(mnemonic, 'https://kovan.infura.io/' + token)
},
network_id: '42',
gasPrice: 25000000000, // 25 Gwei
},
mainnet: {
provider: () => {
return new HDWalletProvider(mnemonic, 'https://mainnet.infura.io/' + token)
},
network_id: '1',
gas: 6700000,
gasPrice: 25000000000, // 25 Gwei
}
},
solc: {
optimizer: {
enabled: false
enabled: true
},
},
};
12 changes: 4 additions & 8 deletions zos.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
{
"zosversion": "2",
"name": "gnosis-safe",
"version": "0.0.2",
"lib": true,
"version": "0.1.0",
"contracts": {
"GnosisSafe": "GnosisSafe",
"ProxyFactory": "ProxyFactory",
"CreateAndAddModules": "CreateAndAddModules",
"MultiSend": "MultiSend",
"DailyLimitModule": "DailyLimitModule",
"SocialRecoveryModule": "SocialRecoveryModule",
"StateChannelModule": "StateChannelModule",
"WhitelistModule": "WhitelistModule",
"ProxyFactory": "ProxyFactory"
"MultiSend": "MultiSend"
}
}
Loading

0 comments on commit bbde1b0

Please sign in to comment.