Skip to content

Commit b64b247

Browse files
authored
Merge pull request #218 from gnosis/prepare_deployment
Deployment of 1.2.0
2 parents b703086 + d0bd11d commit b64b247

24 files changed

+2301
-1786
lines changed

.env.sample

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
MNEMONIC=""
2-
INFURA_TOKEN=""
3-
NETWORK="rinkeby"
2+
INFURA_TOKEN=""

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ node_modules/
55
.openzeppelin/.session
66
env/
77
.env
8+
bin/
9+
solc

README.md

Lines changed: 9 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -32,73 +32,33 @@ Preparation:
3232
- Set `NETWORK` in `.env`
3333
- Run `yarn truffle compile`
3434

35-
OpenZeppelin SDK:
36-
- Make sure that @openzeppelin/cli is version 2.5 (`yarn oz --version`)
37-
- Make sure that all dependencies use solcjs >0.5.0
38-
- Set correct version in `package.json`
39-
- Set `MNEMONIC` in `.env` to current oz package owner (last deployer normally)
40-
- Optional: if a new deployer account is used
41-
- Check that a gloabl versionb of truffle 5 is installed (`truffle version`)
42-
- Run `truffle exec scripts/change_oz_owner.js --network=<network> --newOwner="<address>"` to enable new deployer
43-
- Set `MNEMONIC` in `.env` to new oz package owner
44-
- Run `yarn deploy-oz`
45-
- Once deployed on all networks run `yarn oz --freeze <network>` for each network
46-
4735
Truffle:
4836
- Set `MNEMONIC` in `.env`
4937

5038
```bash
5139
yarn truffle deploy
5240
```
5341

54-
Verify Contracts:
55-
- requires installed solc (>0.5.0)
56-
```bash
57-
virtualenv env -p python3
58-
. env/bin/activate
59-
pip install solidity-flattener
60-
mkdir build/flattened_contracts
61-
solidity_flattener contracts/GnosisSafe.sol --output build/flattened_contracts/GnosisSafe.sol
62-
solidity_flattener contracts/libraries/CreateAndAddModules.sol --output build/flattened_contracts/CreateAndAddModules.sol --solc-paths="/=/"
63-
solidity_flattener contracts/libraries/CreateCall.sol --output build/flattened_contracts/CreateCall.sol --solc-paths="/=/"
64-
solidity_flattener contracts/libraries/MultiSend.sol --output build/flattened_contracts/MultiSend.sol --solc-paths="/=/"
65-
solidity_flattener contracts/handler/DefaultCallbackHandler.sol --output build/flattened_contracts/DefaultCallbackHandler.sol --solc-paths="/=/"
66-
solidity_flattener contracts/modules/DailyLimitModule.sol --output build/flattened_contracts/DailyLimitModule.sol --solc-paths="/=/"
67-
solidity_flattener contracts/modules/SocialRecoveryModule.sol --output build/flattened_contracts/SocialRecoveryModule.sol --solc-paths="/=/"
68-
solidity_flattener contracts/modules/StateChannelModule.sol --output build/flattened_contracts/StateChannelModule.sol --solc-paths="/=/"
69-
solidity_flattener contracts/modules/WhitelistModule.sol --output build/flattened_contracts/WhitelistModule.sol --solc-paths="/=/"
70-
solidity_flattener contracts/proxies/GnosisSafeProxyFactory.sol --output build/flattened_contracts/GnosisSafeProxyFactory.sol
71-
find build/flattened_contracts -name '*.sol' -exec sed -i '' 's/pragma solidity ^0.4.13;/pragma solidity >=0.5.0 <0.7.0;/g' {} \;
72-
```
73-
74-
Using with OpenZeppelin SDK
75-
---------------------------
42+
### Verify contract
7643

