Merge pull request #24 from gnosis/feature/WA-238-use-proxy-contract-and-daily-limit-extension
WA-238 - Use proxy contract and daily limit extension
This commit is contained in:
commit
8be067900b
|
@ -17,7 +17,7 @@ module.file_ext=.css
|
|||
module.file_ext=.scss
|
||||
|
||||
module.name_mapper='^~' ->'<PROJECT_ROOT>/src'
|
||||
module.name_mapper='^#' ->'<PROJECT_ROOT>/gnosis-safe-contracts/build/contracts'
|
||||
module.name_mapper='^#' ->'<PROJECT_ROOT>/safe-contracts/build/contracts'
|
||||
module.name_mapper='.*\(.s?css\)' -> '{}'
|
||||
|
||||
[strict]
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
node_modules/
|
||||
build/
|
||||
build_webpack/
|
||||
build_storybook/
|
||||
build/contracts/
|
||||
truffle-config.js
|
||||
gnosis-safe-contracts/
|
||||
.DS_Store
|
|
@ -4,11 +4,7 @@ node_js:
|
|||
os:
|
||||
- linux
|
||||
before_script:
|
||||
- yarn global add truffle@4.1.3
|
||||
- yarn global add surge
|
||||
- git clone https://github.com/gnosis/gnosis-safe-contracts.git
|
||||
- cd gnosis-safe-contracts
|
||||
- truffle compile && cd ..
|
||||
after_success:
|
||||
- yarn build-storybook
|
||||
- yarn build
|
||||
|
|
|
@ -38,7 +38,7 @@ module.exports = {
|
|||
appIndexJs: resolveApp('src/index.js'),
|
||||
appPackageJson: resolveApp('package.json'),
|
||||
appSrc: resolveApp('src'),
|
||||
appContracts: resolveApp('gnosis-safe-contracts/build/contracts'),
|
||||
appContracts: resolveApp('safe-contracts/build/contracts'),
|
||||
yarnLockFile: resolveApp('yarn.lock'),
|
||||
testsSetup: resolveApp('src/setupTests.js'),
|
||||
appNodeModules: resolveApp('node_modules'),
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"~/*":["src/*"],
|
||||
"@/*":["gnosis-safe-contracts/build/contracts"]
|
||||
"@/*":["safe-contracts/build/contracts"]
|
||||
}
|
||||
},
|
||||
"exclude": [
|
||||
|
|
|
@ -87,6 +87,7 @@
|
|||
"storybook-host": "^4.1.5",
|
||||
"storybook-router": "^0.3.3",
|
||||
"style-loader": "^0.20.2",
|
||||
"truffle": "4.1.5",
|
||||
"truffle-contract": "^1.1.8",
|
||||
"truffle-solidity-loader": "0.0.8",
|
||||
"uglifyjs-webpack-plugin": "^1.2.2",
|
||||
|
@ -135,7 +136,7 @@
|
|||
],
|
||||
"moduleNameMapper": {
|
||||
"~(.*)$": "<rootDir>/src/$1",
|
||||
"#(.*)$": "<rootDir>/gnosis-safe-contracts/build/contracts/$1",
|
||||
"#(.*)$": "<rootDir>/safe-contracts/build/contracts/$1",
|
||||
"^react-native$": "react-native-web"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ What things you need to install the software and how to install them
|
|||
npm install truffle // recommended usage of -g flag
|
||||
npm install ganache-cli // recommended usage of -g flag
|
||||
npm install flow-type // recommended usage of -g flag
|
||||
git clone https://github.com/gnosis/gnosis-safe-contracts.git
|
||||
git clone https://github.com/gnosis/safe-contracts.git
|
||||
```
|
||||
|
||||
### Installing
|
||||
|
@ -28,7 +28,7 @@ ganache-cli -b 3
|
|||
|
||||
Start the project in the other one
|
||||
```
|
||||
cd gnosis-safe-contracts && truffle compile && truffle migrate && cd ..
|
||||
cd safe-contracts && truffle compile && truffle migrate && cd ..
|
||||
npm install
|
||||
npm start
|
||||
```
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,531 @@
|
|||
{
|
||||
"contractName": "Extension",
|
||||
"abi": [
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "sender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"name": "data",
|
||||
"type": "bytes"
|
||||
},
|
||||
{
|
||||
"name": "operation",
|
||||
"type": "uint8"
|
||||
}
|
||||
],
|
||||
"name": "isExecutable",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"bytecode": "0x",
|
||||
"deployedBytecode": "0x",
|
||||
"sourceMap": "",
|
||||
"deployedSourceMap": "",
|
||||
"source": "pragma solidity 0.4.19;\nimport \"./GnosisSafe.sol\";\n\n\n/// @title Abstract Extension - Functions to be implemented by extensions.\n/// @author Stefan George - <stefan@gnosis.pm>\ncontract Extension {\n\n /// @dev Function to be implmeneted by extension. Returns if Safe transaction is valid and can be executed.\n /// @param sender Safe transaction sender address. This is not necessarily a Safe owner and needs to be \n /// verified in case only Safe owners are allowed.\n /// @param to Destination address.\n /// @param value Ether value.\n /// @param data Data payload.\n /// @param operation Operation type.\n /// @return Returns if transaction can be executed.\n function isExecutable(address sender, address to, uint256 value, bytes data, GnosisSafe.Operation operation) public returns (bool);\n}\n",
|
||||
"sourcePath": "/Users/apanizo/git/gnosis/safe-contracts/contracts/Extension.sol",
|
||||
"ast": {
|
||||
"absolutePath": "/Users/apanizo/git/gnosis/safe-contracts/contracts/Extension.sol",
|
||||
"exportedSymbols": {
|
||||
"Extension": [
|
||||
18
|
||||
]
|
||||
},
|
||||
"id": 19,
|
||||
"nodeType": "SourceUnit",
|
||||
"nodes": [
|
||||
{
|
||||
"id": 1,
|
||||
"literals": [
|
||||
"solidity",
|
||||
"0.4",
|
||||
".19"
|
||||
],
|
||||
"nodeType": "PragmaDirective",
|
||||
"src": "0:23:0"
|
||||
},
|
||||
{
|
||||
"absolutePath": "/Users/apanizo/git/gnosis/safe-contracts/contracts/GnosisSafe.sol",
|
||||
"file": "./GnosisSafe.sol",
|
||||
"id": 2,
|
||||
"nodeType": "ImportDirective",
|
||||
"scope": 19,
|
||||
"sourceUnit": 964,
|
||||
"src": "24:26:0",
|
||||
"symbolAliases": [],
|
||||
"unitAlias": ""
|
||||
},
|
||||
{
|
||||
"baseContracts": [],
|
||||
"contractDependencies": [],
|
||||
"contractKind": "contract",
|
||||
"documentation": "@title Abstract Extension - Functions to be implemented by extensions.\n @author Stefan George - <stefan@gnosis.pm>",
|
||||
"fullyImplemented": false,
|
||||
"id": 18,
|
||||
"linearizedBaseContracts": [
|
||||
18
|
||||
],
|
||||
"name": "Extension",
|
||||
"nodeType": "ContractDefinition",
|
||||
"nodes": [
|
||||
{
|
||||
"body": null,
|
||||
"id": 17,
|
||||
"implemented": false,
|
||||
"isConstructor": false,
|
||||
"isDeclaredConst": false,
|
||||
"modifiers": [],
|
||||
"name": "isExecutable",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters": {
|
||||
"id": 13,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [
|
||||
{
|
||||
"constant": false,
|
||||
"id": 4,
|
||||
"name": "sender",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 17,
|
||||
"src": "710:14:0",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 3,
|
||||
"name": "address",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "710:7:0",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"id": 6,
|
||||
"name": "to",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 17,
|
||||
"src": "726:10:0",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 5,
|
||||
"name": "address",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "726:7:0",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"id": 8,
|
||||
"name": "value",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 17,
|
||||
"src": "738:13:0",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 7,
|
||||
"name": "uint256",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "738:7:0",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"id": 10,
|
||||
"name": "data",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 17,
|
||||
"src": "753:10:0",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_bytes_memory_ptr",
|
||||
"typeString": "bytes memory"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 9,
|
||||
"name": "bytes",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "753:5:0",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_bytes_storage_ptr",
|
||||
"typeString": "bytes storage pointer"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"id": 12,
|
||||
"name": "operation",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 17,
|
||||
"src": "765:30:0",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_enum$_Operation_$61",
|
||||
"typeString": "enum GnosisSafe.Operation"
|
||||
},
|
||||
"typeName": {
|
||||
"contractScope": null,
|
||||
"id": 11,
|
||||
"name": "GnosisSafe.Operation",
|
||||
"nodeType": "UserDefinedTypeName",
|
||||
"referencedDeclaration": 61,
|
||||
"src": "765:20:0",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_enum$_Operation_$61",
|
||||
"typeString": "enum GnosisSafe.Operation"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"src": "709:87:0"
|
||||
},
|
||||
"payable": false,
|
||||
"returnParameters": {
|
||||
"id": 16,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [
|
||||
{
|
||||
"constant": false,
|
||||
"id": 15,
|
||||
"name": "",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 17,
|
||||
"src": "813:4:0",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_bool",
|
||||
"typeString": "bool"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 14,
|
||||
"name": "bool",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "813:4:0",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_bool",
|
||||
"typeString": "bool"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"src": "812:6:0"
|
||||
},
|
||||
"scope": 18,
|
||||
"src": "688:131:0",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
"scope": 19,
|
||||
"src": "175:646:0"
|
||||
}
|
||||
],
|
||||
"src": "0:822:0"
|
||||
},
|
||||
"legacyAST": {
|
||||
"absolutePath": "/Users/apanizo/git/gnosis/safe-contracts/contracts/Extension.sol",
|
||||
"exportedSymbols": {
|
||||
"Extension": [
|
||||
18
|
||||
]
|
||||
},
|
||||
"id": 19,
|
||||
"nodeType": "SourceUnit",
|
||||
"nodes": [
|
||||
{
|
||||
"id": 1,
|
||||
"literals": [
|
||||
"solidity",
|
||||
"0.4",
|
||||
".19"
|
||||
],
|
||||
"nodeType": "PragmaDirective",
|
||||
"src": "0:23:0"
|
||||
},
|
||||
{
|
||||
"absolutePath": "/Users/apanizo/git/gnosis/safe-contracts/contracts/GnosisSafe.sol",
|
||||
"file": "./GnosisSafe.sol",
|
||||
"id": 2,
|
||||
"nodeType": "ImportDirective",
|
||||
"scope": 19,
|
||||
"sourceUnit": 964,
|
||||
"src": "24:26:0",
|
||||
"symbolAliases": [],
|
||||
"unitAlias": ""
|
||||
},
|
||||
{
|
||||
"baseContracts": [],
|
||||
"contractDependencies": [],
|
||||
"contractKind": "contract",
|
||||
"documentation": "@title Abstract Extension - Functions to be implemented by extensions.\n @author Stefan George - <stefan@gnosis.pm>",
|
||||
"fullyImplemented": false,
|
||||
"id": 18,
|
||||
"linearizedBaseContracts": [
|
||||
18
|
||||
],
|
||||
"name": "Extension",
|
||||
"nodeType": "ContractDefinition",
|
||||
"nodes": [
|
||||
{
|
||||
"body": null,
|
||||
"id": 17,
|
||||
"implemented": false,
|
||||
"isConstructor": false,
|
||||
"isDeclaredConst": false,
|
||||
"modifiers": [],
|
||||
"name": "isExecutable",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters": {
|
||||
"id": 13,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [
|
||||
{
|
||||
"constant": false,
|
||||
"id": 4,
|
||||
"name": "sender",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 17,
|
||||
"src": "710:14:0",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 3,
|
||||
"name": "address",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "710:7:0",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"id": 6,
|
||||
"name": "to",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 17,
|
||||
"src": "726:10:0",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 5,
|
||||
"name": "address",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "726:7:0",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"id": 8,
|
||||
"name": "value",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 17,
|
||||
"src": "738:13:0",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 7,
|
||||
"name": "uint256",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "738:7:0",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"id": 10,
|
||||
"name": "data",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 17,
|
||||
"src": "753:10:0",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_bytes_memory_ptr",
|
||||
"typeString": "bytes memory"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 9,
|
||||
"name": "bytes",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "753:5:0",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_bytes_storage_ptr",
|
||||
"typeString": "bytes storage pointer"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"id": 12,
|
||||
"name": "operation",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 17,
|
||||
"src": "765:30:0",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_enum$_Operation_$61",
|
||||
"typeString": "enum GnosisSafe.Operation"
|
||||
},
|
||||
"typeName": {
|
||||
"contractScope": null,
|
||||
"id": 11,
|
||||
"name": "GnosisSafe.Operation",
|
||||
"nodeType": "UserDefinedTypeName",
|
||||
"referencedDeclaration": 61,
|
||||
"src": "765:20:0",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_enum$_Operation_$61",
|
||||
"typeString": "enum GnosisSafe.Operation"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"src": "709:87:0"
|
||||
},
|
||||
"payable": false,
|
||||
"returnParameters": {
|
||||
"id": 16,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [
|
||||
{
|
||||
"constant": false,
|
||||
"id": 15,
|
||||
"name": "",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 17,
|
||||
"src": "813:4:0",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_bool",
|
||||
"typeString": "bool"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 14,
|
||||
"name": "bool",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "813:4:0",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_bool",
|
||||
"typeString": "bool"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"src": "812:6:0"
|
||||
},
|
||||
"scope": 18,
|
||||
"src": "688:131:0",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
"scope": 19,
|
||||
"src": "175:646:0"
|
||||
}
|
||||
],
|
||||
"src": "0:822:0"
|
||||
},
|
||||
"compiler": {
|
||||
"name": "solc",
|
||||
"version": "0.4.19+commit.c4cbbb05.Emscripten.clang"
|
||||
},
|
||||
"networks": {},
|
||||
"schemaVersion": "2.0.0",
|
||||
"updatedAt": "2018-05-04T10:42:18.365Z"
|
||||
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,359 @@
|
|||
{
|
||||
"contractName": "MultiSend",
|
||||
"abi": [
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "transactions",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "multiSend",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"bytecode": "0x6060604052341561000f57600080fd5b6101278061001e6000396000f300606060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680638d80ff0a146044575b600080fd5b3415604e57600080fd5b609c600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050609e565b005b805160205b8181101560f65780830151602082018401516060830185015160808401860160008083838688600019f16000811460d85760dd565b600080fd5b50602080602084010402608001850194505050505060a3565b5050505600a165627a7a723058207fe7130b5215c2b7fb5987a9e0c21a2085684d930840ac75e4e7c62730c93cfc0029",
|
||||
"deployedBytecode": "0x606060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680638d80ff0a146044575b600080fd5b3415604e57600080fd5b609c600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050609e565b005b805160205b8181101560f65780830151602082018401516060830185015160808401860160008083838688600019f16000811460d85760dd565b600080fd5b50602080602084010402608001850194505050505060a3565b5050505600a165627a7a723058207fe7130b5215c2b7fb5987a9e0c21a2085684d930840ac75e4e7c62730c93cfc0029",
|
||||
"sourceMap": "253:1012:9:-;;;;;;;;;;;;;;;;;",
|
||||
"deployedSourceMap": "253:1012:9:-;;;;;;;;;;;;;;;;;;;;;;;;593:670;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;704:12;698:5;739:4;756:491;770:6;767:1;764:2;756:491;;;834:1;820:12;816:3;810:5;898:4;895:1;891:3;877:12;873:3;867:5;971:4;968:1;964:3;950:12;946:3;940:5;1032:4;1029:1;1025:3;1011:12;1007:3;1107:1;1104;1092:10;1086:4;1079:5;1075:2;1071:1;1067:3;1062:4;1131:1;1126:23;;;;1055:94;;1126:23;1145:1;1142;1135:6;1055:94;;1226:4;1219;1212;1200:10;1196:3;1192;1188;1182:4;1178:3;1175:1;1171:3;1166:67;;782:465;;;;756:491;;;670:587;;;:::o",
|
||||
"source": "pragma solidity 0.4.19;\n\n\n/// @title Multi Send - Allows to batch multiple transactions into one.\n/// @author Nick Dodson - <nick.dodson@consensys.net>\n/// @author Gonçalo Sá - <goncalo.sa@consensys.net>\n/// @author Stefan George - <stefan@gnosis.pm>\ncontract MultiSend {\n\n /// @dev Sends multiple transactions and reverts all if one fails.\n /// @param transactions Encoded transactions. Each transaction is encoded as\n /// a tuple(address,uint256,bytes). The bytes of all\n /// encoded transactions are concatenated to form the input.\n function multiSend(bytes transactions)\n public\n {\n assembly {\n let length := mload(transactions)\n let i := 0x20\n for { } lt(i, length) { } {\n let to := mload(add(transactions, i))\n let value := mload(add(transactions, add(i, 0x20)))\n let dataLength := mload(add(transactions, add(i, 0x60)))\n let data := add(transactions, add(i, 0x80))\n switch call(not(0), to, value, data, dataLength, 0, 0)\n case 0 { revert(0, 0) }\n i := add(i, add(0x80, mul(div(add(dataLength, 0x20), 0x20), 0x20)))\n }\n }\n }\n}\n",
|
||||
"sourcePath": "/Users/apanizo/git/gnosis/safe-contracts/contracts/libraries/MultiSend.sol",
|
||||
"ast": {
|
||||
"absolutePath": "/Users/apanizo/git/gnosis/safe-contracts/contracts/libraries/MultiSend.sol",
|
||||
"exportedSymbols": {
|
||||
"MultiSend": [
|
||||
2016
|
||||
]
|
||||
},
|
||||
"id": 2017,
|
||||
"nodeType": "SourceUnit",
|
||||
"nodes": [
|
||||
{
|
||||
"id": 2008,
|
||||
"literals": [
|
||||
"solidity",
|
||||
"0.4",
|
||||
".19"
|
||||
],
|
||||
"nodeType": "PragmaDirective",
|
||||
"src": "0:23:9"
|
||||
},
|
||||
{
|
||||
"baseContracts": [],
|
||||
"contractDependencies": [],
|
||||
"contractKind": "contract",
|
||||
"documentation": "@title Multi Send - Allows to batch multiple transactions into one.\n @author Nick Dodson - <nick.dodson@consensys.net>\n @author Gonçalo Sá - <goncalo.sa@consensys.net>\n @author Stefan George - <stefan@gnosis.pm>",
|
||||
"fullyImplemented": true,
|
||||
"id": 2016,
|
||||
"linearizedBaseContracts": [
|
||||
2016
|
||||
],
|
||||
"name": "MultiSend",
|
||||
"nodeType": "ContractDefinition",
|
||||
"nodes": [
|
||||
{
|
||||
"body": {
|
||||
"id": 2014,
|
||||
"nodeType": "Block",
|
||||
"src": "651:612:9",
|
||||
"statements": [
|
||||
{
|
||||
"externalReferences": [
|
||||
{
|
||||
"transactions": {
|
||||
"declaration": 2010,
|
||||
"isOffset": false,
|
||||
"isSlot": false,
|
||||
"src": "704:12:9",
|
||||
"valueSize": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"transactions": {
|
||||
"declaration": 2010,
|
||||
"isOffset": false,
|
||||
"isSlot": false,
|
||||
"src": "820:12:9",
|
||||
"valueSize": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"transactions": {
|
||||
"declaration": 2010,
|
||||
"isOffset": false,
|
||||
"isSlot": false,
|
||||
"src": "877:12:9",
|
||||
"valueSize": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"transactions": {
|
||||
"declaration": 2010,
|
||||
"isOffset": false,
|
||||
"isSlot": false,
|
||||
"src": "950:12:9",
|
||||
"valueSize": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"transactions": {
|
||||
"declaration": 2010,
|
||||
"isOffset": false,
|
||||
"isSlot": false,
|
||||
"src": "1011:12:9",
|
||||
"valueSize": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"id": 2013,
|
||||
"nodeType": "InlineAssembly",
|
||||
"operations": "{\n let length := mload(transactions)\n let i := 0x20\n for {\n }\n lt(i, length)\n {\n }\n {\n let to := mload(add(transactions, i))\n let value := mload(add(transactions, add(i, 0x20)))\n let dataLength := mload(add(transactions, add(i, 0x60)))\n let data := add(transactions, add(i, 0x80))\n switch call(not(0), to, value, data, dataLength, 0, 0)\n case 0 {\n revert(0, 0)\n }\n i := add(i, add(0x80, mul(div(add(dataLength, 0x20), 0x20), 0x20)))\n }\n}",
|
||||
"src": "661:602:9"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": 2015,
|
||||
"implemented": true,
|
||||
"isConstructor": false,
|
||||
"isDeclaredConst": false,
|
||||
"modifiers": [],
|
||||
"name": "multiSend",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters": {
|
||||
"id": 2011,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [
|
||||
{
|
||||
"constant": false,
|
||||
"id": 2010,
|
||||
"name": "transactions",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 2015,
|
||||
"src": "612:18:9",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_bytes_memory_ptr",
|
||||
"typeString": "bytes memory"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 2009,
|
||||
"name": "bytes",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "612:5:9",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_bytes_storage_ptr",
|
||||
"typeString": "bytes storage pointer"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"src": "611:20:9"
|
||||
},
|
||||
"payable": false,
|
||||
"returnParameters": {
|
||||
"id": 2012,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "651:0:9"
|
||||
},
|
||||
"scope": 2016,
|
||||
"src": "593:670:9",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
"scope": 2017,
|
||||
"src": "253:1012:9"
|
||||
}
|
||||
],
|
||||
"src": "0:1266:9"
|
||||
},
|
||||
"legacyAST": {
|
||||
"absolutePath": "/Users/apanizo/git/gnosis/safe-contracts/contracts/libraries/MultiSend.sol",
|
||||
"exportedSymbols": {
|
||||
"MultiSend": [
|
||||
2016
|
||||
]
|
||||
},
|
||||
"id": 2017,
|
||||
"nodeType": "SourceUnit",
|
||||
"nodes": [
|
||||
{
|
||||
"id": 2008,
|
||||
"literals": [
|
||||
"solidity",
|
||||
"0.4",
|
||||
".19"
|
||||
],
|
||||
"nodeType": "PragmaDirective",
|
||||
"src": "0:23:9"
|
||||
},
|
||||
{
|
||||
"baseContracts": [],
|
||||
"contractDependencies": [],
|
||||
"contractKind": "contract",
|
||||
"documentation": "@title Multi Send - Allows to batch multiple transactions into one.\n @author Nick Dodson - <nick.dodson@consensys.net>\n @author Gonçalo Sá - <goncalo.sa@consensys.net>\n @author Stefan George - <stefan@gnosis.pm>",
|
||||
"fullyImplemented": true,
|
||||
"id": 2016,
|
||||
"linearizedBaseContracts": [
|
||||
2016
|
||||
],
|
||||
"name": "MultiSend",
|
||||
"nodeType": "ContractDefinition",
|
||||
"nodes": [
|
||||
{
|
||||
"body": {
|
||||
"id": 2014,
|
||||
"nodeType": "Block",
|
||||
"src": "651:612:9",
|
||||
"statements": [
|
||||
{
|
||||
"externalReferences": [
|
||||
{
|
||||
"transactions": {
|
||||
"declaration": 2010,
|
||||
"isOffset": false,
|
||||
"isSlot": false,
|
||||
"src": "704:12:9",
|
||||
"valueSize": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"transactions": {
|
||||
"declaration": 2010,
|
||||
"isOffset": false,
|
||||
"isSlot": false,
|
||||
"src": "820:12:9",
|
||||
"valueSize": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"transactions": {
|
||||
"declaration": 2010,
|
||||
"isOffset": false,
|
||||
"isSlot": false,
|
||||
"src": "877:12:9",
|
||||
"valueSize": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"transactions": {
|
||||
"declaration": 2010,
|
||||
"isOffset": false,
|
||||
"isSlot": false,
|
||||
"src": "950:12:9",
|
||||
"valueSize": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"transactions": {
|
||||
"declaration": 2010,
|
||||
"isOffset": false,
|
||||
"isSlot": false,
|
||||
"src": "1011:12:9",
|
||||
"valueSize": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"id": 2013,
|
||||
"nodeType": "InlineAssembly",
|
||||
"operations": "{\n let length := mload(transactions)\n let i := 0x20\n for {\n }\n lt(i, length)\n {\n }\n {\n let to := mload(add(transactions, i))\n let value := mload(add(transactions, add(i, 0x20)))\n let dataLength := mload(add(transactions, add(i, 0x60)))\n let data := add(transactions, add(i, 0x80))\n switch call(not(0), to, value, data, dataLength, 0, 0)\n case 0 {\n revert(0, 0)\n }\n i := add(i, add(0x80, mul(div(add(dataLength, 0x20), 0x20), 0x20)))\n }\n}",
|
||||
"src": "661:602:9"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": 2015,
|
||||
"implemented": true,
|
||||
"isConstructor": false,
|
||||
"isDeclaredConst": false,
|
||||
"modifiers": [],
|
||||
"name": "multiSend",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters": {
|
||||
"id": 2011,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [
|
||||
{
|
||||
"constant": false,
|
||||
"id": 2010,
|
||||
"name": "transactions",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 2015,
|
||||
"src": "612:18:9",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_bytes_memory_ptr",
|
||||
"typeString": "bytes memory"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 2009,
|
||||
"name": "bytes",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "612:5:9",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_bytes_storage_ptr",
|
||||
"typeString": "bytes storage pointer"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"src": "611:20:9"
|
||||
},
|
||||
"payable": false,
|
||||
"returnParameters": {
|
||||
"id": 2012,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "651:0:9"
|
||||
},
|
||||
"scope": 2016,
|
||||
"src": "593:670:9",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
"scope": 2017,
|
||||
"src": "253:1012:9"
|
||||
}
|
||||
],
|
||||
"src": "0:1266:9"
|
||||
},
|
||||
"compiler": {
|
||||
"name": "solc",
|
||||
"version": "0.4.19+commit.c4cbbb05.Emscripten.clang"
|
||||
},
|
||||
"networks": {
|
||||
"4": {
|
||||
"events": {},
|
||||
"links": {},
|
||||
"address": "0xb42ea77ed35188c3d9f478ede1883c7fc3889bf4",
|
||||
"transactionHash": "0x49884b2c77b96bd8fab92acb25cb6c1d31322f8d8a5285168b629d02ff0942df"
|
||||
},
|
||||
"42": {
|
||||
"events": {},
|
||||
"links": {},
|
||||
"address": "0xa64866921fa040d96080a66327b57d3659aa3cb2",
|
||||
"transactionHash": "0x0976055636f5f47833e456b68bbd3bd73497c17c1b51072795ee7ca472c7a1ee"
|
||||
},
|
||||
"1525342778744": {
|
||||
"events": {},
|
||||
"links": {},
|
||||
"address": "0x1751f194e16ab8cc857b37bbbca9b796b182691b",
|
||||
"transactionHash": "0xf406441274f4472d909145b4145733064edd26a8ef0c5cd1b00d19a481cec4fd"
|
||||
}
|
||||
},
|
||||
"schemaVersion": "2.0.0",
|
||||
"updatedAt": "2018-05-04T13:47:03.969Z"
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,644 @@
|
|||
{
|
||||
"contractName": "Proxy",
|
||||
"abi": [
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_masterCopy",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"payable": true,
|
||||
"stateMutability": "payable",
|
||||
"type": "fallback"
|
||||
}
|
||||
],
|
||||
"bytecode": "0x6060604052341561000f57600080fd5b6040516020806101108339810160405280805190602001909190505060008173ffffffffffffffffffffffffffffffffffffffff161415151561005157600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506070806100a06000396000f300606060405273ffffffffffffffffffffffffffffffffffffffff60005416366000803760008036600084600019f43d6000803e8060008114603f573d6000f35b3d6000fd00a165627a7a72305820daad8330a1c74b6650ef400638bc3fcb59dcd0b0341bff33bbe640bd2ffdaff60029",
|
||||
"deployedBytecode": "0x606060405273ffffffffffffffffffffffffffffffffffffffff60005416366000803760008036600084600019f43d6000803e8060008114603f573d6000f35b3d6000fd00a165627a7a72305820daad8330a1c74b6650ef400638bc3fcb59dcd0b0341bff33bbe640bd2ffdaff60029",
|
||||
"sourceMap": "190:887:3:-;;;357:131;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;445:1;430:11;:16;;;;422:25;;;;;;;;470:11;457:10;;:24;;;;;;;;;;;;;;;;;;357:131;190:887;;;;;;",
|
||||
"deployedSourceMap": "190:887:3:-;;;703:42;699:1;693:5;689:3;778:12;775:1;772;759:12;876:1;873;857:12;854:1;842:10;838:1;834:3;821:12;912:14;909:1;906;891:14;949:7;974:1;969:38;;;;1040:14;1037:1;1030:6;969:38;988:14;985:1;978:6",
|
||||
"source": "pragma solidity 0.4.19;\n\n\n/// @title Proxy - Generic proxy contract allows to execute all transactions applying the code of a master contract.\n/// @author Stefan George - <stefan@gnosis.pm>\ncontract Proxy {\n\n address masterCopy;\n\n /// @dev Constructor function sets address of master copy contract.\n /// @param _masterCopy Master copy address.\n function Proxy(address _masterCopy)\n public\n {\n require(_masterCopy != 0);\n masterCopy = _masterCopy;\n }\n\n /// @dev Fallback function forwards all transactions and returns all received return data.\n function ()\n external\n payable\n {\n assembly {\n let masterCopy := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff)\n calldatacopy(0, 0, calldatasize())\n let success := delegatecall(not(0), masterCopy, 0, calldatasize(), 0, 0)\n returndatacopy(0, 0, returndatasize())\n switch success\n case 0 { revert(0, returndatasize()) }\n default { return(0, returndatasize()) }\n }\n }\n}\n",
|
||||
"sourcePath": "/Users/apanizo/git/gnosis/safe-contracts/contracts/Proxy.sol",
|
||||
"ast": {
|
||||
"absolutePath": "/Users/apanizo/git/gnosis/safe-contracts/contracts/Proxy.sol",
|
||||
"exportedSymbols": {
|
||||
"Proxy": [
|
||||
1046
|
||||
]
|
||||
},
|
||||
"id": 1047,
|
||||
"nodeType": "SourceUnit",
|
||||
"nodes": [
|
||||
{
|
||||
"id": 1022,
|
||||
"literals": [
|
||||
"solidity",
|
||||
"0.4",
|
||||
".19"
|
||||
],
|
||||
"nodeType": "PragmaDirective",
|
||||
"src": "0:23:3"
|
||||
},
|
||||
{
|
||||
"baseContracts": [],
|
||||
"contractDependencies": [],
|
||||
"contractKind": "contract",
|
||||
"documentation": "@title Proxy - Generic proxy contract allows to execute all transactions applying the code of a master contract.\n @author Stefan George - <stefan@gnosis.pm>",
|
||||
"fullyImplemented": true,
|
||||
"id": 1046,
|
||||
"linearizedBaseContracts": [
|
||||
1046
|
||||
],
|
||||
"name": "Proxy",
|
||||
"nodeType": "ContractDefinition",
|
||||
"nodes": [
|
||||
{
|
||||
"constant": false,
|
||||
"id": 1024,
|
||||
"name": "masterCopy",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 1046,
|
||||
"src": "212:18:3",
|
||||
"stateVariable": true,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 1023,
|
||||
"name": "address",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "212:7:3",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
},
|
||||
{
|
||||
"body": {
|
||||
"id": 1039,
|
||||
"nodeType": "Block",
|
||||
"src": "412:76:3",
|
||||
"statements": [
|
||||
{
|
||||
"expression": {
|
||||
"argumentTypes": null,
|
||||
"arguments": [
|
||||
{
|
||||
"argumentTypes": null,
|
||||
"commonType": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
},
|
||||
"id": 1032,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": false,
|
||||
"lValueRequested": false,
|
||||
"leftExpression": {
|
||||
"argumentTypes": null,
|
||||
"id": 1030,
|
||||
"name": "_masterCopy",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 1026,
|
||||
"src": "430:11:3",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"nodeType": "BinaryOperation",
|
||||
"operator": "!=",
|
||||
"rightExpression": {
|
||||
"argumentTypes": null,
|
||||
"hexValue": "30",
|
||||
"id": 1031,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": true,
|
||||
"kind": "number",
|
||||
"lValueRequested": false,
|
||||
"nodeType": "Literal",
|
||||
"src": "445:1:3",
|
||||
"subdenomination": null,
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_rational_0_by_1",
|
||||
"typeString": "int_const 0"
|
||||
},
|
||||
"value": "0"
|
||||
},
|
||||
"src": "430:16:3",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_bool",
|
||||
"typeString": "bool"
|
||||
}
|
||||
}
|
||||
],
|
||||
"expression": {
|
||||
"argumentTypes": [
|
||||
{
|
||||
"typeIdentifier": "t_bool",
|
||||
"typeString": "bool"
|
||||
}
|
||||
],
|
||||
"id": 1029,
|
||||
"name": "require",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 2092,
|
||||
"src": "422:7:3",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$",
|
||||
"typeString": "function (bool) pure"
|
||||
}
|
||||
},
|
||||
"id": 1033,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": false,
|
||||
"kind": "functionCall",
|
||||
"lValueRequested": false,
|
||||
"names": [],
|
||||
"nodeType": "FunctionCall",
|
||||
"src": "422:25:3",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_tuple$__$",
|
||||
"typeString": "tuple()"
|
||||
}
|
||||
},
|
||||
"id": 1034,
|
||||
"nodeType": "ExpressionStatement",
|
||||
"src": "422:25:3"
|
||||
},
|
||||
{
|
||||
"expression": {
|
||||
"argumentTypes": null,
|
||||
"id": 1037,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": false,
|
||||
"lValueRequested": false,
|
||||
"leftHandSide": {
|
||||
"argumentTypes": null,
|
||||
"id": 1035,
|
||||
"name": "masterCopy",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 1024,
|
||||
"src": "457:10:3",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"nodeType": "Assignment",
|
||||
"operator": "=",
|
||||
"rightHandSide": {
|
||||
"argumentTypes": null,
|
||||
"id": 1036,
|
||||
"name": "_masterCopy",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 1026,
|
||||
"src": "470:11:3",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"src": "457:24:3",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"id": 1038,
|
||||
"nodeType": "ExpressionStatement",
|
||||
"src": "457:24:3"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": 1040,
|
||||
"implemented": true,
|
||||
"isConstructor": true,
|
||||
"isDeclaredConst": false,
|
||||
"modifiers": [],
|
||||
"name": "Proxy",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters": {
|
||||
"id": 1027,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [
|
||||
{
|
||||
"constant": false,
|
||||
"id": 1026,
|
||||
"name": "_masterCopy",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 1040,
|
||||
"src": "372:19:3",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 1025,
|
||||
"name": "address",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "372:7:3",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"src": "371:21:3"
|
||||
},
|
||||
"payable": false,
|
||||
"returnParameters": {
|
||||
"id": 1028,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "412:0:3"
|
||||
},
|
||||
"scope": 1046,
|
||||
"src": "357:131:3",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"body": {
|
||||
"id": 1044,
|
||||
"nodeType": "Block",
|
||||
"src": "638:437:3",
|
||||
"statements": [
|
||||
{
|
||||
"externalReferences": [],
|
||||
"id": 1043,
|
||||
"nodeType": "InlineAssembly",
|
||||
"operations": "{\n let masterCopy := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff)\n calldatacopy(0, 0, calldatasize())\n let success := delegatecall(not(0), masterCopy, 0, calldatasize(), 0, 0)\n returndatacopy(0, 0, returndatasize())\n switch success\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n}",
|
||||
"src": "648:427:3"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": 1045,
|
||||
"implemented": true,
|
||||
"isConstructor": false,
|
||||
"isDeclaredConst": false,
|
||||
"modifiers": [],
|
||||
"name": "",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters": {
|
||||
"id": 1041,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "598:2:3"
|
||||
},
|
||||
"payable": true,
|
||||
"returnParameters": {
|
||||
"id": 1042,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "638:0:3"
|
||||
},
|
||||
"scope": 1046,
|
||||
"src": "589:486:3",
|
||||
"stateMutability": "payable",
|
||||
"superFunction": null,
|
||||
"visibility": "external"
|
||||
}
|
||||
],
|
||||
"scope": 1047,
|
||||
"src": "190:887:3"
|
||||
}
|
||||
],
|
||||
"src": "0:1078:3"
|
||||
},
|
||||
"legacyAST": {
|
||||
"absolutePath": "/Users/apanizo/git/gnosis/safe-contracts/contracts/Proxy.sol",
|
||||
"exportedSymbols": {
|
||||
"Proxy": [
|
||||
1046
|
||||
]
|
||||
},
|
||||
"id": 1047,
|
||||
"nodeType": "SourceUnit",
|
||||
"nodes": [
|
||||
{
|
||||
"id": 1022,
|
||||
"literals": [
|
||||
"solidity",
|
||||
"0.4",
|
||||
".19"
|
||||
],
|
||||
"nodeType": "PragmaDirective",
|
||||
"src": "0:23:3"
|
||||
},
|
||||
{
|
||||
"baseContracts": [],
|
||||
"contractDependencies": [],
|
||||
"contractKind": "contract",
|
||||
"documentation": "@title Proxy - Generic proxy contract allows to execute all transactions applying the code of a master contract.\n @author Stefan George - <stefan@gnosis.pm>",
|
||||
"fullyImplemented": true,
|
||||
"id": 1046,
|
||||
"linearizedBaseContracts": [
|
||||
1046
|
||||
],
|
||||
"name": "Proxy",
|
||||
"nodeType": "ContractDefinition",
|
||||
"nodes": [
|
||||
{
|
||||
"constant": false,
|
||||
"id": 1024,
|
||||
"name": "masterCopy",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 1046,
|
||||
"src": "212:18:3",
|
||||
"stateVariable": true,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 1023,
|
||||
"name": "address",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "212:7:3",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
},
|
||||
{
|
||||
"body": {
|
||||
"id": 1039,
|
||||
"nodeType": "Block",
|
||||
"src": "412:76:3",
|
||||
"statements": [
|
||||
{
|
||||
"expression": {
|
||||
"argumentTypes": null,
|
||||
"arguments": [
|
||||
{
|
||||
"argumentTypes": null,
|
||||
"commonType": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
},
|
||||
"id": 1032,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": false,
|
||||
"lValueRequested": false,
|
||||
"leftExpression": {
|
||||
"argumentTypes": null,
|
||||
"id": 1030,
|
||||
"name": "_masterCopy",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 1026,
|
||||
"src": "430:11:3",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"nodeType": "BinaryOperation",
|
||||
"operator": "!=",
|
||||
"rightExpression": {
|
||||
"argumentTypes": null,
|
||||
"hexValue": "30",
|
||||
"id": 1031,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": true,
|
||||
"kind": "number",
|
||||
"lValueRequested": false,
|
||||
"nodeType": "Literal",
|
||||
"src": "445:1:3",
|
||||
"subdenomination": null,
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_rational_0_by_1",
|
||||
"typeString": "int_const 0"
|
||||
},
|
||||
"value": "0"
|
||||
},
|
||||
"src": "430:16:3",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_bool",
|
||||
"typeString": "bool"
|
||||
}
|
||||
}
|
||||
],
|
||||
"expression": {
|
||||
"argumentTypes": [
|
||||
{
|
||||
"typeIdentifier": "t_bool",
|
||||
"typeString": "bool"
|
||||
}
|
||||
],
|
||||
"id": 1029,
|
||||
"name": "require",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 2092,
|
||||
"src": "422:7:3",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$",
|
||||
"typeString": "function (bool) pure"
|
||||
}
|
||||
},
|
||||
"id": 1033,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": false,
|
||||
"kind": "functionCall",
|
||||
"lValueRequested": false,
|
||||
"names": [],
|
||||
"nodeType": "FunctionCall",
|
||||
"src": "422:25:3",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_tuple$__$",
|
||||
"typeString": "tuple()"
|
||||
}
|
||||
},
|
||||
"id": 1034,
|
||||
"nodeType": "ExpressionStatement",
|
||||
"src": "422:25:3"
|
||||
},
|
||||
{
|
||||
"expression": {
|
||||
"argumentTypes": null,
|
||||
"id": 1037,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": false,
|
||||
"lValueRequested": false,
|
||||
"leftHandSide": {
|
||||
"argumentTypes": null,
|
||||
"id": 1035,
|
||||
"name": "masterCopy",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 1024,
|
||||
"src": "457:10:3",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"nodeType": "Assignment",
|
||||
"operator": "=",
|
||||
"rightHandSide": {
|
||||
"argumentTypes": null,
|
||||
"id": 1036,
|
||||
"name": "_masterCopy",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 1026,
|
||||
"src": "470:11:3",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"src": "457:24:3",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"id": 1038,
|
||||
"nodeType": "ExpressionStatement",
|
||||
"src": "457:24:3"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": 1040,
|
||||
"implemented": true,
|
||||
"isConstructor": true,
|
||||
"isDeclaredConst": false,
|
||||
"modifiers": [],
|
||||
"name": "Proxy",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters": {
|
||||
"id": 1027,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [
|
||||
{
|
||||
"constant": false,
|
||||
"id": 1026,
|
||||
"name": "_masterCopy",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 1040,
|
||||
"src": "372:19:3",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 1025,
|
||||
"name": "address",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "372:7:3",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"src": "371:21:3"
|
||||
},
|
||||
"payable": false,
|
||||
"returnParameters": {
|
||||
"id": 1028,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "412:0:3"
|
||||
},
|
||||
"scope": 1046,
|
||||
"src": "357:131:3",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"body": {
|
||||
"id": 1044,
|
||||
"nodeType": "Block",
|
||||
"src": "638:437:3",
|
||||
"statements": [
|
||||
{
|
||||
"externalReferences": [],
|
||||
"id": 1043,
|
||||
"nodeType": "InlineAssembly",
|
||||
"operations": "{\n let masterCopy := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff)\n calldatacopy(0, 0, calldatasize())\n let success := delegatecall(not(0), masterCopy, 0, calldatasize(), 0, 0)\n returndatacopy(0, 0, returndatasize())\n switch success\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n}",
|
||||
"src": "648:427:3"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": 1045,
|
||||
"implemented": true,
|
||||
"isConstructor": false,
|
||||
"isDeclaredConst": false,
|
||||
"modifiers": [],
|
||||
"name": "",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters": {
|
||||
"id": 1041,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "598:2:3"
|
||||
},
|
||||
"payable": true,
|
||||
"returnParameters": {
|
||||
"id": 1042,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "638:0:3"
|
||||
},
|
||||
"scope": 1046,
|
||||
"src": "589:486:3",
|
||||
"stateMutability": "payable",
|
||||
"superFunction": null,
|
||||
"visibility": "external"
|
||||
}
|
||||
],
|
||||
"scope": 1047,
|
||||
"src": "190:887:3"
|
||||
}
|
||||
],
|
||||
"src": "0:1078:3"
|
||||
},
|
||||
"compiler": {
|
||||
"name": "solc",
|
||||
"version": "0.4.19+commit.c4cbbb05.Emscripten.clang"
|
||||
},
|
||||
"networks": {},
|
||||
"schemaVersion": "2.0.0",
|
||||
"updatedAt": "2018-05-04T10:42:18.368Z"
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,14 +1,13 @@
|
|||
// @flow
|
||||
import * as React from 'react'
|
||||
import { connect } from 'react-redux'
|
||||
import contract from 'truffle-contract'
|
||||
|
||||
import Page from '~/components/layout/Page'
|
||||
import { getAccountsFrom, getThresholdFrom, getNamesFrom, getSafeNameFrom, getDailyLimitFrom } from '~/routes/open/utils/safeDataExtractor'
|
||||
import { getWeb3 } from '~/wallets/getWeb3'
|
||||
import { promisify } from '~/utils/promisify'
|
||||
import Safe from '#/GnosisSafe.json'
|
||||
import { getGnosisSafeContract, deploySafeContract, initContracts } from '~/wallets/safeContracts'
|
||||
import selector from './selector'
|
||||
import actions, { type Actions } from './actions'
|
||||
import actions, { type Actions, type AddSafe } from './actions'
|
||||
import Layout from '../components/Layout'
|
||||
|
||||
type Props = Actions & {
|
||||
|
@ -21,7 +20,7 @@ type State = {
|
|||
safeTx: string,
|
||||
}
|
||||
|
||||
const createSafe = async (safeContract, values, userAccount, addSafe) => {
|
||||
const createSafe = async (values: Object, userAccount: string, addSafe: AddSafe): Promise<State> => {
|
||||
const accounts = getAccountsFrom(values)
|
||||
const numConfirmations = getThresholdFrom(values)
|
||||
const name = getSafeNameFrom(values)
|
||||
|
@ -29,11 +28,17 @@ const createSafe = async (safeContract, values, userAccount, addSafe) => {
|
|||
const dailyLimit = getDailyLimitFrom(values)
|
||||
|
||||
const web3 = getWeb3()
|
||||
safeContract.setProvider(web3.currentProvider)
|
||||
const GnosisSafe = getGnosisSafeContract(web3)
|
||||
|
||||
const safe = await safeContract.new(accounts, numConfirmations, 0, 0, { from: userAccount, gas: '5000000' })
|
||||
addSafe(name, safe.address, numConfirmations, dailyLimit, owners, accounts)
|
||||
return safe
|
||||
await initContracts()
|
||||
const safe = await deploySafeContract(accounts, numConfirmations, userAccount)
|
||||
|
||||
const param = safe.logs[1].args.proxy
|
||||
const safeContract = GnosisSafe.at(param)
|
||||
|
||||
addSafe(name, safeContract.address, numConfirmations, dailyLimit, owners, accounts)
|
||||
|
||||
return { safeAddress: safeContract.address, safeTx: safe }
|
||||
}
|
||||
|
||||
class Open extends React.Component<Props, State> {
|
||||
|
@ -44,29 +49,19 @@ class Open extends React.Component<Props, State> {
|
|||
safeAddress: '',
|
||||
safeTx: '',
|
||||
}
|
||||
|
||||
this.safe = contract(Safe)
|
||||
}
|
||||
|
||||
onCallSafeContractSubmit = async (values) => {
|
||||
try {
|
||||
const { userAccount, addSafe } = this.props
|
||||
const web3 = getWeb3()
|
||||
|
||||
const safeInstance = await createSafe(this.safe, values, userAccount, addSafe)
|
||||
const { address, transactionHash } = safeInstance
|
||||
|
||||
const transactionReceipt = await promisify(cb => web3.eth.getTransactionReceipt(transactionHash, cb))
|
||||
|
||||
this.setState({ safeAddress: address, safeTx: transactionReceipt })
|
||||
const safeInstance = await createSafe(values, userAccount, addSafe)
|
||||
this.setState(safeInstance)
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line
|
||||
console.log('Error while creating the Safe' + error)
|
||||
}
|
||||
}
|
||||
|
||||
safe: any
|
||||
|
||||
render() {
|
||||
const { safeAddress, safeTx } = this.state
|
||||
const { provider, userAccount } = this.props
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
// @flow
|
||||
import addSafe from '~/routes/safe/store/actions/addSafe'
|
||||
|
||||
export type AddSafe = typeof addSafe
|
||||
|
||||
export type Actions = {
|
||||
addSafe: typeof addSafe,
|
||||
}
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
// @flow
|
||||
|
||||
/*
|
||||
onAddFunds = async (values: Object) => {
|
||||
const { fundsToAdd } = values
|
||||
const { safeAddress } = this.state
|
||||
try {
|
||||
const web3 = getWeb3()
|
||||
const accounts = await promisify(cb => web3.eth.getAccounts(cb))
|
||||
const txData = { from: accounts[0], to: safeAddress, value: web3.toWei(fundsToAdd, 'ether') }
|
||||
await promisify(cb => web3.eth.sendTransaction(txData, cb))
|
||||
const funds = await promisify(cb => web3.eth.getBalance(safeAddress, cb))
|
||||
const fundsInEther = funds ? web3.fromWei(funds.toNumber(), 'ether') : 0
|
||||
this.setState({ funds: fundsInEther })
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line
|
||||
console.log(`Errog adding funds to safe${error}`)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
<GnoForm onSubmit={onAddFunds} width="500">
|
||||
{(pristine, invalid) => (
|
||||
<Block margin="md">
|
||||
<Heading tag="h2" margin="lg">Add Funds to the safe</Heading>
|
||||
<div style={{ margin: '10px 0px' }}>
|
||||
<label style={{ marginRight: '10px' }}>{safeAddress || 'Not safe detected'}</label>
|
||||
</div>
|
||||
{ safeAddress &&
|
||||
<div>
|
||||
<Field name="fundsToAdd" component={TextField} type="text" placeholder="ETH to add" />
|
||||
<Button type="submit" disabled={!safeAddress || pristine || invalid}>
|
||||
Add funds
|
||||
</Button>
|
||||
</div>
|
||||
}
|
||||
{ safeAddress &&
|
||||
<div style={{ margin: '15px 0px' }}>
|
||||
Total funds in this safe: { funds || 0 } ETH
|
||||
</div>
|
||||
}
|
||||
</Block>
|
||||
)}
|
||||
</GnoForm>
|
||||
*/
|
|
@ -23,7 +23,7 @@ const balanceReducerTests = () => {
|
|||
it('reducer should return 0 to just deployed safe', async () => {
|
||||
// GIVEN
|
||||
const safeTx = await aDeployedSafe(store)
|
||||
const address = safeTx.contractAddress
|
||||
const address = safeTx.logs[1].args.proxy
|
||||
|
||||
// WHEN
|
||||
await store.dispatch(fetchBalance(address))
|
||||
|
@ -37,7 +37,7 @@ const balanceReducerTests = () => {
|
|||
it('reducer should return 1.3456 ETH as funds to safe with 1 ETH', async () => {
|
||||
// GIVEN
|
||||
const safeTx = await aDeployedSafe(store)
|
||||
const address = safeTx.contractAddress
|
||||
const address = safeTx.logs[1].args.proxy
|
||||
|
||||
// WHEN
|
||||
await addEtherTo(address, '1.3456')
|
||||
|
|
|
@ -61,7 +61,7 @@ const deploySafe = async (safe: React$Component<{}>) => {
|
|||
}
|
||||
|
||||
const transactionHash = JSON.parse(deployed.getElementsByTagName('pre')[0].innerHTML)
|
||||
delete transactionHash.logsBloom
|
||||
delete transactionHash.receipt.logsBloom
|
||||
|
||||
return transactionHash
|
||||
}
|
||||
|
|
|
@ -7,7 +7,8 @@ export const ensureOnce = (fn: Function): Function => {
|
|||
if (executed) { return response }
|
||||
|
||||
executed = true
|
||||
response = fn(args)
|
||||
// eslint-disable-next-line
|
||||
response = fn.apply(undefined, args)
|
||||
|
||||
return response
|
||||
}
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
// @flow
|
||||
import contract from 'truffle-contract'
|
||||
import { promisify } from '~/utils/promisify'
|
||||
import { ensureOnce } from '~/utils/singleton'
|
||||
import { getWeb3 } from '~/wallets/getWeb3'
|
||||
import GnosisSafeSol from '#/GnosisSafe.json'
|
||||
import ProxyFactorySol from '#/ProxyFactory.json'
|
||||
import CreateAndAddExtensionSol from '#/CreateAndAddExtension.json'
|
||||
import DailyLimitExtensionSol from '#/DailyLimitExtension.json'
|
||||
|
||||
let proxyFactoryMaster
|
||||
let createAndAddExtensionMaster
|
||||
let safeMaster
|
||||
let dailyLimitMaster
|
||||
|
||||
const createGnosisSafeContract = (web3: any) => {
|
||||
const gnosisSafe = contract(GnosisSafeSol)
|
||||
gnosisSafe.setProvider(web3.currentProvider)
|
||||
|
||||
return gnosisSafe
|
||||
}
|
||||
|
||||
const createProxyFactoryContract = (web3: any) => {
|
||||
const proxyFactory = contract(ProxyFactorySol)
|
||||
proxyFactory.setProvider(web3.currentProvider)
|
||||
|
||||
return proxyFactory
|
||||
}
|
||||
|
||||
const createAddExtensionContract = (web3: any) => {
|
||||
const createAndAddExtension = contract(CreateAndAddExtensionSol)
|
||||
createAndAddExtension.setProvider(web3.currentProvider)
|
||||
|
||||
return createAndAddExtension
|
||||
}
|
||||
|
||||
const createDailyLimitExtensionContract = (web3: any) => {
|
||||
const dailyLimitExtension = contract(DailyLimitExtensionSol)
|
||||
dailyLimitExtension.setProvider(web3.currentProvider)
|
||||
|
||||
return dailyLimitExtension
|
||||
}
|
||||
|
||||
export const getGnosisSafeContract = ensureOnce(createGnosisSafeContract)
|
||||
const getCreateProxyFactoryContract = ensureOnce(createProxyFactoryContract)
|
||||
const getCreateAddExtensionContract = ensureOnce(createAddExtensionContract)
|
||||
const getCreateDailyLimitExtensionContract = ensureOnce(createDailyLimitExtensionContract)
|
||||
|
||||
const createMasterCopies = async () => {
|
||||
const web3 = getWeb3()
|
||||
const accounts = await promisify(cb => web3.eth.getAccounts(cb))
|
||||
const userAccount = accounts[0]
|
||||
|
||||
// Create ProxyFactory Master Copy
|
||||
const ProxyFactory = getCreateProxyFactoryContract(web3)
|
||||
try {
|
||||
proxyFactoryMaster = await ProxyFactory.deployed()
|
||||
} catch (err) {
|
||||
proxyFactoryMaster = await ProxyFactory.new({ from: userAccount, gas: '5000000' })
|
||||
}
|
||||
|
||||
// Create AddExtension Master Copy
|
||||
const CreateAndAddExtension = getCreateAddExtensionContract(web3)
|
||||
try {
|
||||
createAndAddExtensionMaster = await CreateAndAddExtension.deployed()
|
||||
} catch (err) {
|
||||
createAndAddExtensionMaster = await CreateAndAddExtension.new({ from: userAccount, gas: '5000000' })
|
||||
}
|
||||
|
||||
// Initialize safe master copy
|
||||
const GnosisSafe = getGnosisSafeContract(web3)
|
||||
try {
|
||||
safeMaster = await GnosisSafe.deployed()
|
||||
} catch (err) {
|
||||
safeMaster = await GnosisSafe.new([userAccount], 1, 0, 0, { from: userAccount, gas: '5000000' })
|
||||
}
|
||||
|
||||
// Initialize extension master copy
|
||||
const DailyLimitExtension = getCreateDailyLimitExtensionContract(web3)
|
||||
try {
|
||||
dailyLimitMaster = await DailyLimitExtension.deployed()
|
||||
} catch (err) {
|
||||
dailyLimitMaster = await DailyLimitExtension.new([], [], { from: userAccount, gas: '5000000' })
|
||||
}
|
||||
}
|
||||
|
||||
export const initContracts = ensureOnce(createMasterCopies)
|
||||
|
||||
const getSafeDataBasedOn = async (accounts, numConfirmations) => {
|
||||
const extensionData = await dailyLimitMaster.contract.setup
|
||||
.getData([0], [100])
|
||||
const proxyFactoryData = await proxyFactoryMaster.contract.createProxy
|
||||
.getData(dailyLimitMaster.address, extensionData)
|
||||
const createAndAddExtensionData = createAndAddExtensionMaster.contract.createAndAddExtension
|
||||
.getData(proxyFactoryMaster.address, proxyFactoryData)
|
||||
|
||||
return safeMaster.contract.setup
|
||||
.getData(accounts, numConfirmations, createAndAddExtensionMaster.address, createAndAddExtensionData)
|
||||
}
|
||||
|
||||
export const deploySafeContract = async (safeAccounts: string[], numConfirmations: number, userAccount: string) => {
|
||||
const gnosisSafeData = await getSafeDataBasedOn(safeAccounts, numConfirmations)
|
||||
return proxyFactoryMaster.createProxy(safeMaster.address, gnosisSafeData, { from: userAccount, gas: '5000000' })
|
||||
}
|
123
yarn.lock
123
yarn.lock
|
@ -2641,6 +2641,10 @@ browser-resolve@^1.11.0, browser-resolve@^1.11.2, browser-resolve@^1.7.0:
|
|||
dependencies:
|
||||
resolve "1.1.7"
|
||||
|
||||
browser-stdout@1.3.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f"
|
||||
|
||||
browserify-aes@^1.0.0, browserify-aes@^1.0.4, browserify-aes@^1.0.6:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.1.1.tgz#38b7ab55edb806ff2dcda1a7f1620773a477c49f"
|
||||
|
@ -3301,6 +3305,12 @@ commander@2.3.0:
|
|||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.3.0.tgz#fd430e889832ec353b9acd1de217c11cb3eef873"
|
||||
|
||||
commander@2.9.0:
|
||||
version "2.9.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4"
|
||||
dependencies:
|
||||
graceful-readlink ">= 1.0.0"
|
||||
|
||||
commander@^2.11.0, commander@^2.12.2, commander@^2.13.0, commander@^2.8.1, commander@^2.9.0:
|
||||
version "2.15.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.0.tgz#ad2a23a1c3b036e392469b8012cec6b33b4c1322"
|
||||
|
@ -3747,6 +3757,12 @@ debug@2.2.0, debug@~2.2.0:
|
|||
dependencies:
|
||||
ms "0.7.1"
|
||||
|
||||
debug@2.6.8:
|
||||
version "2.6.8"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc"
|
||||
dependencies:
|
||||
ms "2.0.0"
|
||||
|
||||
debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.6, debug@^2.6.8, debug@^2.6.9:
|
||||
version "2.6.9"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
|
||||
|
@ -3943,6 +3959,10 @@ diff@1.4.0:
|
|||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/diff/-/diff-1.4.0.tgz#7f28d2eb9ee7b15a97efd89ce63dcfdaa3ccbabf"
|
||||
|
||||
diff@3.2.0:
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/diff/-/diff-3.2.0.tgz#c9ce393a4b7cbd0b058a725c93df299027868ff9"
|
||||
|
||||
diff@^3.2.0, diff@^3.3.1, diff@^3.5.0:
|
||||
version "3.5.0"
|
||||
resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12"
|
||||
|
@ -5296,6 +5316,17 @@ glob@3.2.11:
|
|||
inherits "2"
|
||||
minimatch "0.3"
|
||||
|
||||
glob@7.1.1:
|
||||
version "7.1.1"
|
||||
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8"
|
||||
dependencies:
|
||||
fs.realpath "^1.0.0"
|
||||
inflight "^1.0.4"
|
||||
inherits "2"
|
||||
minimatch "^3.0.2"
|
||||
once "^1.3.0"
|
||||
path-is-absolute "^1.0.0"
|
||||
|
||||
glob@^6.0.1:
|
||||
version "6.0.4"
|
||||
resolved "https://registry.yarnpkg.com/glob/-/glob-6.0.4.tgz#0f08860f6a155127b2fadd4f9ce24b1aab6e4d22"
|
||||
|
@ -5424,6 +5455,10 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9,
|
|||
version "4.1.11"
|
||||
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"
|
||||
|
||||
"graceful-readlink@>= 1.0.0":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725"
|
||||
|
||||
graphlib@^2.0.0:
|
||||
version "2.1.5"
|
||||
resolved "https://registry.yarnpkg.com/graphlib/-/graphlib-2.1.5.tgz#6afe1afcc5148555ec799e499056795bd6938c87"
|
||||
|
@ -5607,7 +5642,7 @@ hdkey@^0.7.0:
|
|||
coinstring "^2.0.0"
|
||||
secp256k1 "^3.0.1"
|
||||
|
||||
he@1.1.x:
|
||||
he@1.1.1, he@1.1.x:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd"
|
||||
|
||||
|
@ -6863,7 +6898,7 @@ json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1:
|
|||
version "5.0.1"
|
||||
resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
|
||||
|
||||
json3@^3.3.2:
|
||||
json3@3.3.2, json3@^3.3.2:
|
||||
version "3.3.2"
|
||||
resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1"
|
||||
|
||||
|
@ -7228,10 +7263,29 @@ lodash-es@^4.17.4, lodash-es@^4.17.5, lodash-es@^4.2.1:
|
|||
version "4.17.7"
|
||||
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.7.tgz#db240a3252c3dd8360201ac9feef91ac977ea856"
|
||||
|
||||
lodash._baseassign@^3.0.0:
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz#8c38a099500f215ad09e59f1722fd0c52bfe0a4e"
|
||||
dependencies:
|
||||
lodash._basecopy "^3.0.0"
|
||||
lodash.keys "^3.0.0"
|
||||
|
||||
lodash._basecopy@^3.0.0:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36"
|
||||
|
||||
lodash._basecreate@^3.0.0:
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz#1bc661614daa7fc311b7d03bf16806a0213cf821"
|
||||
|
||||
lodash._getnative@^3.0.0:
|
||||
version "3.9.1"
|
||||
resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5"
|
||||
|
||||
lodash._isiterateecall@^3.0.0:
|
||||
version "3.0.9"
|
||||
resolved "https://registry.yarnpkg.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz#5203ad7ba425fae842460e696db9cf3e6aac057c"
|
||||
|
||||
lodash.assign@^4.0.3, lodash.assign@^4.0.6, lodash.assign@^4.2.0:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7"
|
||||
|
@ -7244,6 +7298,14 @@ lodash.clonedeep@^4.3.2:
|
|||
version "4.5.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef"
|
||||
|
||||
lodash.create@3.1.1:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/lodash.create/-/lodash.create-3.1.1.tgz#d7f2849f0dbda7e04682bb8cd72ab022461debe7"
|
||||
dependencies:
|
||||
lodash._baseassign "^3.0.0"
|
||||
lodash._basecreate "^3.0.0"
|
||||
lodash._isiterateecall "^3.0.0"
|
||||
|
||||
lodash.debounce@^4.0.8:
|
||||
version "4.0.8"
|
||||
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
|
||||
|
@ -7264,7 +7326,7 @@ lodash.isplainobject@^4.0.6:
|
|||
version "4.0.6"
|
||||
resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb"
|
||||
|
||||
lodash.keys@^3.1.2:
|
||||
lodash.keys@^3.0.0, lodash.keys@^3.1.2:
|
||||
version "3.1.2"
|
||||
resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a"
|
||||
dependencies:
|
||||
|
@ -7744,6 +7806,23 @@ mocha@^2.3.3, mocha@^2.4.5:
|
|||
supports-color "1.2.0"
|
||||
to-iso-string "0.0.2"
|
||||
|
||||
mocha@^3.4.2:
|
||||
version "3.5.3"
|
||||
resolved "https://registry.yarnpkg.com/mocha/-/mocha-3.5.3.tgz#1e0480fe36d2da5858d1eb6acc38418b26eaa20d"
|
||||
dependencies:
|
||||
browser-stdout "1.3.0"
|
||||
commander "2.9.0"
|
||||
debug "2.6.8"
|
||||
diff "3.2.0"
|
||||
escape-string-regexp "1.0.5"
|
||||
glob "7.1.1"
|
||||
growl "1.9.2"
|
||||
he "1.1.1"
|
||||
json3 "3.3.2"
|
||||
lodash.create "3.1.1"
|
||||
mkdirp "0.5.1"
|
||||
supports-color "3.1.2"
|
||||
|
||||
module-deps@^4.0.8:
|
||||
version "4.1.1"
|
||||
resolved "https://registry.yarnpkg.com/module-deps/-/module-deps-4.1.1.tgz#23215833f1da13fd606ccb8087b44852dcb821fd"
|
||||
|
@ -8220,6 +8299,10 @@ ora@^0.2.3:
|
|||
cli-spinners "^0.1.2"
|
||||
object-assign "^4.0.1"
|
||||
|
||||
original-require@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/original-require/-/original-require-1.0.1.tgz#0f130471584cd33511c5ec38c8d59213f9ac5e20"
|
||||
|
||||
original@>=0.0.5:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/original/-/original-1.0.0.tgz#9147f93fa1696d04be61e01bd50baeaca656bd3b"
|
||||
|
@ -10394,6 +10477,16 @@ sockjs@0.3.19:
|
|||
faye-websocket "^0.10.0"
|
||||
uuid "^3.0.1"
|
||||
|
||||
solc@0.4.21, solc@^0.4.2:
|
||||
version "0.4.21"
|
||||
resolved "https://registry.yarnpkg.com/solc/-/solc-0.4.21.tgz#6a7ecd505bfa0fc268330d5de6b9ae65c8c68264"
|
||||
dependencies:
|
||||
fs-extra "^0.30.0"
|
||||
memorystream "^0.3.1"
|
||||
require-from-string "^1.1.0"
|
||||
semver "^5.3.0"
|
||||
yargs "^4.7.1"
|
||||
|
||||
solc@0.4.8:
|
||||
version "0.4.8"
|
||||
resolved "https://registry.yarnpkg.com/solc/-/solc-0.4.8.tgz#96abbee1266341ae97fb4bdc3abcc9bc1b5052ab"
|
||||
|
@ -10412,16 +10505,6 @@ solc@^0.3.6:
|
|||
require-from-string "^1.1.0"
|
||||
yargs "^4.7.1"
|
||||
|
||||
solc@^0.4.2:
|
||||
version "0.4.21"
|
||||
resolved "https://registry.yarnpkg.com/solc/-/solc-0.4.21.tgz#6a7ecd505bfa0fc268330d5de6b9ae65c8c68264"
|
||||
dependencies:
|
||||
fs-extra "^0.30.0"
|
||||
memorystream "^0.3.1"
|
||||
require-from-string "^1.1.0"
|
||||
semver "^5.3.0"
|
||||
yargs "^4.7.1"
|
||||
|
||||
solidity-parser@^0.1.0, solidity-parser@^0.1.1:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/solidity-parser/-/solidity-parser-0.1.1.tgz#0fb3b665ed7041bef4575962ee426e7cd9d0a90a"
|
||||
|
@ -10833,6 +10916,12 @@ supports-color@1.2.0:
|
|||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-1.2.0.tgz#ff1ed1e61169d06b3cf2d588e188b18d8847e17e"
|
||||
|
||||
supports-color@3.1.2:
|
||||
version "3.1.2"
|
||||
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5"
|
||||
dependencies:
|
||||
has-flag "^1.0.0"
|
||||
|
||||
supports-color@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
|
||||
|
@ -11163,6 +11252,14 @@ truffle-solidity-loader@0.0.8:
|
|||
truffle "^2.0.8"
|
||||
web3 "^0.17.0-alpha"
|
||||
|
||||
truffle@4.1.5:
|
||||
version "4.1.5"
|
||||
resolved "https://registry.yarnpkg.com/truffle/-/truffle-4.1.5.tgz#763c8175fe5ea1ada92aa7a02eff84b4ab272f72"
|
||||
dependencies:
|
||||
mocha "^3.4.2"
|
||||
original-require "^1.0.1"
|
||||
solc "0.4.21"
|
||||
|
||||
truffle@^2.0.8:
|
||||
version "2.1.2"
|
||||
resolved "https://registry.yarnpkg.com/truffle/-/truffle-2.1.2.tgz#1ee61b9d785f6f2edb42801579e31f15b66c3746"
|
||||
|
|
Loading…
Reference in New Issue