erak / safe-contracts

Gnosis Safe allows secure management of blockchain assets.

Home Page:https://safe.gnosis.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gnosis Safe Contracts

npm version Build Status

Install

Install requirements with npm:

npm install

Run all tests (requires Node version >=7 for async/await):

npx truffle compile
npx truffle test

Deploy

Some contracts require that the Solidity compile target is petersburg (e.g. ProxyFactory and MultiSend). This is default since Solidity 0.5.5.

Note: The formal verification was performed using the contract compiled with solcjs 0.5.0.

Preparation:

export MNEMONIC="<mnemonic>"

zOS:

  • Make sure that zos is version 2
  • 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
virtualenv env -p python3
. env/bin/activate
python ./scripts/deploy_safe_contracts_zos.py

Truffle:

npx truffle deploy

Verify Contracts:

  • requires installed solc (>0.5.0)
virtualenv env -p python3
. env/bin/activate
pip install solidity-flattener
mkdir build/flattened_contracts
solidity_flattener contracts/GnosisSafe.sol --output build/flattened_contracts/GnosisSafe.sol
solidity_flattener contracts/libraries/CreateAndAddModules.sol --output build/flattened_contracts/CreateAndAddModules.sol --solc-paths="/=/"
solidity_flattener contracts/libraries/MultiSend.sol --output build/flattened_contracts/MultiSend.sol --solc-paths="/=/"
solidity_flattener contracts/modules/DailyLimitModule.sol --output build/flattened_contracts/DailyLimitModule.sol --solc-paths="/=/"
solidity_flattener contracts/modules/SocialRecoveryModule.sol --output build/flattened_contracts/SocialRecoveryModule.sol --solc-paths="/=/"
solidity_flattener contracts/modules/StateChannelModule.sol --output build/flattened_contracts/StateChannelModule.sol --solc-paths="/=/"
solidity_flattener contracts/modules/WhitelistModule.sol --output build/flattened_contracts/WhitelistModule.sol --solc-paths="/=/"
solidity_flattener contracts/proxies/ProxyFactory.sol --output build/flattened_contracts/ProxyFactory.sol
find build/flattened_contracts -name '*.sol' -exec sed -i '' 's/pragma solidity ^0.4.13;/pragma solidity ^0.5.0;/g' {} \;

Using with ZeppelinOS

You can create a gnosis safe upgradeable instance using ZeppelinOS by linking to the provided EVM package. This will use the master copy already deployed to mainnet, kovan, or rinkeby, reducing gas deployment costs.

To create an instance using ZeppelinOS:

$ npm install -g zos
$ zos init YourProject
$ zos link gnosis-safe
$ zos push --network rinkeby
> Connecting to dependency gnosis-safe 0.1.0
$ zos create gnosis-safe/GnosisSafe --init setup --args "[$ADDRESS1,$ADDRESS2,$ADDRESS3],2,0x0000000000000000000000000000000000000000,\"\"" --network rinkeby --from $SENDER
> Instance created at SAFE_ADDRESS

It is suggested to use a non-default address as $SENDER.

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.

Documentation

Audits/ Formal Verification

Security and Liability

All contracts are WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

License

All smart contracts are released under LGPL v.3.

Contributors

About

Gnosis Safe allows secure management of blockchain assets.

https://safe.gnosis.io

License:GNU Lesser General Public License v3.0


Languages

Language:JavaScript 65.7%Language:Solidity 33.4%Language:Python 0.9%