UNPKG

@gooddollar/goodcontracts

Version:
1,185 lines (1,184 loc) 78.4 kB
{ "contractName": "BridgeMock", "abi": [ { "constant": true, "inputs": [], "name": "calledFallback", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "sender", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "value", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "internalType": "address", "name": "_sender", "type": "address" }, { "internalType": "uint256", "name": "_value", "type": "uint256" }, { "internalType": "bytes", "name": "_data", "type": "bytes" } ], "name": "onTokenTransfer", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "internalType": "bytes", "name": "data", "type": "bytes" } ], "name": "parse32BytesToAddress", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[],\"name\":\"calledFallback\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"onTokenTransfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"parse32BytesToAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"sender\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"value\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/hadar/workspace/GoodDollar/GoodBootstrap/packages/contracts/stakingModel/contracts/mocks/BridgeMock.sol\":\"BridgeMock\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/hadar/workspace/GoodDollar/GoodBootstrap/packages/contracts/contracts/token/ERC677/ERC677Receiver.sol\":{\"keccak256\":\"0xc5683b28527097379ed090b28bb46e17a50a2c57ddcb3c7e028fcd04ddc64aef\",\"urls\":[\"bzz-raw://639f6b6cf65382faea738e6326d6aeb289b8b030cf02f40c54bc45ec098eda6d\",\"dweb:/ipfs/QmQi7dFcKiwUxSbzhus4CxFTdNJvUsfiqY6i3bD4RdMQrn\"]},\"/Users/hadar/workspace/GoodDollar/GoodBootstrap/packages/contracts/stakingModel/contracts/mocks/BridgeMock.sol\":{\"keccak256\":\"0xbb30d21edf0aef04233d118c9887d5c0175d281b1923506f1012108637b823fb\",\"urls\":[\"bzz-raw://6935cf1367772a828ed4c13800b55af21055869f9b2a9c1f26b167284f721417\",\"dweb:/ipfs/QmfYeG9FnVRwEN8kx52pJf7mrndftK9t1occyLf17uwS5Q\"]},\"openzeppelin-solidity/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x079c4e23ee448f529e43bfa3c4e8fb4be52cd0318ee923a276835bedf45b93d8\",\"urls\":[\"bzz-raw://ee762ff5b7746e41d27dcbcea00c7a3034b58adb1b45ddadddb5b721aff450df\",\"dweb:/ipfs/QmdxqtgEFZjHCoiYyz6pUAQ5iBm7As25jcyEbZoTaAgyDa\"]}},\"version\":1}", "bytecode": "0x60806040526002805460ff1916905534801561001a57600080fd5b506103508061002a6000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063390f64261461005c5780633fa4f2451461007857806367e404ce1461009257806392111f92146100b6578063a4c0ed361461015c575b600080fd5b6100646101e1565b604080519115158252519081900360200190f35b6100806101ea565b60408051918252519081900360200190f35b61009a6101f0565b604080516001600160a01b039092168252519081900360200190f35b61009a600480360360208110156100cc57600080fd5b8101906020810181356401000000008111156100e757600080fd5b8201836020820111156100f957600080fd5b8035906020019184600183028401116401000000008311171561011b57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506101ff945050505050565b6100646004803603606081101561017257600080fd5b6001600160a01b03823516916020810135918101906060810160408201356401000000008111156101a257600080fd5b8201836020820111156101b457600080fd5b803590602001918460018302840111640100000000831117156101d657600080fd5b50909250905061020d565b60025460ff1681565b60015481565b6000546001600160a01b031681565b60200151600160601b900490565b600080546001600160a01b0319166001600160a01b0386161781556001849055604080516020601f850181900481028201810190925283815261026a9185908590819084018382808284376000920191909152506101ff92505050565b60028054610100600160a81b0319166101006001600160a01b03938416810291909117918290556001546040805163a9059cbb60e01b81529290930490931660048201526024810192909252513391829163a9059cbb916044808201926020929091908290030181600087803b1580156102e357600080fd5b505af11580156102f7573d6000803e3d6000fd5b505050506040513d602081101561030d57600080fd5b50600197965050505050505056fea265627a7a72315820e6b45d2261a72ed3182a4567fdc09764a86c6abf5653acf81332a3d90cfe8b6b64736f6c63430005100032", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c8063390f64261461005c5780633fa4f2451461007857806367e404ce1461009257806392111f92146100b6578063a4c0ed361461015c575b600080fd5b6100646101e1565b604080519115158252519081900360200190f35b6100806101ea565b60408051918252519081900360200190f35b61009a6101f0565b604080516001600160a01b039092168252519081900360200190f35b61009a600480360360208110156100cc57600080fd5b8101906020810181356401000000008111156100e757600080fd5b8201836020820111156100f957600080fd5b8035906020019184600183028401116401000000008311171561011b57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506101ff945050505050565b6100646004803603606081101561017257600080fd5b6001600160a01b03823516916020810135918101906060810160408201356401000000008111156101a257600080fd5b8201836020820111156101b457600080fd5b803590602001918460018302840111640100000000831117156101d657600080fd5b50909250905061020d565b60025460ff1681565b60015481565b6000546001600160a01b031681565b60200151600160601b900490565b600080546001600160a01b0319166001600160a01b0386161781556001849055604080516020601f850181900481028201810190925283815261026a9185908590819084018382808284376000920191909152506101ff92505050565b60028054610100600160a81b0319166101006001600160a01b03938416810291909117918290556001546040805163a9059cbb60e01b81529290930490931660048201526024810192909252513391829163a9059cbb916044808201926020929091908290030181600087803b1580156102e357600080fd5b505af11580156102f7573d6000803e3d6000fd5b505050506040513d602081101561030d57600080fd5b50600197965050505050505056fea265627a7a72315820e6b45d2261a72ed3182a4567fdc09764a86c6abf5653acf81332a3d90cfe8b6b64736f6c63430005100032", "sourceMap": "152:735:41:-;;;250:34;;;-1:-1:-1;;250:34:41;;;152:735;5:2:-1;;;;30:1;27;20:12;5:2;152:735:41;;;;;;;", "deployedSourceMap": "152:735:41:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;152:735:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;250:34;;;:::i;:::-;;;;;;;;;;;;;;;;;;223:20;;;:::i;:::-;;;;;;;;;;;;;;;;196:21;;;:::i;:::-;;;;-1:-1:-1;;;;;196:21:41;;;;;;;;;;;;;;648:237;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;648:237:41;;;;;;;;21:11:-1;5:28;;2:2;;;46:1;43;36:12;2:2;648:237:41;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;648:237:41;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;648:237:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;81:16;;74:27;;;;-1:-1;648:237:41;;-1:-1:-1;648:237:41;;-1:-1:-1;;;;;648:237:41:i;308:334::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;308:334:41;;;;;;;;;;;;;;;;;;;21:11:-1;5:28;;2:2;;;46:1;43;36:12;2:2;308:334:41;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;308:334:41;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;-1:-1;308:334:41;;-1:-1:-1;308:334:41;-1:-1:-1;308:334:41;:::i;250:34::-;;;;;;:::o;223:20::-;;;;:::o;196:21::-;;;-1:-1:-1;;;;;196:21:41;;:::o;648:237::-;811:2;801:13;795:20;-1:-1:-1;;;791:54:41;;;648:237::o;308:334::-;436:4;452:16;;-1:-1:-1;;;;;;452:16:41;-1:-1:-1;;;;;452:16:41;;;;;-1:-1:-1;478:14:41;;;508:28;;;;;;;;;;;;;;;;;;;;;;;;530:5;;508:28;;;;;;530:5;508:28;;530:5;508:28;1:33:-1;99:1;81:16;;74:27;;;;-1:-1;508:21:41;;-1:-1:-1;;;508:28:41:i;:::-;503:2;:33;;-1:-1:-1;;;;;;503:33:41;;-1:-1:-1;;;;;503:33:41;;;;;;;;;;;;;-1:-1:-1;608:5:41;589:25;;;-1:-1:-1;;;589:25:41;;604:2;;;;;;;589:25;;;;;;;;;;;;568:10;;;;589:14;;:25;;;;;;;;;;;;;;;-1:-1:-1;568:10:41;589:25;;;5:2:-1;;;;30:1;27;20:12;5:2;589:25:41;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;589:25:41;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;631:4:41;;308:334;-1:-1:-1;;;;;;;308:334:41:o", "source": "pragma solidity >0.5.4;\n\nimport \"../../../contracts/token/ERC677/ERC677Receiver.sol\";\nimport \"openzeppelin-solidity/contracts/token/ERC20/IERC20.sol\";\n\ncontract BridgeMock is ERC677Receiver {\n address public sender;\n uint256 public value;\n\n bool public calledFallback = false;\n\n address to;\n\n function onTokenTransfer(\n address _sender,\n uint256 _value,\n bytes calldata _data\n ) external returns (bool) {\n sender = _sender;\n value = _value;\n\n to = parse32BytesToAddress(_data);\n IERC20 token = IERC20(msg.sender);\n token.transfer(to, value);\n return true;\n }\n\n function parse32BytesToAddress(bytes memory data) public returns (address) {\n address parsed;\n\n assembly {\n parsed := div(mload(add(data, 32)), 0x1000000000000000000000000)\n }\n\n return parsed;\n }\n}\n", "sourcePath": "/Users/hadar/workspace/GoodDollar/GoodBootstrap/packages/contracts/stakingModel/contracts/mocks/BridgeMock.sol", "ast": { "absolutePath": "/Users/hadar/workspace/GoodDollar/GoodBootstrap/packages/contracts/stakingModel/contracts/mocks/BridgeMock.sol", "exportedSymbols": { "BridgeMock": [ 11620 ] }, "id": 11621, "nodeType": "SourceUnit", "nodes": [ { "id": 11550, "literals": [ "solidity", ">", "0.5", ".4" ], "nodeType": "PragmaDirective", "src": "0:23:41" }, { "absolutePath": "/Users/hadar/workspace/GoodDollar/GoodBootstrap/packages/contracts/contracts/token/ERC677/ERC677Receiver.sol", "file": "../../../contracts/token/ERC677/ERC677Receiver.sol", "id": 11551, "nodeType": "ImportDirective", "scope": 11621, "sourceUnit": 3210, "src": "25:60:41", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol", "file": "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol", "id": 11552, "nodeType": "ImportDirective", "scope": 11621, "sourceUnit": 22138, "src": "86:64:41", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 11553, "name": "ERC677Receiver", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 3209, "src": "175:14:41", "typeDescriptions": { "typeIdentifier": "t_contract$_ERC677Receiver_$3209", "typeString": "contract ERC677Receiver" } }, "id": 11554, "nodeType": "InheritanceSpecifier", "src": "175:14:41" } ], "contractDependencies": [ 3209 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 11620, "linearizedBaseContracts": [ 11620, 3209 ], "name": "BridgeMock", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 11556, "name": "sender", "nodeType": "VariableDeclaration", "scope": 11620, "src": "196:21:41", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 11555, "name": "address", "nodeType": "ElementaryTypeName", "src": "196:7:41", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 11558, "name": "value", "nodeType": "VariableDeclaration", "scope": 11620, "src": "223:20:41", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 11557, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "223:7:41", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 11561, "name": "calledFallback", "nodeType": "VariableDeclaration", "scope": 11620, "src": "250:34:41", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 11559, "name": "bool", "nodeType": "ElementaryTypeName", "src": "250:4:41", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": { "argumentTypes": null, "hexValue": "66616c7365", "id": 11560, "isConstant": false, "isLValue": false, "isPure": true, "kind": "bool", "lValueRequested": false, "nodeType": "Literal", "src": "279:5:41", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "value": "false" }, "visibility": "public" }, { "constant": false, "id": 11563, "name": "to", "nodeType": "VariableDeclaration", "scope": 11620, "src": "291:10:41", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 11562, "name": "address", "nodeType": "ElementaryTypeName", "src": "291:7:41", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "body": { "id": 11604, "nodeType": "Block", "src": "442:200:41", "statements": [ { "expression": { "argumentTypes": null, "id": 11576, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 11574, "name": "sender", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11556, "src": "452:6:41", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 11575, "name": "_sender", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11565, "src": "461:7:41", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "452:16:41", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 11577, "nodeType": "ExpressionStatement", "src": "452:16:41" }, { "expression": { "argumentTypes": null, "id": 11580, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 11578, "name": "value", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11558, "src": "478:5:41", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 11579, "name": "_value", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11567, "src": "486:6:41", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "478:14:41", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 11581, "nodeType": "ExpressionStatement", "src": "478:14:41" }, { "expression": { "argumentTypes": null, "id": 11586, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 11582, "name": "to", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11563, "src": "503:2:41", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 11584, "name": "_data", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11569, "src": "530:5:41", "typeDescriptions": { "typeIdentifier": "t_bytes_calldata_ptr", "typeString": "bytes calldata" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bytes_calldata_ptr", "typeString": "bytes calldata" } ], "id": 11583, "name": "parse32BytesToAddress", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11619, "src": "508:21:41", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_bytes_memory_ptr_$returns$_t_address_$", "typeString": "function (bytes memory) returns (address)" } }, "id": 11585, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "508:28:41", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "503:33:41", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 11587, "nodeType": "ExpressionStatement", "src": "503:33:41" }, { "assignments": [ 11589 ], "declarations": [ { "constant": false, "id": 11589, "name": "token", "nodeType": "VariableDeclaration", "scope": 11604, "src": "546:12:41", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$22137", "typeString": "contract IERC20" }, "typeName": { "contractScope": null, "id": 11588, "name": "IERC20", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 22137, "src": "546:6:41", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$22137", "typeString": "contract IERC20" } }, "value": null, "visibility": "internal" } ], "id": 11594, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 11591, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22171, "src": "568:3:41", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 11592, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "568:10:41", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address_payable", "typeString": "address payable" } ], "id": 11590, "name": "IERC20", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22137, "src": "561:6:41", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_IERC20_$22137_$", "typeString": "type(contract IERC20)" } }, "id": 11593, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "561:18:41", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$22137", "typeString": "contract IERC20" } }, "nodeType": "VariableDeclarationStatement", "src": "546:33:41" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 11598, "name": "to", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11563, "src": "604:2:41", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 11599, "name": "value", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11558, "src": "608:5:41", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "id": 11595, "name": "token", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11589, "src": "589:5:41", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$22137", "typeString": "contract IERC20" } }, "id": 11597, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "transfer", "nodeType": "MemberAccess", "referencedDeclaration": 22079, "src": "589:14:41", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_uint256_$returns$_t_bool_$", "typeString": "function (address,uint256) external returns (bool)" } }, "id": 11600, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "589:25:41", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 11601, "nodeType": "ExpressionStatement", "src": "589:25:41" }, { "expression": { "argumentTypes": null, "hexValue": "74727565", "id": 11602, "isConstant": false, "isLValue": false, "isPure": true, "kind": "bool", "lValueRequested": false, "nodeType": "Literal", "src": "631:4:41", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "value": "true" }, "functionReturnParameters": 11573, "id": 11603, "nodeType": "Return", "src": "624:11:41" } ] }, "documentation": null, "id": 11605, "implemented": true, "kind": "function", "modifiers": [], "name": "onTokenTransfer", "nodeType": "FunctionDefinition", "parameters": { "id": 11570, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 11565, "name": "_sender", "nodeType": "VariableDeclaration", "scope": 11605, "src": "342:15:41", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 11564, "name": "address", "nodeType": "ElementaryTypeName", "src": "342:7:41", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 11567, "name": "_value", "nodeType": "VariableDeclaration", "scope": 11605, "src": "367:14:41", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 11566, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "367:7:41", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 11569, "name": "_data", "nodeType": "VariableDeclaration", "scope": 11605, "src": "391:20:41", "stateVariable": false, "storageLocation": "calldata", "typeDescriptions": { "typeIdentifier": "t_bytes_calldata_ptr", "typeString": "bytes" }, "typeName": { "id": 11568, "name": "bytes", "nodeType": "ElementaryTypeName", "src": "391:5:41", "typeDescriptions": { "typeIdentifier": "t_bytes_storage_ptr", "typeString": "bytes" } }, "value": null, "visibility": "internal" } ], "src": "332:85:41" }, "returnParameters": { "id": 11573, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 11572, "name": "", "nodeType": "VariableDeclaration", "scope": 11605, "src": "436:4:41", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 11571, "name": "bool", "nodeType": "ElementaryTypeName", "src": "436:4:41", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" } ], "src": "435:6:41" }, "scope": 11620, "src": "308:334:41", "stateMutability": "nonpayable", "superFunction": 3208, "visibility": "external" }, { "body": { "id": 11618, "nodeType": "Block", "src": "723:162:41", "statements": [ { "assignments": [ 11613 ], "declarations": [ { "constant": false, "id": 11613, "name": "parsed", "nodeType": "VariableDeclaration", "scope": 11618, "src": "733:14:41", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 11612, "name": "address", "nodeType": "ElementaryTypeName", "src": "733:7:41", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "id": 11614, "initialValue": null, "nodeType": "VariableDeclarationStatement", "src": "733:14:41" }, { "externalReferences": [ { "parsed": { "declaration": 11613, "isOffset": false, "isSlot": false, "src": "781:6:41", "valueSize": 1 } }, { "data": { "declaration": 11607, "isOffset": false, "isSlot": false, "src": "805:4:41", "valueSize": 1 } } ], "id": 11615, "nodeType": "InlineAssembly", "operations": "{\n parsed := div(mload(add(data, 32)), 0x1000000000000000000000000)\n}", "src": "758:97:41" }, { "expression": { "argumentTypes": null, "id": 11616, "name": "parsed", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 11613, "src": "872:6:41", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "functionReturnParameters": 11611, "id": 11617, "nodeType": "Return", "src": "865:13:41" } ] }, "documentation": null, "id": 11619, "implemented": true, "kind": "function", "modifiers": [], "name": "parse32BytesToAddress", "nodeType": "FunctionDefinition", "parameters": { "id": 11608, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 11607, "name": "data", "nodeType": "VariableDeclaration", "scope": 11619, "src": "679:17:41", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes" }, "typeName": { "id": 11606, "name": "bytes", "nodeType": "ElementaryTypeName", "src": "679:5:41", "typeDescriptions": { "typeIdentifier": "t_bytes_storage_ptr", "typeString": "bytes" } }, "value": null, "visibility": "internal" } ], "src": "678:19:41" }, "returnParameters": { "id": 11611, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 11610, "name": "", "nodeType": "VariableDeclaration", "scope": 11619, "src": "714:7:41", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 11609, "name": "address", "nodeType": "ElementaryTypeName", "src": "714:7:41", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "713:9:41" }, "scope": 11620, "src": "648:237:41", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" } ], "scope": 11621, "src": "152:735:41" } ], "src": "0:888:41" }, "legacyAST": { "absolutePath": "/Users/hadar/workspace/GoodDollar/GoodBootstrap/packages/contracts/stakingModel/contracts/mocks/BridgeMock.sol", "exportedSymbols": { "BridgeMock": [ 11620 ] }, "id": 11621, "nodeType": "SourceUnit", "nodes": [ { "id": 11550, "literals": [ "solidity", ">", "0.5", ".4" ], "nodeType": "PragmaDirective", "src": "0:23:41" }, { "absolutePath": "/Users/hadar/workspace/GoodDollar/GoodBootstrap/packages/contracts/contracts/token/ERC677/ERC677Receiver.sol", "file": "../../../contracts/token/ERC677/ERC677Receiver.sol", "id": 11551, "nodeType": "ImportDirective", "scope": 11621, "sourceUnit": 3210, "src": "25:60:41", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol", "file": "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol", "id": 11552, "nodeType": "ImportDirective", "scope": 11621, "sourceUnit": 22138, "src": "86:64:41", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 11553, "name": "ERC677Receiver", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 3209, "src": "175:14:41", "typeDescriptions": { "typeIdentifier": "t_contract$_ERC677Receiver_$3209", "typeString": "contract ERC677Receiver" } }, "id": 11554, "nodeType": "InheritanceSpecifier", "src": "175:14:41" } ], "contractDependencies": [ 3209 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 11620, "linearizedBaseContracts": [ 11620, 3209 ], "name": "BridgeMock", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 11556, "name": "sender", "nodeType": "VariableDeclaration", "scope": 11620, "src": "196:21:41", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 11555, "name": "address", "nodeType": "ElementaryTypeName", "src": "196:7:41", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 11558, "name": "value", "nodeType": "VariableDeclaration", "scope": 11620, "src": "223:20:41", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 11557, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "223:7:41", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 11561, "name": "calledFallback", "nodeType": "VariableDeclaration", "scope": 11620, "src": "250:34:41", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 11559, "name": "bool", "nodeType": "ElementaryTypeName", "src": "250:4:41", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": { "argumentTypes": null, "hexValue": "66616c7365", "id": 11560, "isConstant": false, "isLValue": false, "isPure": true, "kind": "bool", "lValueRequested": false, "nodeType": "Literal", "src": "279:5:41", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool"