add token contracts for testing purposes and refactor TokenMovements utils
This commit is contained in:
parent
e8b2404d5a
commit
cc07503f99
|
@ -0,0 +1,148 @@
|
|||
{
|
||||
"contractName": "DevDependenciesGetter",
|
||||
"abi": [],
|
||||
"metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/mmv/work/safe-react/contracts/DevDependencies.sol\":\"DevDependenciesGetter\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":500},\"remappings\":[]},\"sources\":{\"/home/mmv/work/safe-react/contracts/DevDependencies.sol\":{\"keccak256\":\"0xc649617f3c51e58509bdd0910726bd84a52f232b6aaf5790ac72f6e84ccb1b58\",\"urls\":[\"bzzr://57b15b2fd6a6a15523665a1f369e8b395a5649504f807114fedff42cf1b430b3\"]},\"/home/mmv/work/safe-react/src/test/contracts/TokenOMG.sol\":{\"keccak256\":\"0x099d05859e51af8b24539b47e0d181a17409d51063263f8a8d53280818c69d4d\",\"urls\":[\"bzzr://4eb926d078f8111367c3a180e7eb99f36528b95c871e1004c626f1cb5487f5dc\"]},\"/home/mmv/work/safe-react/src/test/contracts/TokenRDN.sol\":{\"keccak256\":\"0xbd1fc040f6b4f7b68bb7e6b745d02c571d7baf992c5a3a34d57392f624d7043c\",\"urls\":[\"bzzr://fdd020e4fe5f62e961acccce8733276ad3aca6dbe7ccff3f860476774cf6bdab\"]},\"@gnosis.pm/util-contracts/contracts/GnosisStandardToken.sol\":{\"keccak256\":\"0xdec5028208406e811c449a04e2932f7efeae629388cb6124550b8b048a645556\",\"urls\":[\"bzzr://f3d13a708f543b3ce72745cab321e6daf25d935fd12ba55a4152f1113eb6d5e4\"]},\"@gnosis.pm/util-contracts/contracts/Math.sol\":{\"keccak256\":\"0x857768cd0d460e33778dcde29e997b539640bbf37ea23832213b2e5039147ea5\",\"urls\":[\"bzzr://628f7e63a0d6a092aad389b70cc55d6d9c10cd9753f3644d5ea9dc75a3314a8e\"]},\"@gnosis.pm/util-contracts/contracts/Proxy.sol\":{\"keccak256\":\"0x2ff8795110cceafcab1010f157a4dd33e46378bb88fbdc3c313a6f0d62e3444f\",\"urls\":[\"bzzr://66d77feaf648ca17dd620f3e27463b4b6e6031fec7ccd64dfffc4c30bd57b467\"]},\"@gnosis.pm/util-contracts/contracts/Token.sol\":{\"keccak256\":\"0x364778f634c900ed83553e17ef1284bd33fa68a738e668f664b4a0fa675bb586\",\"urls\":[\"bzzr://cb31caaf3364dbf5d688adb10de074284845b142c26d23a47b09ee510dd4a432\"]}},\"version\":1}",
|
||||
"bytecode": "0x6080604052348015600f57600080fd5b50603580601d6000396000f3fe6080604052600080fdfea165627a7a723058205e4f8760788b4c49e4643557d735f7312e842b538cebaa480b66c5e3577d34cb0029",
|
||||
"deployedBytecode": "0x6080604052600080fdfea165627a7a723058205e4f8760788b4c49e4643557d735f7312e842b538cebaa480b66c5e3577d34cb0029",
|
||||
"sourceMap": "116:33:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;116:33:0;;;;;;;",
|
||||
"deployedSourceMap": "116:33:0:-;;;;;",
|
||||
"source": "pragma solidity ^0.5.2;\n\nimport \"../src/test/contracts/TokenOMG.sol\";\nimport \"../src/test/contracts/TokenRDN.sol\";\n\ncontract DevDependenciesGetter {}",
|
||||
"sourcePath": "/home/mmv/work/safe-react/contracts/DevDependencies.sol",
|
||||
"ast": {
|
||||
"absolutePath": "/home/mmv/work/safe-react/contracts/DevDependencies.sol",
|
||||
"exportedSymbols": {
|
||||
"DevDependenciesGetter": [
|
||||
4
|
||||
]
|
||||
},
|
||||
"id": 5,
|
||||
"nodeType": "SourceUnit",
|
||||
"nodes": [
|
||||
{
|
||||
"id": 1,
|
||||
"literals": [
|
||||
"solidity",
|
||||
"^",
|
||||
"0.5",
|
||||
".2"
|
||||
],
|
||||
"nodeType": "PragmaDirective",
|
||||
"src": "0:23:0"
|
||||
},
|
||||
{
|
||||
"absolutePath": "/home/mmv/work/safe-react/src/test/contracts/TokenOMG.sol",
|
||||
"file": "../src/test/contracts/TokenOMG.sol",
|
||||
"id": 2,
|
||||
"nodeType": "ImportDirective",
|
||||
"scope": 5,
|
||||
"sourceUnit": 90,
|
||||
"src": "25:44:0",
|
||||
"symbolAliases": [],
|
||||
"unitAlias": ""
|
||||
},
|
||||
{
|
||||
"absolutePath": "/home/mmv/work/safe-react/src/test/contracts/TokenRDN.sol",
|
||||
"file": "../src/test/contracts/TokenRDN.sol",
|
||||
"id": 3,
|
||||
"nodeType": "ImportDirective",
|
||||
"scope": 5,
|
||||
"sourceUnit": 118,
|
||||
"src": "70:44:0",
|
||||
"symbolAliases": [],
|
||||
"unitAlias": ""
|
||||
},
|
||||
{
|
||||
"baseContracts": [],
|
||||
"contractDependencies": [],
|
||||
"contractKind": "contract",
|
||||
"documentation": null,
|
||||
"fullyImplemented": true,
|
||||
"id": 4,
|
||||
"linearizedBaseContracts": [
|
||||
4
|
||||
],
|
||||
"name": "DevDependenciesGetter",
|
||||
"nodeType": "ContractDefinition",
|
||||
"nodes": [],
|
||||
"scope": 5,
|
||||
"src": "116:33:0"
|
||||
}
|
||||
],
|
||||
"src": "0:149:0"
|
||||
},
|
||||
"legacyAST": {
|
||||
"absolutePath": "/home/mmv/work/safe-react/contracts/DevDependencies.sol",
|
||||
"exportedSymbols": {
|
||||
"DevDependenciesGetter": [
|
||||
4
|
||||
]
|
||||
},
|
||||
"id": 5,
|
||||
"nodeType": "SourceUnit",
|
||||
"nodes": [
|
||||
{
|
||||
"id": 1,
|
||||
"literals": [
|
||||
"solidity",
|
||||
"^",
|
||||
"0.5",
|
||||
".2"
|
||||
],
|
||||
"nodeType": "PragmaDirective",
|
||||
"src": "0:23:0"
|
||||
},
|
||||
{
|
||||
"absolutePath": "/home/mmv/work/safe-react/src/test/contracts/TokenOMG.sol",
|
||||
"file": "../src/test/contracts/TokenOMG.sol",
|
||||
"id": 2,
|
||||
"nodeType": "ImportDirective",
|
||||
"scope": 5,
|
||||
"sourceUnit": 90,
|
||||
"src": "25:44:0",
|
||||
"symbolAliases": [],
|
||||
"unitAlias": ""
|
||||
},
|
||||
{
|
||||
"absolutePath": "/home/mmv/work/safe-react/src/test/contracts/TokenRDN.sol",
|
||||
"file": "../src/test/contracts/TokenRDN.sol",
|
||||
"id": 3,
|
||||
"nodeType": "ImportDirective",
|
||||
"scope": 5,
|
||||
"sourceUnit": 118,
|
||||
"src": "70:44:0",
|
||||
"symbolAliases": [],
|
||||
"unitAlias": ""
|
||||
},
|
||||
{
|
||||
"baseContracts": [],
|
||||
"contractDependencies": [],
|
||||
"contractKind": "contract",
|
||||
"documentation": null,
|
||||
"fullyImplemented": true,
|
||||
"id": 4,
|
||||
"linearizedBaseContracts": [
|
||||
4
|
||||
],
|
||||
"name": "DevDependenciesGetter",
|
||||
"nodeType": "ContractDefinition",
|
||||
"nodes": [],
|
||||
"scope": 5,
|
||||
"src": "116:33:0"
|
||||
}
|
||||
],
|
||||
"src": "0:149:0"
|
||||
},
|
||||
"compiler": {
|
||||
"name": "solc",
|
||||
"version": "0.5.8+commit.23d335f2.Emscripten.clang"
|
||||
},
|
||||
"networks": {},
|
||||
"schemaVersion": "3.0.10",
|
||||
"updatedAt": "2019-05-31T13:47:05.338Z",
|
||||
"devdoc": {
|
||||
"methods": {}
|
||||
},
|
||||
"userdoc": {
|
||||
"methods": {}
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,983 @@
|
|||
{
|
||||
"contractName": "Proxied",
|
||||
"abi": [
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "masterCopy",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[],\"name\":\"masterCopy\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Alan Lu - <alan@gnosis.pm>\",\"methods\":{},\"title\":\"Proxied - indicates that a contract will be proxied. Also defines storage requirements for Proxy.\"},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"@gnosis.pm/util-contracts/contracts/Proxy.sol\":\"Proxied\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":500},\"remappings\":[]},\"sources\":{\"@gnosis.pm/util-contracts/contracts/Proxy.sol\":{\"keccak256\":\"0x2ff8795110cceafcab1010f157a4dd33e46378bb88fbdc3c313a6f0d62e3444f\",\"urls\":[\"bzzr://66d77feaf648ca17dd620f3e27463b4b6e6031fec7ccd64dfffc4c30bd57b467\"]}},\"version\":1}",
|
||||
"bytecode": "0x6080604052348015600f57600080fd5b5060a48061001e6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063a619486e14602d575b600080fd5b6033605c565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b60005473ffffffffffffffffffffffffffffffffffffffff168156fea165627a7a7230582030927156db8f845fed095b245b70d15291cf8c9a8cdd88be16cdf598edc721190029",
|
||||
"deployedBytecode": "0x6080604052348015600f57600080fd5b506004361060285760003560e01c8063a619486e14602d575b600080fd5b6033605c565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b60005473ffffffffffffffffffffffffffffffffffffffff168156fea165627a7a7230582030927156db8f845fed095b245b70d15291cf8c9a8cdd88be16cdf598edc721190029",
|
||||
"sourceMap": "173:51:6:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;173:51:6;;;;;;;",
|
||||
"deployedSourceMap": "173:51:6:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;173:51:6;;;;;;;;;;;;;;;;;;;196:25;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;:::o",
|
||||
"source": "pragma solidity ^0.5.2;\n\n/// @title Proxied - indicates that a contract will be proxied. Also defines storage requirements for Proxy.\n/// @author Alan Lu - <alan@gnosis.pm>\ncontract Proxied {\n address public masterCopy;\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 is Proxied {\n /// @dev Constructor function sets address of master copy contract.\n /// @param _masterCopy Master copy address.\n constructor(address _masterCopy) public {\n require(_masterCopy != address(0), \"The master copy is required\");\n masterCopy = _masterCopy;\n }\n\n /// @dev Fallback function forwards all transactions and returns all received return data.\n function() external payable {\n address _masterCopy = masterCopy;\n assembly {\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 }\n }\n}\n",
|
||||
"sourcePath": "@gnosis.pm/util-contracts/contracts/Proxy.sol",
|
||||
"ast": {
|
||||
"absolutePath": "@gnosis.pm/util-contracts/contracts/Proxy.sol",
|
||||
"exportedSymbols": {
|
||||
"Proxied": [
|
||||
1463
|
||||
],
|
||||
"Proxy": [
|
||||
1494
|
||||
]
|
||||
},
|
||||
"id": 1495,
|
||||
"nodeType": "SourceUnit",
|
||||
"nodes": [
|
||||
{
|
||||
"id": 1460,
|
||||
"literals": [
|
||||
"solidity",
|
||||
"^",
|
||||
"0.5",
|
||||
".2"
|
||||
],
|
||||
"nodeType": "PragmaDirective",
|
||||
"src": "0:23:6"
|
||||
},
|
||||
{
|
||||
"baseContracts": [],
|
||||
"contractDependencies": [],
|
||||
"contractKind": "contract",
|
||||
"documentation": "@title Proxied - indicates that a contract will be proxied. Also defines storage requirements for Proxy.\n @author Alan Lu - <alan@gnosis.pm>",
|
||||
"fullyImplemented": true,
|
||||
"id": 1463,
|
||||
"linearizedBaseContracts": [
|
||||
1463
|
||||
],
|
||||
"name": "Proxied",
|
||||
"nodeType": "ContractDefinition",
|
||||
"nodes": [
|
||||
{
|
||||
"constant": false,
|
||||
"id": 1462,
|
||||
"name": "masterCopy",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 1463,
|
||||
"src": "196:25:6",
|
||||
"stateVariable": true,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 1461,
|
||||
"name": "address",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "196:7:6",
|
||||
"stateMutability": "nonpayable",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
"scope": 1495,
|
||||
"src": "173:51:6"
|
||||
},
|
||||
{
|
||||
"baseContracts": [
|
||||
{
|
||||
"arguments": null,
|
||||
"baseName": {
|
||||
"contractScope": null,
|
||||
"id": 1464,
|
||||
"name": "Proxied",
|
||||
"nodeType": "UserDefinedTypeName",
|
||||
"referencedDeclaration": 1463,
|
||||
"src": "408:7:6",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_contract$_Proxied_$1463",
|
||||
"typeString": "contract Proxied"
|
||||
}
|
||||
},
|
||||
"id": 1465,
|
||||
"nodeType": "InheritanceSpecifier",
|
||||
"src": "408:7:6"
|
||||
}
|
||||
],
|
||||
"contractDependencies": [
|
||||
1463
|
||||
],
|
||||
"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": 1494,
|
||||
"linearizedBaseContracts": [
|
||||
1494,
|
||||
1463
|
||||
],
|
||||
"name": "Proxy",
|
||||
"nodeType": "ContractDefinition",
|
||||
"nodes": [
|
||||
{
|
||||
"body": {
|
||||
"id": 1483,
|
||||
"nodeType": "Block",
|
||||
"src": "582:116:6",
|
||||
"statements": [
|
||||
{
|
||||
"expression": {
|
||||
"argumentTypes": null,
|
||||
"arguments": [
|
||||
{
|
||||
"argumentTypes": null,
|
||||
"commonType": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
},
|
||||
"id": 1475,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": false,
|
||||
"lValueRequested": false,
|
||||
"leftExpression": {
|
||||
"argumentTypes": null,
|
||||
"id": 1471,
|
||||
"name": "_masterCopy",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 1467,
|
||||
"src": "600:11:6",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"nodeType": "BinaryOperation",
|
||||
"operator": "!=",
|
||||
"rightExpression": {
|
||||
"argumentTypes": null,
|
||||
"arguments": [
|
||||
{
|
||||
"argumentTypes": null,
|
||||
"hexValue": "30",
|
||||
"id": 1473,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": true,
|
||||
"kind": "number",
|
||||
"lValueRequested": false,
|
||||
"nodeType": "Literal",
|
||||
"src": "623:1:6",
|
||||
"subdenomination": null,
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_rational_0_by_1",
|
||||
"typeString": "int_const 0"
|
||||
},
|
||||
"value": "0"
|
||||
}
|
||||
],
|
||||
"expression": {
|
||||
"argumentTypes": [
|
||||
{
|
||||
"typeIdentifier": "t_rational_0_by_1",
|
||||
"typeString": "int_const 0"
|
||||
}
|
||||
],
|
||||
"id": 1472,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": true,
|
||||
"lValueRequested": false,
|
||||
"nodeType": "ElementaryTypeNameExpression",
|
||||
"src": "615:7:6",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_type$_t_address_$",
|
||||
"typeString": "type(address)"
|
||||
},
|
||||
"typeName": "address"
|
||||
},
|
||||
"id": 1474,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": true,
|
||||
"kind": "typeConversion",
|
||||
"lValueRequested": false,
|
||||
"names": [],
|
||||
"nodeType": "FunctionCall",
|
||||
"src": "615:10:6",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address_payable",
|
||||
"typeString": "address payable"
|
||||
}
|
||||
},
|
||||
"src": "600:25:6",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_bool",
|
||||
"typeString": "bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"argumentTypes": null,
|
||||
"hexValue": "546865206d617374657220636f7079206973207265717569726564",
|
||||
"id": 1476,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": true,
|
||||
"kind": "string",
|
||||
"lValueRequested": false,
|
||||
"nodeType": "Literal",
|
||||
"src": "627:29:6",
|
||||
"subdenomination": null,
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_stringliteral_2e9921edd8141a51172691d5d51dd1cbeb601d8d4953527c9d36e0bffd20fed9",
|
||||
"typeString": "literal_string \"The master copy is required\""
|
||||
},
|
||||
"value": "The master copy is required"
|
||||
}
|
||||
],
|
||||
"expression": {
|
||||
"argumentTypes": [
|
||||
{
|
||||
"typeIdentifier": "t_bool",
|
||||
"typeString": "bool"
|
||||
},
|
||||
{
|
||||
"typeIdentifier": "t_stringliteral_2e9921edd8141a51172691d5d51dd1cbeb601d8d4953527c9d36e0bffd20fed9",
|
||||
"typeString": "literal_string \"The master copy is required\""
|
||||
}
|
||||
],
|
||||
"id": 1470,
|
||||
"name": "require",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [
|
||||
1581,
|
||||
1582
|
||||
],
|
||||
"referencedDeclaration": 1582,
|
||||
"src": "592:7:6",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
|
||||
"typeString": "function (bool,string memory) pure"
|
||||
}
|
||||
},
|
||||
"id": 1477,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": false,
|
||||
"kind": "functionCall",
|
||||
"lValueRequested": false,
|
||||
"names": [],
|
||||
"nodeType": "FunctionCall",
|
||||
"src": "592:65:6",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_tuple$__$",
|
||||
"typeString": "tuple()"
|
||||
}
|
||||
},
|
||||
"id": 1478,
|
||||
"nodeType": "ExpressionStatement",
|
||||
"src": "592:65:6"
|
||||
},
|
||||
{
|
||||
"expression": {
|
||||
"argumentTypes": null,
|
||||
"id": 1481,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": false,
|
||||
"lValueRequested": false,
|
||||
"leftHandSide": {
|
||||
"argumentTypes": null,
|
||||
"id": 1479,
|
||||
"name": "masterCopy",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 1462,
|
||||
"src": "667:10:6",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"nodeType": "Assignment",
|
||||
"operator": "=",
|
||||
"rightHandSide": {
|
||||
"argumentTypes": null,
|
||||
"id": 1480,
|
||||
"name": "_masterCopy",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 1467,
|
||||
"src": "680:11:6",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"src": "667:24:6",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"id": 1482,
|
||||
"nodeType": "ExpressionStatement",
|
||||
"src": "667:24:6"
|
||||
}
|
||||
]
|
||||
},
|
||||
"documentation": "@dev Constructor function sets address of master copy contract.\n @param _masterCopy Master copy address.",
|
||||
"id": 1484,
|
||||
"implemented": true,
|
||||
"kind": "constructor",
|
||||
"modifiers": [],
|
||||
"name": "",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters": {
|
||||
"id": 1468,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [
|
||||
{
|
||||
"constant": false,
|
||||
"id": 1467,
|
||||
"name": "_masterCopy",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 1484,
|
||||
"src": "554:19:6",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 1466,
|
||||
"name": "address",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "554:7:6",
|
||||
"stateMutability": "nonpayable",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"src": "553:21:6"
|
||||
},
|
||||
"returnParameters": {
|
||||
"id": 1469,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "582:0:6"
|
||||
},
|
||||
"scope": 1494,
|
||||
"src": "542:156:6",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"body": {
|
||||
"id": 1492,
|
||||
"nodeType": "Block",
|
||||
"src": "827:462:6",
|
||||
"statements": [
|
||||
{
|
||||
"assignments": [
|
||||
1488
|
||||
],
|
||||
"declarations": [
|
||||
{
|
||||
"constant": false,
|
||||
"id": 1488,
|
||||
"name": "_masterCopy",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 1492,
|
||||
"src": "837:19:6",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 1487,
|
||||
"name": "address",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "837:7:6",
|
||||
"stateMutability": "nonpayable",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"id": 1490,
|
||||
"initialValue": {
|
||||
"argumentTypes": null,
|
||||
"id": 1489,
|
||||
"name": "masterCopy",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 1462,
|
||||
"src": "859:10:6",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"nodeType": "VariableDeclarationStatement",
|
||||
"src": "837:32:6"
|
||||
},
|
||||
{
|
||||
"externalReferences": [
|
||||
{
|
||||
"_masterCopy": {
|
||||
"declaration": 1488,
|
||||
"isOffset": false,
|
||||
"isSlot": false,
|
||||
"src": "983:11:6",
|
||||
"valueSize": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"id": 1491,
|
||||
"nodeType": "InlineAssembly",
|
||||
"operations": "{\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": "879:404:6"
|
||||
}
|
||||
]
|
||||
},
|
||||
"documentation": "@dev Fallback function forwards all transactions and returns all received return data.",
|
||||
"id": 1493,
|
||||
"implemented": true,
|
||||
"kind": "fallback",
|
||||
"modifiers": [],
|
||||
"name": "",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters": {
|
||||
"id": 1485,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "807:2:6"
|
||||
},
|
||||
"returnParameters": {
|
||||
"id": 1486,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "827:0:6"
|
||||
},
|
||||
"scope": 1494,
|
||||
"src": "799:490:6",
|
||||
"stateMutability": "payable",
|
||||
"superFunction": null,
|
||||
"visibility": "external"
|
||||
}
|
||||
],
|
||||
"scope": 1495,
|
||||
"src": "390:901:6"
|
||||
}
|
||||
],
|
||||
"src": "0:1292:6"
|
||||
},
|
||||
"legacyAST": {
|
||||
"absolutePath": "@gnosis.pm/util-contracts/contracts/Proxy.sol",
|
||||
"exportedSymbols": {
|
||||
"Proxied": [
|
||||
1463
|
||||
],
|
||||
"Proxy": [
|
||||
1494
|
||||
]
|
||||
},
|
||||
"id": 1495,
|
||||
"nodeType": "SourceUnit",
|
||||
"nodes": [
|
||||
{
|
||||
"id": 1460,
|
||||
"literals": [
|
||||
"solidity",
|
||||
"^",
|
||||
"0.5",
|
||||
".2"
|
||||
],
|
||||
"nodeType": "PragmaDirective",
|
||||
"src": "0:23:6"
|
||||
},
|
||||
{
|
||||
"baseContracts": [],
|
||||
"contractDependencies": [],
|
||||
"contractKind": "contract",
|
||||
"documentation": "@title Proxied - indicates that a contract will be proxied. Also defines storage requirements for Proxy.\n @author Alan Lu - <alan@gnosis.pm>",
|
||||
"fullyImplemented": true,
|
||||
"id": 1463,
|
||||
"linearizedBaseContracts": [
|
||||
1463
|
||||
],
|
||||
"name": "Proxied",
|
||||
"nodeType": "ContractDefinition",
|
||||
"nodes": [
|
||||
{
|
||||
"constant": false,
|
||||
"id": 1462,
|
||||
"name": "masterCopy",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 1463,
|
||||
"src": "196:25:6",
|
||||
"stateVariable": true,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 1461,
|
||||
"name": "address",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "196:7:6",
|
||||
"stateMutability": "nonpayable",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
"scope": 1495,
|
||||
"src": "173:51:6"
|
||||
},
|
||||
{
|
||||
"baseContracts": [
|
||||
{
|
||||
"arguments": null,
|
||||
"baseName": {
|
||||
"contractScope": null,
|
||||
"id": 1464,
|
||||
"name": "Proxied",
|
||||
"nodeType": "UserDefinedTypeName",
|
||||
"referencedDeclaration": 1463,
|
||||
"src": "408:7:6",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_contract$_Proxied_$1463",
|
||||
"typeString": "contract Proxied"
|
||||
}
|
||||
},
|
||||
"id": 1465,
|
||||
"nodeType": "InheritanceSpecifier",
|
||||
"src": "408:7:6"
|
||||
}
|
||||
],
|
||||
"contractDependencies": [
|
||||
1463
|
||||
],
|
||||
"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": 1494,
|
||||
"linearizedBaseContracts": [
|
||||
1494,
|
||||
1463
|
||||
],
|
||||
"name": "Proxy",
|
||||
"nodeType": "ContractDefinition",
|
||||
"nodes": [
|
||||
{
|
||||
"body": {
|
||||
"id": 1483,
|
||||
"nodeType": "Block",
|
||||
"src": "582:116:6",
|
||||
"statements": [
|
||||
{
|
||||
"expression": {
|
||||
"argumentTypes": null,
|
||||
"arguments": [
|
||||
{
|
||||
"argumentTypes": null,
|
||||
"commonType": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
},
|
||||
"id": 1475,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": false,
|
||||
"lValueRequested": false,
|
||||
"leftExpression": {
|
||||
"argumentTypes": null,
|
||||
"id": 1471,
|
||||
"name": "_masterCopy",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 1467,
|
||||
"src": "600:11:6",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"nodeType": "BinaryOperation",
|
||||
"operator": "!=",
|
||||
"rightExpression": {
|
||||
"argumentTypes": null,
|
||||
"arguments": [
|
||||
{
|
||||
"argumentTypes": null,
|
||||
"hexValue": "30",
|
||||
"id": 1473,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": true,
|
||||
"kind": "number",
|
||||
"lValueRequested": false,
|
||||
"nodeType": "Literal",
|
||||
"src": "623:1:6",
|
||||
"subdenomination": null,
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_rational_0_by_1",
|
||||
"typeString": "int_const 0"
|
||||
},
|
||||
"value": "0"
|
||||
}
|
||||
],
|
||||
"expression": {
|
||||
"argumentTypes": [
|
||||
{
|
||||
"typeIdentifier": "t_rational_0_by_1",
|
||||
"typeString": "int_const 0"
|
||||
}
|
||||
],
|
||||
"id": 1472,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": true,
|
||||
"lValueRequested": false,
|
||||
"nodeType": "ElementaryTypeNameExpression",
|
||||
"src": "615:7:6",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_type$_t_address_$",
|
||||
"typeString": "type(address)"
|
||||
},
|
||||
"typeName": "address"
|
||||
},
|
||||
"id": 1474,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": true,
|
||||
"kind": "typeConversion",
|
||||
"lValueRequested": false,
|
||||
"names": [],
|
||||
"nodeType": "FunctionCall",
|
||||
"src": "615:10:6",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address_payable",
|
||||
"typeString": "address payable"
|
||||
}
|
||||
},
|
||||
"src": "600:25:6",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_bool",
|
||||
"typeString": "bool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"argumentTypes": null,
|
||||
"hexValue": "546865206d617374657220636f7079206973207265717569726564",
|
||||
"id": 1476,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": true,
|
||||
"kind": "string",
|
||||
"lValueRequested": false,
|
||||
"nodeType": "Literal",
|
||||
"src": "627:29:6",
|
||||
"subdenomination": null,
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_stringliteral_2e9921edd8141a51172691d5d51dd1cbeb601d8d4953527c9d36e0bffd20fed9",
|
||||
"typeString": "literal_string \"The master copy is required\""
|
||||
},
|
||||
"value": "The master copy is required"
|
||||
}
|
||||
],
|
||||
"expression": {
|
||||
"argumentTypes": [
|
||||
{
|
||||
"typeIdentifier": "t_bool",
|
||||
"typeString": "bool"
|
||||
},
|
||||
{
|
||||
"typeIdentifier": "t_stringliteral_2e9921edd8141a51172691d5d51dd1cbeb601d8d4953527c9d36e0bffd20fed9",
|
||||
"typeString": "literal_string \"The master copy is required\""
|
||||
}
|
||||
],
|
||||
"id": 1470,
|
||||
"name": "require",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [
|
||||
1581,
|
||||
1582
|
||||
],
|
||||
"referencedDeclaration": 1582,
|
||||
"src": "592:7:6",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
|
||||
"typeString": "function (bool,string memory) pure"
|
||||
}
|
||||
},
|
||||
"id": 1477,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": false,
|
||||
"kind": "functionCall",
|
||||
"lValueRequested": false,
|
||||
"names": [],
|
||||
"nodeType": "FunctionCall",
|
||||
"src": "592:65:6",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_tuple$__$",
|
||||
"typeString": "tuple()"
|
||||
}
|
||||
},
|
||||
"id": 1478,
|
||||
"nodeType": "ExpressionStatement",
|
||||
"src": "592:65:6"
|
||||
},
|
||||
{
|
||||
"expression": {
|
||||
"argumentTypes": null,
|
||||
"id": 1481,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": false,
|
||||
"lValueRequested": false,
|
||||
"leftHandSide": {
|
||||
"argumentTypes": null,
|
||||
"id": 1479,
|
||||
"name": "masterCopy",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 1462,
|
||||
"src": "667:10:6",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"nodeType": "Assignment",
|
||||
"operator": "=",
|
||||
"rightHandSide": {
|
||||
"argumentTypes": null,
|
||||
"id": 1480,
|
||||
"name": "_masterCopy",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 1467,
|
||||
"src": "680:11:6",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"src": "667:24:6",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"id": 1482,
|
||||
"nodeType": "ExpressionStatement",
|
||||
"src": "667:24:6"
|
||||
}
|
||||
]
|
||||
},
|
||||
"documentation": "@dev Constructor function sets address of master copy contract.\n @param _masterCopy Master copy address.",
|
||||
"id": 1484,
|
||||
"implemented": true,
|
||||
"kind": "constructor",
|
||||
"modifiers": [],
|
||||
"name": "",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters": {
|
||||
"id": 1468,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [
|
||||
{
|
||||
"constant": false,
|
||||
"id": 1467,
|
||||
"name": "_masterCopy",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 1484,
|
||||
"src": "554:19:6",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 1466,
|
||||
"name": "address",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "554:7:6",
|
||||
"stateMutability": "nonpayable",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"src": "553:21:6"
|
||||
},
|
||||
"returnParameters": {
|
||||
"id": 1469,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "582:0:6"
|
||||
},
|
||||
"scope": 1494,
|
||||
"src": "542:156:6",
|
||||
"stateMutability": "nonpayable",
|
||||
"superFunction": null,
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"body": {
|
||||
"id": 1492,
|
||||
"nodeType": "Block",
|
||||
"src": "827:462:6",
|
||||
"statements": [
|
||||
{
|
||||
"assignments": [
|
||||
1488
|
||||
],
|
||||
"declarations": [
|
||||
{
|
||||
"constant": false,
|
||||
"id": 1488,
|
||||
"name": "_masterCopy",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 1492,
|
||||
"src": "837:19:6",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
},
|
||||
"typeName": {
|
||||
"id": 1487,
|
||||
"name": "address",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "837:7:6",
|
||||
"stateMutability": "nonpayable",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"id": 1490,
|
||||
"initialValue": {
|
||||
"argumentTypes": null,
|
||||
"id": 1489,
|
||||
"name": "masterCopy",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 1462,
|
||||
"src": "859:10:6",
|
||||
"typeDescriptions": {
|
||||
"typeIdentifier": "t_address",
|
||||
"typeString": "address"
|
||||
}
|
||||
},
|
||||
"nodeType": "VariableDeclarationStatement",
|
||||
"src": "837:32:6"
|
||||
},
|
||||
{
|
||||
"externalReferences": [
|
||||
{
|
||||
"_masterCopy": {
|
||||
"declaration": 1488,
|
||||
"isOffset": false,
|
||||
"isSlot": false,
|
||||
"src": "983:11:6",
|
||||
"valueSize": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"id": 1491,
|
||||
"nodeType": "InlineAssembly",
|
||||
"operations": "{\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": "879:404:6"
|
||||
}
|
||||
]
|
||||
},
|
||||
"documentation": "@dev Fallback function forwards all transactions and returns all received return data.",
|
||||
"id": 1493,
|
||||
"implemented": true,
|
||||
"kind": "fallback",
|
||||
"modifiers": [],
|
||||
"name": "",
|
||||
"nodeType": "FunctionDefinition",
|
||||
"parameters": {
|
||||
"id": 1485,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "807:2:6"
|
||||
},
|
||||
"returnParameters": {
|
||||
"id": 1486,
|
||||
"nodeType": "ParameterList",
|
||||
"parameters": [],
|
||||
"src": "827:0:6"
|
||||
},
|
||||
"scope": 1494,
|
||||
"src": "799:490:6",
|
||||
"stateMutability": "payable",
|
||||
"superFunction": null,
|
||||
"visibility": "external"
|
||||
}
|
||||
],
|
||||
"scope": 1495,
|
||||
"src": "390:901:6"
|
||||
}
|
||||
],
|
||||
"src": "0:1292:6"
|
||||
},
|
||||
"compiler": {
|
||||
"name": "solc",
|
||||
"version": "0.5.8+commit.23d335f2.Emscripten.clang"
|
||||
},
|
||||
"networks": {},
|
||||
"schemaVersion": "3.0.10",
|
||||
"updatedAt": "2019-05-31T13:47:05.362Z",
|
||||
"devdoc": {
|
||||
"author": "Alan Lu - <alan@gnosis.pm>",
|
||||
"methods": {},
|
||||
"title": "Proxied - indicates that a contract will be proxied. Also defines storage requirements for Proxy."
|
||||
},
|
||||
"userdoc": {
|
||||
"methods": {}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
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,19 +1,13 @@
|
|||
// @flow
|
||||
import { fireEvent, cleanup } from '@testing-library/react'
|
||||
import { List } from 'immutable'
|
||||
import { render, fireEvent, cleanup } from '@testing-library/react'
|
||||
import * as fetchBalancesAction from '~/logic/tokens/store/actions/fetchTokens'
|
||||
import { aNewStore } from '~/store'
|
||||
import { aMinedSafe } from '~/test/builder/safe.redux.builder'
|
||||
import { sendTokenTo, sendEtherTo } from '~/test/utils/tokenMovements'
|
||||
import { renderSafeView } from '~/test/builder/safe.dom.utils'
|
||||
import { getWeb3, getBalanceInEtherOf } from '~/logic/wallets/getWeb3'
|
||||
import { dispatchAddTokenToList } from '~/test/utils/transactions/moveTokens.helper'
|
||||
import { sendTokenTo, getFirstTokenContract } from '~/test/utils/tokenMovements'
|
||||
import { EXPAND_BALANCE_INDEX, renderSafeView } from '~/test/builder/safe.dom.utils'
|
||||
import { getWeb3 } from '~/logic/wallets/getWeb3'
|
||||
import { sendMoveTokensForm, dispatchTknBalance } from '~/test/utils/transactions/moveTokens.helper'
|
||||
import { sleep } from '~/utils/timer'
|
||||
import TokenBalanceRecord from '~/routes/safe/store/models/tokenBalance'
|
||||
import { calculateBalanceOf } from '~/routes/safe/store/actions/fetchTokenBalances'
|
||||
import updateActiveTokens from '~/routes/safe/store/actions/updateActiveTokens'
|
||||
import 'jest-dom/extend-expect'
|
||||
import updateSafe from '~/routes/safe/store/actions/updateSafe'
|
||||
import { BALANCE_ROW_TEST_ID } from '~/routes/safe/components/Balances'
|
||||
|
||||
afterEach(cleanup)
|
||||
|
||||
|
@ -23,100 +17,70 @@ describe('DOM > Feature > Funds', () => {
|
|||
let accounts
|
||||
beforeEach(async () => {
|
||||
store = aNewStore()
|
||||
// using 4th account because other accounts were used in other tests and paid gas
|
||||
safeAddress = await aMinedSafe(store)
|
||||
accounts = await getWeb3().eth.getAccounts()
|
||||
})
|
||||
|
||||
it('Sends ETH with threshold = 1', async () => {
|
||||
it('Sends ETH', async () => {
|
||||
// GIVEN
|
||||
const ethAmount = '5'
|
||||
await sendEtherTo(safeAddress, ethAmount)
|
||||
const balanceAfterSendingEthToSafe = await getBalanceInEtherOf(accounts[0])
|
||||
const numTokens = '100'
|
||||
const tokenAddress = await sendTokenTo(safeAddress, numTokens)
|
||||
|
||||
// WHEN
|
||||
const SafeDom = renderSafeView(store, safeAddress)
|
||||
await sleep(1300)
|
||||
|
||||
// Open send funds modal
|
||||
const balanceRows = SafeDom.getAllByTestId(BALANCE_ROW_TEST_ID)
|
||||
expect(balanceRows[0]).toHaveTextContent(`${ethAmount} ETH`)
|
||||
const sendButton = SafeDom.getByTestId('balance-send-btn')
|
||||
fireEvent.click(sendButton)
|
||||
|
||||
// Fill first send funds screen
|
||||
const recipientInput = SafeDom.getByPlaceholderText('Recipient*')
|
||||
const amountInput = SafeDom.getByPlaceholderText('Amount*')
|
||||
const reviewBtn = SafeDom.getByTestId('review-tx-btn')
|
||||
fireEvent.change(recipientInput, { target: { value: accounts[0] } })
|
||||
fireEvent.change(amountInput, { target: { value: ethAmount } })
|
||||
await sleep(200)
|
||||
fireEvent.click(reviewBtn)
|
||||
|
||||
// Submit the tx (Review Tx screen)
|
||||
const submitBtn = SafeDom.getByTestId('submit-tx-btn')
|
||||
fireEvent.click(submitBtn)
|
||||
await sleep(1000)
|
||||
|
||||
// THEN
|
||||
const safeFunds = await getBalanceInEtherOf(safeAddress)
|
||||
expect(Number(safeFunds)).toBe(0)
|
||||
|
||||
const receiverFunds = await getBalanceInEtherOf(accounts[0])
|
||||
const ESTIMATED_GASCOSTS = 0.3
|
||||
expect(Number(parseInt(receiverFunds, 10) - parseInt(balanceAfterSendingEthToSafe, 10))).toBeGreaterThan(
|
||||
parseInt(ethAmount, 10) - ESTIMATED_GASCOSTS,
|
||||
)
|
||||
})
|
||||
|
||||
it('Sends Tokens with threshold = 1', async () => {
|
||||
// GIVEN
|
||||
const tokensAmount = '100'
|
||||
const tokenReceiver = accounts[1]
|
||||
const tokenAddress = await sendTokenTo(safeAddress, tokensAmount)
|
||||
await dispatchAddTokenToList(store, tokenAddress)
|
||||
await dispatchTknBalance(store, tokenAddress, safeAddress)
|
||||
// const StandardToken = await fetchBalancesAction.getStandardTokenContract()
|
||||
// const myToken = await StandardToken.at(tokenAddress)
|
||||
// console.log(await myToken.allowance(safeAddress, accounts[2]))
|
||||
// console.log(await myToken.balanceOf(safeAddress))
|
||||
|
||||
// WHEN
|
||||
const SafeDom = await renderSafeView(store, safeAddress)
|
||||
await sleep(1300)
|
||||
await sleep(800)
|
||||
|
||||
// Activate token
|
||||
const safeTokenBalance = await calculateBalanceOf(tokenAddress, safeAddress, 18)
|
||||
expect(safeTokenBalance).toBe(tokensAmount)
|
||||
|
||||
const balanceAsRecord = TokenBalanceRecord({
|
||||
address: tokenAddress,
|
||||
balance: safeTokenBalance,
|
||||
})
|
||||
store.dispatch(updateActiveTokens(safeAddress, List([tokenAddress])))
|
||||
store.dispatch(updateSafe({ address: safeAddress, balances: List([balanceAsRecord]) }))
|
||||
await sleep(1000)
|
||||
|
||||
// Open send funds modal
|
||||
const balanceRows = SafeDom.getAllByTestId(BALANCE_ROW_TEST_ID)
|
||||
expect(balanceRows.length).toBe(2)
|
||||
const sendButtons = SafeDom.getAllByTestId('balance-send-btn')
|
||||
expect(sendButtons.length).toBe(2)
|
||||
fireEvent.click(sendButtons[1])
|
||||
|
||||
// Fill first send funds screen
|
||||
const recipientInput = SafeDom.getByPlaceholderText('Recipient*')
|
||||
const amountInput = SafeDom.getByPlaceholderText('Amount*')
|
||||
const reviewBtn = SafeDom.getByTestId('review-tx-btn')
|
||||
fireEvent.change(recipientInput, { target: { value: tokenReceiver } })
|
||||
fireEvent.change(amountInput, { target: { value: tokensAmount } })
|
||||
await sleep(200)
|
||||
fireEvent.click(reviewBtn)
|
||||
|
||||
// Submit the tx (Review Tx screen)
|
||||
const submitBtn = SafeDom.getByTestId('submit-tx-btn')
|
||||
fireEvent.click(submitBtn)
|
||||
await sleep(1000)
|
||||
const balanceRows = SafeDom.getAllByTestId('balance-row')
|
||||
const buttons = TestUtils.scryRenderedDOMComponentsWithTag(SafeDom, 'button')
|
||||
const expandBalance = buttons[EXPAND_BALANCE_INDEX]
|
||||
const receiver = accounts[2]
|
||||
await sendMoveTokensForm(SafeDom, expandBalance, 20, accounts[2])
|
||||
|
||||
// THEN
|
||||
const safeFunds = await calculateBalanceOf(tokenAddress, safeAddress, 18)
|
||||
expect(Number(safeFunds)).toBe(0)
|
||||
const receiverFunds = await calculateBalanceOf(tokenAddress, tokenReceiver, 18)
|
||||
expect(receiverFunds).toBe(tokensAmount)
|
||||
const safeFunds = await fetchBalancesAction.calculateBalanceOf(tokenAddress, safeAddress, 18)
|
||||
expect(Number(safeFunds)).toBe(80)
|
||||
const receiverFunds = await fetchBalancesAction.calculateBalanceOf(tokenAddress, receiver, 18)
|
||||
expect(Number(receiverFunds)).toBe(20)
|
||||
|
||||
const token = await getFirstTokenContract(getWeb3(), accounts[0])
|
||||
const nativeSafeFunds = await token.balanceOf(safeAddress)
|
||||
expect(Number(nativeSafeFunds.valueOf())).toEqual(80 * 10 ** 18)
|
||||
})
|
||||
|
||||
it('Sends Tokens', async () => {
|
||||
// GIVEN
|
||||
const numTokens = '100'
|
||||
const tokenAddress = await sendTokenTo(safeAddress, numTokens)
|
||||
|
||||
await dispatchTknBalance(store, tokenAddress, safeAddress)
|
||||
// const StandardToken = await fetchBalancesAction.getStandardTokenContract()
|
||||
// const myToken = await StandardToken.at(tokenAddress)
|
||||
// console.log(await myToken.allowance(safeAddress, accounts[2]))
|
||||
// console.log(await myToken.balanceOf(safeAddress))
|
||||
|
||||
// WHEN
|
||||
const SafeDom = await renderSafeView(store, safeAddress)
|
||||
await sleep(800)
|
||||
// $FlowFixMe
|
||||
const buttons = TestUtils.scryRenderedDOMComponentsWithTag(SafeDom, 'button')
|
||||
const expandBalance = buttons[EXPAND_BALANCE_INDEX]
|
||||
const receiver = accounts[2]
|
||||
await sendMoveTokensForm(SafeDom, expandBalance, 20, accounts[2])
|
||||
|
||||
// THEN
|
||||
const safeFunds = await fetchBalancesAction.calculateBalanceOf(tokenAddress, safeAddress, 18)
|
||||
expect(Number(safeFunds)).toBe(80)
|
||||
const receiverFunds = await fetchBalancesAction.calculateBalanceOf(tokenAddress, receiver, 18)
|
||||
expect(Number(receiverFunds)).toBe(20)
|
||||
|
||||
const token = await getFirstTokenContract(getWeb3(), accounts[0])
|
||||
const nativeSafeFunds = await token.balanceOf(safeAddress)
|
||||
expect(Number(nativeSafeFunds.valueOf())).toEqual(80 * 10 ** 18)
|
||||
})
|
||||
})
|
||||
|
|
|
@ -22,9 +22,7 @@ export const checkBalanceOf = async (addressToTest: string, value: string) => {
|
|||
const createTokenOMGContract = async (web3: any, creator: string) => {
|
||||
const token = contract(TokenOMG)
|
||||
const { toBN } = web3.utils
|
||||
const amount = toBN(50000)
|
||||
.mul(toBN(10).pow(toBN(18)))
|
||||
.toString()
|
||||
const amount = toBN(50000).mul(toBN(10).pow(toBN(18))).toString()
|
||||
token.setProvider(web3.currentProvider)
|
||||
|
||||
return token.new(amount, { from: creator })
|
||||
|
@ -33,9 +31,7 @@ const createTokenOMGContract = async (web3: any, creator: string) => {
|
|||
const createTokenRDNContract = async (web3: any, creator: string) => {
|
||||
const token = contract(TokenRDN)
|
||||
const { toBN } = web3.utils
|
||||
const amount = toBN(50000)
|
||||
.mul(toBN(10).pow(toBN(18)))
|
||||
.toString()
|
||||
const amount = toBN(50000).mul(toBN(10).pow(toBN(18))).toString()
|
||||
token.setProvider(web3.currentProvider)
|
||||
|
||||
return token.new(amount, { from: creator })
|
||||
|
|
|
@ -1294,6 +1294,12 @@
|
|||
resolved "https://registry.yarnpkg.com/@emotion/weak-memoize/-/weak-memoize-0.2.2.tgz#63985d3d8b02530e0869962f4da09142ee8e200e"
|
||||
integrity sha512-n/VQ4mbfr81aqkx/XmVicOLjviMuy02eenSdJY33SVA7S2J42EU0P1H0mOogfYedb3wXA0d/LVtBrgTSm04WEA==
|
||||
|
||||
"@gnosis.pm/mock-contract@github:gnosis/mock-contract#sol_0_5_0":
|
||||
version "2.0.2"
|
||||
resolved "https://codeload.github.com/gnosis/mock-contract/tar.gz/2ec1266eeef1baf7514cdb65b3a3a1aef224f3f2"
|
||||
dependencies:
|
||||
ethereumjs-abi "^0.6.5"
|
||||
|
||||
"@gnosis.pm/safe-contracts@^1.0.0":
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@gnosis.pm/safe-contracts/-/safe-contracts-1.0.0.tgz#2b562b1e23a0da1047a9f38ef71a70f811e75dd9"
|
||||
|
@ -6884,7 +6890,7 @@ ethereumjs-abi@0.6.5:
|
|||
bn.js "^4.10.0"
|
||||
ethereumjs-util "^4.3.0"
|
||||
|
||||
ethereumjs-abi@^0.6.7, "ethereumjs-abi@git+https://github.com/ethereumjs/ethereumjs-abi.git":
|
||||
ethereumjs-abi@^0.6.5, ethereumjs-abi@^0.6.7, "ethereumjs-abi@git+https://github.com/ethereumjs/ethereumjs-abi.git":
|
||||
version "0.6.7"
|
||||
resolved "git+https://github.com/ethereumjs/ethereumjs-abi.git#8431eab7b3384e65e8126a4602520b78031666fb"
|
||||
dependencies:
|
||||
|
|
Loading…
Reference in New Issue