77-
You can create a gnosis safe upgradeable instance using [OpenZeppelin SDK](https://docs.openzeppelin.com/sdk/2.5) by linking to the provided [EVM package](https://docs.openzeppelin.com/sdk/2.5/linking). This will use the master copy already deployed to mainnet, kovan, or rinkeby, reducing gas deployment costs.
44+
Note: To completely replicate the bytecode that has been deployed it is required that the project path is `/gnosis-safe` this can be archived using `sudo mkdir /gnosis-safe && sudo mount -B <your_repo_path> /gnosis-safe`. Make sure the run `yarn` again if the path has been changed after the inital `yarn install`. If you use a different path you will only get partial matches.
7845

79-
To create an instance using OpenZeppelin SDK:
46+
You can locally verify contract using the scripts `generate_meta.js` and `verify_deployment.js`.
8047

81-
```bash
82-
$ yarn global add -g @openzeppelin/sdk
83-
$ oz init YourProject
84-
$ oz link @gnosis.pm/safe-contracts
85-
$ oz push --network rinkeby
86-
> Connecting to dependency @gnosis.pm/safe-contracts 1.0.0
87-
$ oz create @gnosis.pm//GnosisSafe --init setup --args "[$ADDRESS1,$ADDRESS2,$ADDRESS3],2,0x0000000000000000000000000000000000000000,\"\"" --network rinkeby --from $SENDER
88-
> Instance created at SAFE_ADDRESS
89-
```
48+
With `node scripts/generate_meta.js` a `meta` folder is created in the `build` folder that contains all files required to verify the source code on https://verification.komputing.org/ and https://etherscan.io/
9049

91-
It is suggested to [use a non-default address](https://docs.zeppelinos.org/docs/pattern.html#transparent-proxies-and-function-clashes) as `$SENDER`.
50+
For Etherscan only the `GnosisSafeEtherscan.json` file is required. For sourcify the `GnosisSafeMeta.json` and all the `.sol` files are required.
9251

93-
> Note: When using the contracts via ZeppelinOS make sure to choose an appropriate Proxy admin. An upgradable proxy enables the user to update the master copy (aka implementation). The default upgradable proxy is managed by an admin address. This admin address is independent from the owners of the Safe. Therefore it would be possible for the admin to change the master copy without the approval of any owner, thus allowing him to gain full access to the Safe.
52+
Once the meta data has been generated you can verify that your local compiled code corresponds to the version deployed by Gnosis with `yarn do <network> scripts/verify_deployment.js`.
9453

9554
Documentation
9655
-------------
97-
- [ReadTheDocs](http://gnosis-safe.readthedocs.io/en/latest/)
98-
- [Coding guidlines](docs/guidelines.md)
56+
- [Safe developer portal](http://docs.gnosis.io/safe)
57+
- [Coding guidelines](docs/guidelines.md)
9958

10059
Audits/ Formal Verification
10160
---------
61+
- [for Version 1.2.0 by G0 Group](docs/audit_1_2_0.md)
10262
- [for Version 1.1.1 by G0 Group](docs/audit_1_1_1.md)
10363
- [for Version 1.0.0 by Runtime Verification](docs/rv_1_0_0.md)
10464
- [for Version 0.0.1 by Alexey Akhunov](docs/alexey_audit.md)

contracts/GnosisSafe.sol

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ contract GnosisSafe
1818
using GnosisSafeMath for uint256;
1919

2020
string public constant NAME = "Gnosis Safe";
21-
string public constant VERSION = "1.1.1";
21+
string public constant VERSION = "1.2.0";
2222

2323
//keccak256(
2424
// "EIP712Domain(address verifyingContract)"
@@ -300,7 +300,8 @@ contract GnosisSafe
300300
}
301301

302302
/**
303-
* @dev Marks a message as signed
303+
* @dev Marks a message as signed, so that it can be used with EIP-1271
304+
* @notice Marks a message (`_data`) as signed.
304305
* @param _data Arbitrary length data that should be marked as signed on the behalf of address(this)
305306
*/
306307
function signMessage(bytes calldata _data)

contracts/base/ModuleManager.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ contract ModuleManager is SelfAuthorized, Executor {
3131

3232
/// @dev Allows to add a module to the whitelist.
3333
/// This can only be done via a Safe transaction.
34+
/// @notice Enables the module `module` for the Safe.
3435
/// @param module Module to be whitelisted.
3536
function enableModule(Module module)
3637
public
@@ -47,6 +48,7 @@ contract ModuleManager is SelfAuthorized, Executor {
4748

4849
/// @dev Allows to remove a module from the whitelist.
4950
/// This can only be done via a Safe transaction.
51+
/// @notice Disables the module `module` for the Safe.
5052
/// @param prevModule Module that pointed to the module to be removed in the linked list
5153
/// @param module Module to be removed.
5254
function disableModule(Module prevModule, Module module)

contracts/base/OwnerManager.sol

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ contract OwnerManager is SelfAuthorized {
4747

4848
/// @dev Allows to add a new owner to the Safe and update the threshold at the same time.
4949
/// This can only be done via a Safe transaction.
50+
/// @notice Adds the owner `owner` to the Safe and updates the threshold to `_threshold`.
5051
/// @param owner New owner address.
5152
/// @param _threshold New threshold.
5253
function addOwnerWithThreshold(address owner, uint256 _threshold)
@@ -68,6 +69,7 @@ contract OwnerManager is SelfAuthorized {
6869

6970
/// @dev Allows to remove an owner from the Safe and update the threshold at the same time.
7071
/// This can only be done via a Safe transaction.
72+
/// @notice Removes the owner `owner` from the Safe and updates the threshold to `_threshold`.
7173
/// @param prevOwner Owner that pointed to the owner to be removed in the linked list
7274
/// @param owner Owner address to be removed.
7375
/// @param _threshold New threshold.
@@ -91,6 +93,7 @@ contract OwnerManager is SelfAuthorized {
9193

9294
/// @dev Allows to swap/replace an owner from the Safe with another address.
9395
/// This can only be done via a Safe transaction.
96+
/// @notice Replaces the owner `oldOwner` in the Safe with `newOwner`.
9497
/// @param prevOwner Owner that pointed to the owner to be replaced in the linked list
9598
/// @param oldOwner Owner address to be replaced.
9699
/// @param newOwner New owner address.
@@ -114,6 +117,7 @@ contract OwnerManager is SelfAuthorized {
114117

115118
/// @dev Allows to update the number of required confirmations by Safe owners.
116119
/// This can only be done via a Safe transaction.
120+
/// @notice Changes the threshold of the Safe to `_threshold`.
117121
/// @param _threshold New threshold.
118122
function changeThreshold(uint256 _threshold)
119123
public
309 KB
Binary file not shown.

docs/audit_1_2_0.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
### Audit Results
2+
3+
##### Auditor
4+
* G0 Group (https://github.com/g0-group)
5+
* Adam Kolář (@adamkolar)
6+
* Nick Munoz-McDonald (@NickErrant)
7+
8+
##### Notes
9+
The audit was performed on commit [62d4bd39925db65083b035115d6987772b2d2dca](https://github.com/gnosis/safe-contracts/commit/62d4bd39925db65083b035115d6987772b2d2dca)
10+
11+
##### Files
12+
* [Audit Report 1.2.0](Gnosis_Safe_Audit_Report_1_2_0.pdf)

migrations/2_deploy_safe.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
var GnosisSafe = artifacts.require("./GnosisSafe.sol");
2+
3+
module.exports = function(deployer) {
4+
deployer.deploy(GnosisSafe).then(function (safe) {
5+
return safe
6+
});
7+
};

0 commit comments

Comments
 (0)