├── .editorconfig ├── .gitattributes ├── .github └── FUNDING.yml ├── .gitignore ├── .npmrc ├── .travis.yml ├── CHANGELOG.md ├── LICENSE ├── README.md ├── bin └── ethereum_input_data_decoder ├── cli.js ├── dist ├── index.d.ts └── index.js ├── example ├── bundle.js ├── index.html ├── main.js └── style.css ├── index.d.ts ├── index.js ├── package.json ├── test ├── cli_test.js ├── data │ ├── 0x_exchange.json │ ├── 0x_exchange_data.txt │ ├── 1inch_exchange_v2_abi.json │ ├── 1inch_exchange_v2_abi_no_eth.txt │ ├── 1inch_exchange_v2_abi_with_eth.txt │ ├── PayableProxyForSoloMargin_abi.json │ ├── PayableProxyForSoloMargin_tx_data.txt │ ├── abi1.json │ ├── abi1_input_data.txt │ ├── abi2.json │ ├── abi3.json │ ├── abi3_data.txt │ ├── abi4.json │ ├── abi4_data.txt │ ├── abi5.json │ ├── abi5_data.txt │ ├── abi6.json │ ├── abi6_data.txt │ ├── abi7.json │ ├── abi7_data.txt │ ├── contract_creation_data.txt │ ├── erc721_abi.json │ ├── erc721_transferfrom_tx_data.txt │ ├── set_exchange_issuance_lib.json │ └── set_issuance.txt └── index.js └── tsconfig.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig http://editorconfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | [*] 7 | # use line feed 8 | end_of_line = lf 9 | 10 | # ensure file ends with a newline when saving 11 | insert_final_newline = true 12 | 13 | # soft tabs 14 | indent_style = space 15 | 16 | # number of columns used for each indentation level 17 | indent_size = 2 18 | 19 | # remove any whitespace characters preceding newline characters 20 | trim_trailing_whitespace = true 21 | 22 | # character set 23 | charset = utf-8 24 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Convert line endings to LF (Line Feed) 2 | * text=auto -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [miguelmota] 2 | patreon: miguelmota 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | //this will affect all the git repos 2 | git config --global core.excludesfile ~/.gitignore 3 | 4 | 5 | //update files since .ignore won't if already tracked 6 | git rm --cached 7 | 8 | # Compiled source # 9 | ################### 10 | *.com 11 | *.class 12 | *.dll 13 | *.exe 14 | *.o 15 | *.so 16 | 17 | # Packages # 18 | ############ 19 | # it's better to unpack these files and commit the raw source 20 | # git has its own built in compression methods 21 | *.7z 22 | *.dmg 23 | *.gz 24 | *.iso 25 | *.jar 26 | *.rar 27 | *.tar 28 | *.zip 29 | 30 | # Logs and databases # 31 | ###################### 32 | *.log 33 | *.sql 34 | *.sqlite 35 | 36 | # OS generated files # 37 | ###################### 38 | .DS_Store 39 | .DS_Store? 40 | ._* 41 | .Spotlight-V100 42 | .Trashes 43 | # Icon? 44 | ehthumbs.db 45 | Thumbs.db 46 | .cache 47 | .project 48 | .settings 49 | .tmproj 50 | *.esproj 51 | nbproject 52 | 53 | # Numerous always-ignore extensions # 54 | ##################################### 55 | *.diff 56 | *.err 57 | *.orig 58 | *.rej 59 | *.swn 60 | *.swo 61 | *.swp 62 | *.vi 63 | *~ 64 | *.sass-cache 65 | *.grunt 66 | *.tmp 67 | 68 | # Dreamweaver added files # 69 | ########################### 70 | _notes 71 | dwsync.xml 72 | 73 | # Komodo # 74 | ########################### 75 | *.komodoproject 76 | .komodotools 77 | 78 | # Vim files to ignore # 79 | ####################### 80 | .VimballRecord 81 | .netrwhist 82 | 83 | # Node # 84 | ##################### 85 | node_modules 86 | 87 | # Bower # 88 | ##################### 89 | bower_components 90 | 91 | # Folders to ignore # 92 | ##################### 93 | .hg 94 | .svn 95 | .CVS 96 | intermediate 97 | publish 98 | .idea 99 | .graphics 100 | _test 101 | _archive 102 | uploads 103 | tmp 104 | 105 | # Files to ignore # 106 | ##################### 107 | package-lock.json 108 | yarn.lock 109 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | node_js: 4 | - "10" 5 | 6 | before_script: 7 | - npm install 8 | 9 | script: 10 | - npm test 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | This project adheres to [Semantic Versioning](http://semver.org/). 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT license 2 | 3 | Copyright (C) 2015 Miguel Mota 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | of the Software, and to permit persons to whom the Software is furnished to do 10 | so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 |
3 | logo 4 |
5 |
6 |
7 |

8 | 9 | # ethereum-input-data-decoder 10 | 11 | > Ethereum smart contract transaction input data decoder 12 | 13 | [![License](http://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/miguelmota/ethereum-input-data-decoder/master/LICENSE) 14 | [![Build Status](https://travis-ci.org/miguelmota/ethereum-input-data-decoder.svg?branch=master)](https://travis-ci.org/miguelmota/ethereum-input-data-decoder) 15 | [![dependencies Status](https://david-dm.org/miguelmota/ethereum-input-data-decoder/status.svg)](https://david-dm.org/miguelmota/ethereum-input-data-decoder) 16 | [![NPM version](https://badge.fury.io/js/ethereum-input-data-decoder.svg)](http://badge.fury.io/js/ethereum-input-data-decoder) 17 | [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](#contributing) 18 | 19 | ## Demo 20 | 21 | [https://lab.miguelmota.com/ethereum-input-data-decoder](https://lab.miguelmota.com/ethereum-input-data-decoder) 22 | 23 | ## Install 24 | 25 | ```bash 26 | npm install ethereum-input-data-decoder 27 | ``` 28 | 29 | ## Getting started 30 | 31 | Pass [ABI](https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI) file path to decoder constructor: 32 | 33 | ```javascript 34 | const InputDataDecoder = require('ethereum-input-data-decoder'); 35 | const decoder = new InputDataDecoder(`${__dirname}/abi.json`); 36 | ``` 37 | 38 | Alternatively, you can pass ABI array object to constructor; 39 | 40 | ```javascript 41 | const abi = [{ ... }] 42 | const decoder = new InputDataDecoder(abi); 43 | ``` 44 | 45 | [example abi](./test/abi.json) 46 | 47 | Then you can decode input data: 48 | 49 | ```javascript 50 | const data = `0x67043cae0000000000000000000000005a9dac9315fdd1c3d13ef8af7fdfeb522db08f020000000000000000000000000000000000000000000000000000000058a20230000000000000000000000000000000000000000000000000000000000040293400000000000000000000000000000000000000000000000000000000000000a0f3df64775a2dfb6bc9e09dced96d0816ff5055bf95da13ce5b6c3f53b97071c800000000000000000000000000000000000000000000000000000000000000034254430000000000000000000000000000000000000000000000000000000000`; 51 | 52 | const result = decoder.decodeData(data); 53 | 54 | console.log(result); 55 | ``` 56 | 57 | ```text 58 | { 59 | "method": "registerOffChainDonation", 60 | "types": [ 61 | "address", 62 | "uint256", 63 | "uint256", 64 | "string", 65 | "bytes32" 66 | ], 67 | "inputs": [ 68 | , 69 | , 70 | , 71 | "BTC", 72 | 73 | ], 74 | "names": [ 75 | "addr", 76 | "timestamp", 77 | "chfCents", 78 | "currency", 79 | "memo" 80 | ] 81 | } 82 | ``` 83 | 84 | Example using input response from [web3.getTransaction](https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethgettransaction): 85 | 86 | ```javascript 87 | web3.eth.getTransaction(txHash, (error, txResult) => { 88 | const result = decoder.decodeData(txResult.input); 89 | console.log(result); 90 | }); 91 | ``` 92 | 93 | ### Decoding tuple and tuple[] types 94 | 95 | Where `OrderData` is 96 | 97 | ```solidity 98 | struct OrderData { 99 | uint256 amount; 100 | address buyer; 101 | } 102 | ``` 103 | 104 | Decoding input to a method `someMethod(address,OrderData,OrderData[])` returns data in format 105 | 106 | ```js 107 | { 108 | method: 'someMethod', 109 | types: ['address', '(uint256,address)', '(uint256,address)[]'], 110 | inputs: [ 111 | '0x81c55017F7Ce6E72451cEd49FF7bAB1e3DF64d0C', 112 | [100, '0xA37dE6790861B5541b0dAa7d0C0e651F44c6f4D9'] 113 | [[274, '0xea674fdde714fd979de3edf0f56aa9716b898ec8']] 114 | ], 115 | names: ['sender', ['order', ['amount', 'buyer']], ['allOrders', ['amount', 'buyer']]] 116 | } 117 | ``` 118 | 119 | - In the `types` field, tuples are represented as a string containing types contained in the tuple 120 | - In the `inputs` field, tuples are represented as an array containing values contained in the tuple 121 | - In the `names` field, tuples are represented as an array with 2 items. Item 1 is the name of the tuple, item 2 is an array containing the names of the values contained in the tuple. 122 | 123 | ### Decoding Big Numbers 124 | 125 | All numbers are returned in [big number](https://github.com/indutny/bn.js) format to preserve precision. 126 | 127 | Here's an example of how to convert the big number to a human readable format. 128 | 129 | ```js 130 | console.log(result.inputs[0].toString(10)) // "5" 131 | console.log(result.inputs[0].toNumber()) // 55 132 | ``` 133 | 134 | Please keep in mind that JavaScript only supports numbers up to 64 bits. Solidity numbers can be up to 256 bits, so you run the risk of truncation when casting or having the big number library error out when trying to parse a large number to a JavaScript Number type. 135 | 136 | ```js 137 | const n = new BN("543534254523452352345234523455") 138 | console.log(n.toString(10)) // "543534254523452352345234523455" 139 | console.log(n.toNumber()) // ERROR! 140 | ``` 141 | 142 | ## CLI 143 | 144 | ## Install 145 | 146 | ```bash 147 | npm install -g ethereum-input-data-decoder 148 | ``` 149 | 150 | ### Usage 151 | 152 | ```bash 153 | $ ethereum_input_data_decoder --help 154 | 155 | Ethereum smart contract transaction input data decoder 156 | 157 | Usage 158 | $ ethereum_input_data_decoder [flags] [input] 159 | 160 | Options 161 | --abi, -a ABI file path 162 | --input, -i Input data file path 163 | 164 | Examples 165 | $ ethereum_input_data_decoder --abi token.abi --input data.txt 166 | $ ethereum_input_data_decoder --abi token.abi "0x23b872dd..." 167 | ``` 168 | 169 | ### Example 170 | 171 | Pass ABI file and input data as file: 172 | 173 | ```bash 174 | $ ethereum_input_data_decoder --abi abi.json --input data.tx 175 | 176 | method registerOffChainDonation 177 | 178 | address addr 0x5a9dac9315fdd1c3d13ef8af7fdfeb522db08f02 179 | uint256 timestamp 1487012400 180 | uint256 chfCents 4204852 181 | string currency BTC 182 | bytes32 memo 0xf3df64775a2dfb6bc9e09dced96d0816ff5055bf95da13ce5b6c3f53b97071c8 183 | ``` 184 | 185 | Pass ABI file and input data as string: 186 | 187 | ```bash 188 | $ ethereum_input_data_decoder --abi abi.json 0x67043cae0...000000 189 | 190 | method registerOffChainDonation 191 | 192 | address addr 0x5a9dac9315fdd1c3d13ef8af7fdfeb522db08f02 193 | uint256 timestamp 1487012400 194 | uint256 chfCents 4204852 195 | string currency BTC 196 | bytes32 memo 0xf3df64775a2dfb6bc9e09dced96d0816ff5055bf95da13ce5b6c3f53b97071c8 197 | ``` 198 | 199 | You can also pipe the input data: 200 | 201 | ```bash 202 | $ cat data.txt | ethereum_input_data_decoder --abi abi.json 203 | 204 | method registerOffChainDonation 205 | 206 | address addr 0x5a9dac9315fdd1c3d13ef8af7fdfeb522db08f02 207 | uint256 timestamp 1487012400 208 | uint256 chfCents 4204852 209 | string currency BTC 210 | bytes32 memo 0xf3df64775a2dfb6bc9e09dced96d0816ff5055bf95da13ce5b6c3f53b97071c8 211 | ``` 212 | 213 | ## Test 214 | 215 | ```bash 216 | npm test 217 | ``` 218 | 219 | ## Development 220 | 221 | 1. Clone repository: 222 | 223 | ```bash 224 | git clone git@github.com:miguelmota/ethereum-input-data-decoder.git 225 | 226 | cd ethereum-input-data-decoder/ 227 | ``` 228 | 229 | 2. Install dependencies: 230 | 231 | ```bash 232 | npm install 233 | ``` 234 | 235 | 3. Make changes. 236 | 237 | 4. Run tests: 238 | 239 | ```bash 240 | npm test 241 | ``` 242 | 243 | 5. Run linter: 244 | 245 | ```bash 246 | npm run lint 247 | ``` 248 | 249 | 5. Build: 250 | 251 | ```bash 252 | npm run build 253 | ``` 254 | 255 | ## Contributing 256 | 257 | Pull requests are welcome! 258 | 259 | For contributions please create a new branch and submit a pull request for review. 260 | 261 | Many thanks to all the [contributors](https://github.com/miguelmota/ethereum-input-data-decoder/graphs/contributors) for making this a better library for everyone 🙏 262 | 263 | ## FAQ 264 | 265 | - Q: How can I retrieve the ABI? 266 | 267 | - A: You can generate the ABI from the solidity source files using the [Solidity Compiler](http://solidity.readthedocs.io/en/develop/installing-solidity.html). 268 | 269 | ```bash 270 | solc --abi MyContract.sol -o build 271 | ``` 272 | 273 | - Q: Can this library decode contract creation input data? 274 | 275 | - A: Yes, it can decode contract creation input data. 276 | 277 | - Q: Does this library support ABIEncoderV2? 278 | 279 | - A: Yes, but it's buggy. Please submit a [bug report](https://github.com/miguelmota/ethereum-input-data-decoder/issues/new) if you encounter issues. 280 | 281 | ## License 282 | 283 | [MIT](LICENSE) 284 | -------------------------------------------------------------------------------- /bin/ethereum_input_data_decoder: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require('../cli') 4 | -------------------------------------------------------------------------------- /cli.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const fs = require('fs') 3 | const meow = require('meow') 4 | const BN = require('bn.js') 5 | const InputDataDecoder = require('./') 6 | 7 | const cli = meow(` Usage 8 | $ ethereum_input_data_decoder [flags] [input] 9 | 10 | Options 11 | --abi, -a ABI file path 12 | --input, -i Input data file path 13 | 14 | Examples 15 | $ ethereum_input_data_decoder --abi token.abi --input data.txt 16 | $ ethereum_input_data_decoder --abi token.abi "0x23b872dd..." 17 | `, { 18 | flags: { 19 | abi: { 20 | type: 'string', 21 | alias: 'a' 22 | }, 23 | input: { 24 | type: 'string', 25 | alias: 'i' 26 | } 27 | } 28 | }) 29 | 30 | let { abi, input } = cli.flags 31 | if (cli.input && cli.input.length > 0) { 32 | input = cli.input[0] 33 | run(abi, input) 34 | } else if (input) { 35 | try { 36 | input = fs.readFileSync(path.resolve(input)) 37 | } catch(err) { } 38 | run(abi, input) 39 | } else { 40 | input = '' 41 | process.stdin.setEncoding('utf8') 42 | process.stdin.resume() 43 | process.stdin.on('readable', () => { 44 | let chunk 45 | while ((chunk = process.stdin.read())) { 46 | input += chunk.toString() 47 | } 48 | }) 49 | const t = setTimeout(() => { 50 | process.exit(0) 51 | }, 1e3) 52 | process.stdin.on('end', () => { 53 | clearTimeout(t) 54 | run(abi, input) 55 | }) 56 | } 57 | 58 | function run (abi, input) { 59 | const decoder = new InputDataDecoder(path.resolve(abi)) 60 | const result = decoder.decodeData(input) 61 | 62 | if (result.method === null && result.types.length === 0) { 63 | console.log('No matches') 64 | return 65 | } 66 | 67 | const padType = result.types.reduce((a, x) => Math.max(a, x.length), 0)+2 68 | const padName = result.names.reduce((a, x) => Math.max(a, x.length), 0)+2 69 | 70 | const output = [`${'method'.padEnd(padType)}${result.method}\n`] 71 | for (let i = 0; i < result.types.length; i++) { 72 | let value = result.inputs[i] 73 | if (BN.isBN(value)) { 74 | value = value.toString(10) 75 | } else if (result.types[i] === 'address') { 76 | value = `0x${value}` 77 | } else if (result.types[i] === 'bytes32') { 78 | value = `0x${value.toString('hex')}` 79 | } 80 | 81 | output.push(`${result.types[i].padEnd(padType)}${result.names[i].padEnd(padName)}${value}`) 82 | } 83 | 84 | console.log(output.join('\n')) 85 | } 86 | -------------------------------------------------------------------------------- /dist/index.d.ts: -------------------------------------------------------------------------------- 1 | import Buffer from 'buffer'; 2 | import { Interface } from "ethers/utils"; 3 | 4 | type NestedArray = T | NestedArray[]; 5 | 6 | export interface InputData { 7 | method: string | null; 8 | types: string[]; 9 | inputs: any[]; 10 | names: NestedArray[]; 11 | } 12 | 13 | export default class InputDataDecoder { 14 | constructor(abi: string | Interface['abi']); 15 | 16 | decodeConstructor(data: Buffer | string): InputData; 17 | 18 | decodeData(data: Buffer | string): InputData; 19 | } 20 | -------------------------------------------------------------------------------- /dist/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4 | 5 | function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } 6 | 7 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8 | 9 | var ethers = require('ethers'); 10 | var Buffer = require('buffer/').Buffer; 11 | var isBuffer = require('is-buffer'); 12 | 13 | // TODO: dry up and clean up 14 | // NOTE: this library may be deprecated in future, in favor of ethers v5 AbiCoder. 15 | 16 | var InputDataDecoder = function () { 17 | function InputDataDecoder(prop) { 18 | _classCallCheck(this, InputDataDecoder); 19 | 20 | this.abi = []; 21 | 22 | if (typeof prop === 'string') { 23 | try { 24 | var fs = require('fs'); 25 | this.abi = JSON.parse(fs.readFileSync(prop)); 26 | } catch (err) { 27 | try { 28 | this.abi = JSON.parse(prop); 29 | } catch (err) { 30 | throw new Error('Invalid ABI: ' + err.message); 31 | } 32 | } 33 | } else if (prop instanceof Object) { 34 | this.abi = prop; 35 | } else { 36 | throw new TypeError('Must pass ABI array object or file path to constructor'); 37 | } 38 | } 39 | 40 | _createClass(InputDataDecoder, [{ 41 | key: 'decodeConstructor', 42 | value: function decodeConstructor(data) { 43 | if (isBuffer(data)) { 44 | data = data.toString('utf8'); 45 | } 46 | 47 | if (typeof data !== 'string') { 48 | data = ''; 49 | } 50 | 51 | data = data.trim(); 52 | 53 | for (var i = 0; i < this.abi.length; i++) { 54 | var obj = this.abi[i]; 55 | 56 | if (obj.type !== 'constructor') { 57 | continue; 58 | } 59 | 60 | var method = obj.name || null; 61 | var types = obj.inputs ? obj.inputs.map(function (x) { 62 | return x.type; 63 | }) : []; 64 | var names = obj.inputs ? obj.inputs.map(function (x) { 65 | return x.name; 66 | }) : []; 67 | 68 | // take last 32 bytes 69 | data = data.slice(-256); 70 | 71 | if (data.length !== 256) { 72 | throw new Error('fail'); 73 | } 74 | 75 | if (data.indexOf('0x') !== 0) { 76 | data = '0x' + data; 77 | } 78 | 79 | var inputs = ethers.utils.defaultAbiCoder.decode(types, data); 80 | inputs = deepRemoveUnwantedArrayProperties(inputs); 81 | 82 | return { 83 | method: method, 84 | types: types, 85 | inputs: inputs, 86 | names: names 87 | }; 88 | } 89 | 90 | throw new Error('not found'); 91 | } 92 | }, { 93 | key: 'decodeData', 94 | value: function decodeData(data) { 95 | if (isBuffer(data)) { 96 | data = data.toString('utf8'); 97 | } 98 | 99 | if (typeof data !== 'string') { 100 | data = ''; 101 | } 102 | 103 | data = data.trim(); 104 | 105 | var dataBuf = Buffer.from(data.replace(/^0x/, ''), 'hex'); 106 | var methodId = toHexString(dataBuf.subarray(0, 4)); 107 | var inputsBuf = dataBuf.subarray(4); 108 | 109 | var result = this.abi.reduce(function (acc, obj) { 110 | try { 111 | if (obj.type === 'constructor') { 112 | return acc; 113 | } 114 | if (obj.type === 'event') { 115 | return acc; 116 | } 117 | var method = obj.name || null; 118 | var types = obj.inputs ? obj.inputs.map(function (x) { 119 | if (x.type.includes('tuple')) { 120 | return x; 121 | } else { 122 | return x.type; 123 | } 124 | }) : []; 125 | 126 | var names = obj.inputs ? obj.inputs.map(function (x) { 127 | if (x.type.includes('tuple')) { 128 | return [x.name, x.components.map(function (a) { 129 | return a.name; 130 | })]; 131 | } else { 132 | return x.name; 133 | } 134 | }) : []; 135 | 136 | var hash = genMethodId(method, types); 137 | 138 | if (hash === methodId) { 139 | var inputs = []; 140 | 141 | inputsBuf = normalizeAddresses(types, inputsBuf); 142 | try { 143 | inputs = ethers.utils.defaultAbiCoder.decode(types, inputsBuf); 144 | } catch (err) { 145 | try { 146 | var ifc = new ethers.utils.Interface([]); 147 | inputs = ifc.decodeFunctionData(ethers.utils.FunctionFragment.fromObject(obj), data); 148 | } catch (err) {} 149 | } 150 | 151 | // TODO: do this normalization into normalizeAddresses 152 | inputs = inputs.map(function (input, i) { 153 | if (types[i].components) { 154 | var tupleTypes = types[i].components; 155 | return deepStripTupleAddresses(input, tupleTypes); 156 | } 157 | if (types[i] === 'address') { 158 | return input.split('0x')[1]; 159 | } 160 | if (types[i] === 'address[]') { 161 | return input.map(function (address) { 162 | return address.split('0x')[1]; 163 | }); 164 | } 165 | return input; 166 | }); 167 | 168 | // Map any tuple types into arrays 169 | var typesToReturn = types.map(function (t) { 170 | if (t.components) { 171 | var arr = t.components.reduce(function (acc, cur) { 172 | return [].concat(_toConsumableArray(acc), [cur.type]); 173 | }, []); 174 | var tupleStr = '(' + arr.join(',') + ')'; 175 | if (t.type === 'tuple[]') return tupleStr + '[]'; 176 | return tupleStr; 177 | } 178 | return t; 179 | }); 180 | 181 | // defaultAbiCoder attaches some unwanted properties to the list object 182 | inputs = deepRemoveUnwantedArrayProperties(inputs); 183 | 184 | return { 185 | method: method, 186 | types: typesToReturn, 187 | inputs: inputs, 188 | names: names 189 | }; 190 | } 191 | 192 | return acc; 193 | } catch (err) { 194 | return acc; 195 | } 196 | }, { method: null, types: [], inputs: [], names: [] }); 197 | 198 | if (!result.method) { 199 | this.abi.reduce(function (acc, obj) { 200 | if (obj.type === 'constructor') { 201 | return acc; 202 | } 203 | if (obj.type === 'event') { 204 | return acc; 205 | } 206 | var method = obj.name || null; 207 | 208 | try { 209 | var ifc = new ethers.utils.Interface([]); 210 | var _result = ifc.decodeFunctionData(ethers.utils.FunctionFragment.fromObject(obj), data); 211 | var inputs = deepRemoveUnwantedArrayProperties(_result); 212 | result.method = method; 213 | result.inputs = inputs; 214 | result.names = obj.inputs ? obj.inputs.map(function (x) { 215 | if (x.type.includes('tuple')) { 216 | return [x.name, x.components.map(function (a) { 217 | return a.name; 218 | })]; 219 | } else { 220 | return x.name; 221 | } 222 | }) : []; 223 | var types = obj.inputs ? obj.inputs.map(function (x) { 224 | if (x.type.includes('tuple')) { 225 | return x; 226 | } else { 227 | return x.type; 228 | } 229 | }) : []; 230 | 231 | result.types = types.map(function (t) { 232 | if (t.components) { 233 | var arr = t.components.reduce(function (acc, cur) { 234 | return [].concat(_toConsumableArray(acc), [cur.type]); 235 | }, []); 236 | var tupleStr = '(' + arr.join(',') + ')'; 237 | if (t.type === 'tuple[]') return tupleStr + '[]'; 238 | return tupleStr; 239 | } 240 | return t; 241 | }); 242 | } catch (err) {} 243 | }); 244 | } 245 | 246 | if (!result.method) { 247 | try { 248 | var decoded = this.decodeConstructor(data); 249 | if (decoded) { 250 | return decoded; 251 | } 252 | } catch (err) {} 253 | } 254 | 255 | return result; 256 | } 257 | }]); 258 | 259 | return InputDataDecoder; 260 | }(); 261 | 262 | // remove 0x from addresses 263 | 264 | 265 | function deepStripTupleAddresses(input, tupleTypes) { 266 | return input.map(function (item, i) { 267 | // We find tupleTypes to not be an array where internalType is present in the ABI indicating item is a structure 268 | var type = tupleTypes[i] ? tupleTypes[i].type : null; 269 | 270 | if (type === 'address' && typeof item === 'string') { 271 | return item.split('0x')[1]; 272 | } 273 | if (type === 'address[]' || Array.isArray()) { 274 | return item.map(function (a) { 275 | return a.split('0x')[1]; 276 | }); 277 | } 278 | 279 | if (Array.isArray(item)) { 280 | return deepStripTupleAddresses(item, tupleTypes); 281 | } 282 | 283 | return item; 284 | }); 285 | } 286 | 287 | function deepRemoveUnwantedArrayProperties(arr) { 288 | return [].concat(_toConsumableArray(arr.map(function (item) { 289 | if (Array.isArray(item)) return deepRemoveUnwantedArrayProperties(item); 290 | return item; 291 | }))); 292 | } 293 | 294 | function normalizeAddresses(types, input) { 295 | var offset = 0; 296 | for (var i = 0; i < types.length; i++) { 297 | var type = types[i]; 298 | if (type === 'address') { 299 | input.set(Buffer.alloc(12), offset); 300 | } 301 | 302 | if (isArray(type)) { 303 | var size = parseTypeArray(type); 304 | if (size && size !== 'dynamic') { 305 | offset += 32 * size; 306 | } else { 307 | offset += 32; 308 | } 309 | } else { 310 | offset += 32; 311 | } 312 | } 313 | 314 | return input; 315 | } 316 | 317 | function parseTypeArray(type) { 318 | var tmp = type.match(/(.*)\[(.*?)\]$/); 319 | if (tmp) { 320 | return tmp[2] === '' ? 'dynamic' : parseInt(tmp[2], 10); 321 | } 322 | return null; 323 | } 324 | 325 | function isArray(type) { 326 | return type.lastIndexOf(']') === type.length - 1; 327 | } 328 | 329 | function handleInputs(input, tupleArray) { 330 | if (input instanceof Object && input.components) { 331 | input = input.components; 332 | } 333 | 334 | if (!Array.isArray(input)) { 335 | if (input instanceof Object && input.type) { 336 | return input.type; 337 | } 338 | 339 | return input; 340 | } 341 | 342 | var ret = '(' + input.reduce(function (acc, x) { 343 | if (x.type === 'tuple') { 344 | acc.push(handleInputs(x.components)); 345 | } else if (x.type === 'tuple[]') { 346 | acc.push(handleInputs(x.components) + '[]'); 347 | } else { 348 | acc.push(x.type); 349 | } 350 | return acc; 351 | }, []).join(',') + ')'; 352 | 353 | if (tupleArray) { 354 | return ret + '[]'; 355 | } 356 | 357 | return ret; 358 | } 359 | 360 | function genMethodId(methodName, types) { 361 | var input = methodName + '(' + types.reduce(function (acc, x) { 362 | acc.push(handleInputs(x, x.type === 'tuple[]')); 363 | return acc; 364 | }, []).join(',') + ')'; 365 | 366 | return ethers.utils.keccak256(Buffer.from(input)).slice(2, 10); 367 | } 368 | 369 | function toHexString(byteArray) { 370 | return Array.from(byteArray, function (byte) { 371 | return ('0' + (byte & 0xFF).toString(16)).slice(-2); 372 | }).join(''); 373 | } 374 | 375 | module.exports = InputDataDecoder; -------------------------------------------------------------------------------- /example/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Ethereum input data decoder 8 | 9 | 10 | 11 |

Ethereum input data decoder

12 | 13 |
14 |
15 |
16 | 17 | 1190 |
1191 |
1192 |
1193 | 1194 | 1196 |
1197 |
1198 |
1199 | 1200 |
1201 |
1202 | 1203 | 1204 |
1205 |
1206 |
1207 | 1208 | 1209 | 1210 | Fork me on GitHub 1211 | 1212 | 1213 | 1214 | -------------------------------------------------------------------------------- /example/main.js: -------------------------------------------------------------------------------- 1 | const InputDataDecoder = require('../index'); 2 | 3 | const abiInput = document.querySelector('#abiInput'); 4 | const dataInput = document.querySelector('#dataInput'); 5 | const output = document.querySelector('#output'); 6 | 7 | function decode() { 8 | output.value = '' 9 | 10 | const abi = JSON.parse(abiInput.value.trim()); 11 | const decoder = new InputDataDecoder(abi); 12 | 13 | // if copied and pasted from etherscan only get data we need 14 | const data = dataInput.value.trim() 15 | .replace(/(?:[\s\S]*MethodID: (.*)[\s\S])?[\s\S]?\[\d\]:(.*)/gi, '$1$2') 16 | 17 | dataInput.value = data 18 | 19 | const result = decoder.decodeData(data); 20 | 21 | console.log(result) 22 | 23 | try { 24 | output.value = JSON.stringify(result, null, 2); 25 | } catch(error) { 26 | } 27 | } 28 | 29 | document.querySelector('#decode') 30 | .addEventListener('click', function(event) { 31 | event.preventDefault(); 32 | decode(); 33 | }); 34 | 35 | decode(); 36 | -------------------------------------------------------------------------------- /example/style.css: -------------------------------------------------------------------------------- 1 | .container { 2 | display: flex; 3 | min-width: 728px; 4 | width: 100%; 5 | height: 100%; 6 | } 7 | 8 | .column { 9 | display: inline-block; 10 | width: 30%; 11 | padding: 10px; 12 | } 13 | 14 | .column label { 15 | display: block; 16 | } 17 | 18 | .actions { 19 | height: 20px; 20 | } 21 | 22 | textarea { 23 | width: 100%; 24 | } 25 | 26 | button { 27 | cursor: pointer; 28 | } 29 | -------------------------------------------------------------------------------- /index.d.ts: -------------------------------------------------------------------------------- 1 | import Buffer from 'buffer'; 2 | import { Interface } from "ethers/utils"; 3 | 4 | type NestedArray = T | NestedArray[]; 5 | 6 | export interface InputData { 7 | method: string | null; 8 | types: string[]; 9 | inputs: any[]; 10 | names: NestedArray[]; 11 | } 12 | 13 | export default class InputDataDecoder { 14 | constructor(abi: string | Interface['abi']); 15 | 16 | decodeConstructor(data: Buffer | string): InputData; 17 | 18 | decodeData(data: Buffer | string): InputData; 19 | } 20 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const ethers = require('ethers') 2 | const Buffer = require('buffer/').Buffer 3 | const isBuffer = require('is-buffer') 4 | 5 | // TODO: dry up and clean up 6 | // NOTE: this library may be deprecated in future, in favor of ethers v5 AbiCoder. 7 | 8 | class InputDataDecoder { 9 | constructor (prop) { 10 | this.abi = [] 11 | 12 | if (typeof prop === `string`) { 13 | try { 14 | const fs = require('fs') 15 | this.abi = JSON.parse(fs.readFileSync(prop)) 16 | } catch (err) { 17 | try { 18 | this.abi = JSON.parse(prop) 19 | } catch (err) { 20 | throw new Error(`Invalid ABI: ${err.message}`) 21 | } 22 | } 23 | } else if (prop instanceof Object) { 24 | this.abi = prop 25 | } else { 26 | throw new TypeError(`Must pass ABI array object or file path to constructor`) 27 | } 28 | } 29 | 30 | decodeConstructor (data) { 31 | if (isBuffer(data)) { 32 | data = data.toString('utf8') 33 | } 34 | 35 | if (typeof data !== 'string') { 36 | data = '' 37 | } 38 | 39 | data = data.trim() 40 | 41 | for (let i = 0; i < this.abi.length; i++) { 42 | const obj = this.abi[i] 43 | 44 | if (obj.type !== 'constructor') { 45 | continue 46 | } 47 | 48 | const method = obj.name || null 49 | const types = obj.inputs ? obj.inputs.map(x => x.type) : [] 50 | const names = obj.inputs ? obj.inputs.map(x => x.name) : [] 51 | 52 | // take last 32 bytes 53 | data = data.slice(-256) 54 | 55 | if (data.length !== 256) { 56 | throw new Error('fail') 57 | } 58 | 59 | if (data.indexOf('0x') !== 0) { 60 | data = `0x${data}` 61 | } 62 | 63 | let inputs = ethers.utils.defaultAbiCoder.decode(types, data) 64 | inputs = deepRemoveUnwantedArrayProperties(inputs) 65 | 66 | return { 67 | method, 68 | types, 69 | inputs, 70 | names 71 | } 72 | } 73 | 74 | throw new Error('not found') 75 | } 76 | 77 | decodeData (data) { 78 | if (isBuffer(data)) { 79 | data = data.toString('utf8') 80 | } 81 | 82 | if (typeof data !== 'string') { 83 | data = '' 84 | } 85 | 86 | data = data.trim() 87 | 88 | const dataBuf = Buffer.from(data.replace(/^0x/, ''), 'hex') 89 | const methodId = toHexString(dataBuf.subarray(0, 4)) 90 | let inputsBuf = dataBuf.subarray(4) 91 | 92 | const result = this.abi.reduce((acc, obj) => { 93 | try { 94 | if (obj.type === 'constructor') { 95 | return acc 96 | } 97 | if (obj.type === 'event') { 98 | return acc 99 | } 100 | const method = obj.name || null 101 | let types = obj.inputs ? obj.inputs.map(x => { 102 | if (x.type.includes('tuple')) { 103 | return x 104 | } else { 105 | return x.type 106 | } 107 | }) : [] 108 | 109 | let names = obj.inputs ? obj.inputs.map(x => { 110 | if (x.type.includes('tuple')) { 111 | return [x.name, x.components.map(a => a.name)] 112 | } else { 113 | return x.name 114 | } 115 | }) : [] 116 | 117 | const hash = genMethodId(method, types) 118 | 119 | if (hash === methodId) { 120 | let inputs = [] 121 | 122 | inputsBuf = normalizeAddresses(types, inputsBuf) 123 | try { 124 | inputs = ethers.utils.defaultAbiCoder.decode(types, inputsBuf) 125 | } catch (err) { 126 | try { 127 | const ifc = new ethers.utils.Interface([]) 128 | inputs = ifc.decodeFunctionData(ethers.utils.FunctionFragment.fromObject(obj), data) 129 | } catch (err) {} 130 | } 131 | 132 | // TODO: do this normalization into normalizeAddresses 133 | inputs = inputs.map((input, i) => { 134 | if (types[i].components) { 135 | const tupleTypes = types[i].components 136 | return deepStripTupleAddresses(input, tupleTypes) 137 | } 138 | if (types[i] === 'address') { 139 | return input.split('0x')[1] 140 | } 141 | if (types[i] === 'address[]') { 142 | return input.map(address => address.split('0x')[1]) 143 | } 144 | return input 145 | }) 146 | 147 | // Map any tuple types into arrays 148 | const typesToReturn = types.map(t => { 149 | if (t.components) { 150 | const arr = t.components.reduce((acc, cur) => [...acc, cur.type], []) 151 | const tupleStr = `(${arr.join(',')})` 152 | if (t.type === 'tuple[]') return tupleStr + '[]' 153 | return tupleStr 154 | } 155 | return t 156 | }) 157 | 158 | // defaultAbiCoder attaches some unwanted properties to the list object 159 | inputs = deepRemoveUnwantedArrayProperties(inputs) 160 | 161 | return { 162 | method, 163 | types: typesToReturn, 164 | inputs, 165 | names 166 | } 167 | } 168 | 169 | return acc 170 | } catch (err) { 171 | return acc 172 | } 173 | }, { method: null, types: [], inputs: [], names: [] }) 174 | 175 | if (!result.method) { 176 | this.abi.reduce((acc, obj) => { 177 | if (obj.type === 'constructor') { 178 | return acc 179 | } 180 | if (obj.type === 'event') { 181 | return acc 182 | } 183 | const method = obj.name || null 184 | 185 | try { 186 | const ifc = new ethers.utils.Interface([]) 187 | const _result = ifc.decodeFunctionData(ethers.utils.FunctionFragment.fromObject(obj), data) 188 | let inputs = deepRemoveUnwantedArrayProperties(_result) 189 | result.method = method 190 | result.inputs = inputs 191 | result.names = obj.inputs ? obj.inputs.map(x => { 192 | if (x.type.includes('tuple')) { 193 | return [x.name, x.components.map(a => a.name)] 194 | } else { 195 | return x.name 196 | } 197 | }) : [] 198 | const types = obj.inputs ? obj.inputs.map(x => { 199 | if (x.type.includes('tuple')) { 200 | return x 201 | } else { 202 | return x.type 203 | } 204 | }) : [] 205 | 206 | result.types = types.map(t => { 207 | if (t.components) { 208 | const arr = t.components.reduce((acc, cur) => [...acc, cur.type], []) 209 | const tupleStr = `(${arr.join(',')})` 210 | if (t.type === 'tuple[]') return tupleStr + '[]' 211 | return tupleStr 212 | } 213 | return t 214 | }) 215 | } catch (err) {} 216 | }) 217 | } 218 | 219 | if (!result.method) { 220 | try { 221 | const decoded = this.decodeConstructor(data) 222 | if (decoded) { 223 | return decoded 224 | } 225 | } catch (err) { } 226 | } 227 | 228 | return result 229 | } 230 | } 231 | 232 | // remove 0x from addresses 233 | function deepStripTupleAddresses (input, tupleTypes) { 234 | return input.map((item, i) => { 235 | // We find tupleTypes to not be an array where internalType is present in the ABI indicating item is a structure 236 | const type = tupleTypes[i] ? tupleTypes[i].type : null 237 | 238 | if (type === 'address' && typeof item === 'string') { 239 | return item.split('0x')[1] 240 | } 241 | if (type === 'address[]' || Array.isArray()) { 242 | return item.map(a => a.split('0x')[1]) 243 | } 244 | 245 | if (Array.isArray(item)) { 246 | return deepStripTupleAddresses(item, tupleTypes) 247 | } 248 | 249 | return item 250 | }) 251 | } 252 | 253 | function deepRemoveUnwantedArrayProperties (arr) { 254 | return [...arr.map(item => { 255 | if (Array.isArray(item)) return deepRemoveUnwantedArrayProperties(item) 256 | return item 257 | })] 258 | } 259 | 260 | function normalizeAddresses (types, input) { 261 | let offset = 0 262 | for (let i = 0; i < types.length; i++) { 263 | const type = types[i] 264 | if (type === 'address') { 265 | input.set(Buffer.alloc(12), offset) 266 | } 267 | 268 | if (isArray(type)) { 269 | const size = parseTypeArray(type) 270 | if (size && size !== 'dynamic') { 271 | offset += 32 * size 272 | } else { 273 | offset += 32 274 | } 275 | } else { 276 | offset += 32 277 | } 278 | } 279 | 280 | return input 281 | } 282 | 283 | function parseTypeArray (type) { 284 | const tmp = type.match(/(.*)\[(.*?)\]$/) 285 | if (tmp) { 286 | return tmp[2] === '' ? 'dynamic' : parseInt(tmp[2], 10) 287 | } 288 | return null 289 | } 290 | 291 | function isArray (type) { 292 | return type.lastIndexOf(']') === type.length - 1 293 | } 294 | 295 | function handleInputs (input, tupleArray) { 296 | if (input instanceof Object && input.components) { 297 | input = input.components 298 | } 299 | 300 | if (!Array.isArray(input)) { 301 | if (input instanceof Object && input.type) { 302 | return input.type 303 | } 304 | 305 | return input 306 | } 307 | 308 | let ret = '(' + input.reduce((acc, x) => { 309 | if (x.type === 'tuple') { 310 | acc.push(handleInputs(x.components)) 311 | } else if (x.type === 'tuple[]') { 312 | acc.push(handleInputs(x.components) + '[]') 313 | } else { 314 | acc.push(x.type) 315 | } 316 | return acc 317 | }, []).join(',') + ')' 318 | 319 | if (tupleArray) { 320 | return ret + '[]' 321 | } 322 | 323 | return ret 324 | } 325 | 326 | function genMethodId (methodName, types) { 327 | const input = methodName + '(' + (types.reduce((acc, x) => { 328 | acc.push(handleInputs(x, x.type === 'tuple[]')) 329 | return acc 330 | }, []).join(',')) + ')' 331 | 332 | return ethers.utils.keccak256(Buffer.from(input)).slice(2, 10) 333 | } 334 | 335 | function toHexString (byteArray) { 336 | return Array.from(byteArray, function (byte) { 337 | return ('0' + (byte & 0xFF).toString(16)).slice(-2) 338 | }).join('') 339 | } 340 | 341 | module.exports = InputDataDecoder 342 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ethereum-input-data-decoder", 3 | "version": "0.4.2", 4 | "description": "Ethereum smart contract transaction input data decoder", 5 | "main": "dist/index.js", 6 | "types": "index.d.ts", 7 | "scripts": { 8 | "test": "tape ./test/index.js", 9 | "build:example": "browserify ./example/main.js -o ./example/bundle.js", 10 | "build": "babel index.js --presets babel-preset-es2015 --out-dir dist/", 11 | "lint": "standard --fix index.js test/*.js", 12 | "prepare": "npm run lint && npm run build" 13 | }, 14 | "bin": { 15 | "ethereum-input-data-decoder": "bin/ethereum_input_data_decoder", 16 | "ethereum_input_data_decoder": "bin/ethereum_input_data_decoder" 17 | }, 18 | "repository": { 19 | "type": "git", 20 | "url": "https://github.com/miguelmota/ethereum-input-data-decoder" 21 | }, 22 | "bugs": { 23 | "url": "https://github.com/miguelmota/ethereum-input-data-decoder/issues" 24 | }, 25 | "homepage": "https://github.com/miguelmota/ethereum-input-data-decoder", 26 | "author": { 27 | "name": "Miguel Mota", 28 | "email": "hello@miguelmota.com", 29 | "url": "https://miguelmota.com/" 30 | }, 31 | "license": { 32 | "type": "MIT", 33 | "url": "https://github.com/miguelmota/ethereum-input-data-decoder/blob/master/LICENSE" 34 | }, 35 | "dependencies": { 36 | "@types/node": "^16.7.13", 37 | "bn.js": "^4.11.8", 38 | "buffer": "^5.2.1", 39 | "ethers": "^5.5.4", 40 | "is-buffer": "^2.0.3", 41 | "meow": "9.0.0" 42 | }, 43 | "keywords": [ 44 | "ethereum", 45 | "decoder", 46 | "abi", 47 | "smart", 48 | "contracts" 49 | ], 50 | "devDependencies": { 51 | "babel-cli": "^6.26.0", 52 | "babel-core": "^6.26.3", 53 | "babel-preset-es2015": "^6.24.1", 54 | "babelify": "^8.0.0", 55 | "browserify": "^16.2.3", 56 | "standard": "^12.0.1", 57 | "tape": "^4.6.3" 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /test/cli_test.js: -------------------------------------------------------------------------------- 1 | // cli.js --abi test/data/abi1.json --input test/data/abi1_input_data.txt 2 | -------------------------------------------------------------------------------- /test/data/0x_exchange_data.txt: -------------------------------------------------------------------------------- 1 | 0x7e1d98080000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000002386f26fc1000000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000006f02e6d47147b4448fe2f2eb25b4f534cf110c230000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a258b39954cef5cb142fd567a46cddb31a67012400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000410d586a20a4bffff50000000000000000000000000000000000000000000000005e05647aedbbd45000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005d7872020000000000000000000000000000000000000000000000000000016d1e79ae50000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000024f47261b000000000000000000000000089d24a6b4ccb1b6faa2625fe562bdd9a23260359000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024f47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000421b82e97aa18170e6b81ce3a829d77b7067cf3644c8706e97e7c96d5a92de61eb0c5c5aeb4fbfadca6b9fbc5adff91bfb32964aa9e1bf8309dad7e1bd3e45f0b44c03000000000000000000000000000000000000000000000000000000000000 2 | -------------------------------------------------------------------------------- /test/data/1inch_exchange_v2_abi.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": false, 7 | "internalType": "string", 8 | "name": "reason", 9 | "type": "string" 10 | } 11 | ], 12 | "name": "Error", 13 | "type": "event" 14 | }, 15 | { 16 | "anonymous": false, 17 | "inputs": [ 18 | { 19 | "indexed": true, 20 | "internalType": "address", 21 | "name": "previousOwner", 22 | "type": "address" 23 | }, 24 | { 25 | "indexed": true, 26 | "internalType": "address", 27 | "name": "newOwner", 28 | "type": "address" 29 | } 30 | ], 31 | "name": "OwnershipTransferred", 32 | "type": "event" 33 | }, 34 | { 35 | "anonymous": false, 36 | "inputs": [ 37 | { 38 | "indexed": false, 39 | "internalType": "address", 40 | "name": "account", 41 | "type": "address" 42 | } 43 | ], 44 | "name": "Paused", 45 | "type": "event" 46 | }, 47 | { 48 | "anonymous": false, 49 | "inputs": [ 50 | { 51 | "indexed": true, 52 | "internalType": "address", 53 | "name": "sender", 54 | "type": "address" 55 | }, 56 | { 57 | "indexed": true, 58 | "internalType": "contract IERC20", 59 | "name": "srcToken", 60 | "type": "address" 61 | }, 62 | { 63 | "indexed": true, 64 | "internalType": "contract IERC20", 65 | "name": "dstToken", 66 | "type": "address" 67 | }, 68 | { 69 | "indexed": false, 70 | "internalType": "address", 71 | "name": "dstReceiver", 72 | "type": "address" 73 | }, 74 | { 75 | "indexed": false, 76 | "internalType": "uint256", 77 | "name": "amount", 78 | "type": "uint256" 79 | }, 80 | { 81 | "indexed": false, 82 | "internalType": "uint256", 83 | "name": "spentAmount", 84 | "type": "uint256" 85 | }, 86 | { 87 | "indexed": false, 88 | "internalType": "uint256", 89 | "name": "returnAmount", 90 | "type": "uint256" 91 | }, 92 | { 93 | "indexed": false, 94 | "internalType": "uint256", 95 | "name": "minReturnAmount", 96 | "type": "uint256" 97 | }, 98 | { 99 | "indexed": false, 100 | "internalType": "uint256", 101 | "name": "guaranteedAmount", 102 | "type": "uint256" 103 | }, 104 | { 105 | "indexed": false, 106 | "internalType": "address", 107 | "name": "referrer", 108 | "type": "address" 109 | } 110 | ], 111 | "name": "Swapped", 112 | "type": "event" 113 | }, 114 | { 115 | "anonymous": false, 116 | "inputs": [ 117 | { 118 | "indexed": false, 119 | "internalType": "address", 120 | "name": "account", 121 | "type": "address" 122 | } 123 | ], 124 | "name": "Unpaused", 125 | "type": "event" 126 | }, 127 | { 128 | "inputs": [ 129 | { 130 | "internalType": "contract IOneInchCaller", 131 | "name": "caller", 132 | "type": "address" 133 | }, 134 | { 135 | "components": [ 136 | { 137 | "internalType": "contract IERC20", 138 | "name": "srcToken", 139 | "type": "address" 140 | }, 141 | { 142 | "internalType": "contract IERC20", 143 | "name": "dstToken", 144 | "type": "address" 145 | }, 146 | { 147 | "internalType": "address", 148 | "name": "srcReceiver", 149 | "type": "address" 150 | }, 151 | { 152 | "internalType": "address", 153 | "name": "dstReceiver", 154 | "type": "address" 155 | }, 156 | { 157 | "internalType": "uint256", 158 | "name": "amount", 159 | "type": "uint256" 160 | }, 161 | { 162 | "internalType": "uint256", 163 | "name": "minReturnAmount", 164 | "type": "uint256" 165 | }, 166 | { 167 | "internalType": "uint256", 168 | "name": "guaranteedAmount", 169 | "type": "uint256" 170 | }, 171 | { 172 | "internalType": "uint256", 173 | "name": "flags", 174 | "type": "uint256" 175 | }, 176 | { 177 | "internalType": "address", 178 | "name": "referrer", 179 | "type": "address" 180 | }, 181 | { 182 | "internalType": "bytes", 183 | "name": "permit", 184 | "type": "bytes" 185 | } 186 | ], 187 | "internalType": "struct OneInchExchange.SwapDescription", 188 | "name": "desc", 189 | "type": "tuple" 190 | }, 191 | { 192 | "components": [ 193 | { 194 | "internalType": "uint256", 195 | "name": "targetWithMandatory", 196 | "type": "uint256" 197 | }, 198 | { 199 | "internalType": "uint256", 200 | "name": "gasLimit", 201 | "type": "uint256" 202 | }, 203 | { 204 | "internalType": "uint256", 205 | "name": "value", 206 | "type": "uint256" 207 | }, 208 | { 209 | "internalType": "bytes", 210 | "name": "data", 211 | "type": "bytes" 212 | } 213 | ], 214 | "internalType": "struct IOneInchCaller.CallDescription[]", 215 | "name": "calls", 216 | "type": "tuple[]" 217 | } 218 | ], 219 | "name": "discountedSwap", 220 | "outputs": [ 221 | { 222 | "internalType": "uint256", 223 | "name": "returnAmount", 224 | "type": "uint256" 225 | } 226 | ], 227 | "stateMutability": "payable", 228 | "type": "function" 229 | }, 230 | { 231 | "inputs": [], 232 | "name": "owner", 233 | "outputs": [ 234 | { 235 | "internalType": "address", 236 | "name": "", 237 | "type": "address" 238 | } 239 | ], 240 | "stateMutability": "view", 241 | "type": "function" 242 | }, 243 | { 244 | "inputs": [], 245 | "name": "pause", 246 | "outputs": [], 247 | "stateMutability": "nonpayable", 248 | "type": "function" 249 | }, 250 | { 251 | "inputs": [], 252 | "name": "paused", 253 | "outputs": [ 254 | { 255 | "internalType": "bool", 256 | "name": "", 257 | "type": "bool" 258 | } 259 | ], 260 | "stateMutability": "view", 261 | "type": "function" 262 | }, 263 | { 264 | "inputs": [], 265 | "name": "renounceOwnership", 266 | "outputs": [], 267 | "stateMutability": "nonpayable", 268 | "type": "function" 269 | }, 270 | { 271 | "inputs": [ 272 | { 273 | "internalType": "contract IERC20", 274 | "name": "token", 275 | "type": "address" 276 | }, 277 | { 278 | "internalType": "uint256", 279 | "name": "amount", 280 | "type": "uint256" 281 | } 282 | ], 283 | "name": "rescueFunds", 284 | "outputs": [], 285 | "stateMutability": "nonpayable", 286 | "type": "function" 287 | }, 288 | { 289 | "inputs": [ 290 | { 291 | "internalType": "contract IOneInchCaller", 292 | "name": "caller", 293 | "type": "address" 294 | }, 295 | { 296 | "components": [ 297 | { 298 | "internalType": "contract IERC20", 299 | "name": "srcToken", 300 | "type": "address" 301 | }, 302 | { 303 | "internalType": "contract IERC20", 304 | "name": "dstToken", 305 | "type": "address" 306 | }, 307 | { 308 | "internalType": "address", 309 | "name": "srcReceiver", 310 | "type": "address" 311 | }, 312 | { 313 | "internalType": "address", 314 | "name": "dstReceiver", 315 | "type": "address" 316 | }, 317 | { 318 | "internalType": "uint256", 319 | "name": "amount", 320 | "type": "uint256" 321 | }, 322 | { 323 | "internalType": "uint256", 324 | "name": "minReturnAmount", 325 | "type": "uint256" 326 | }, 327 | { 328 | "internalType": "uint256", 329 | "name": "guaranteedAmount", 330 | "type": "uint256" 331 | }, 332 | { 333 | "internalType": "uint256", 334 | "name": "flags", 335 | "type": "uint256" 336 | }, 337 | { 338 | "internalType": "address", 339 | "name": "referrer", 340 | "type": "address" 341 | }, 342 | { 343 | "internalType": "bytes", 344 | "name": "permit", 345 | "type": "bytes" 346 | } 347 | ], 348 | "internalType": "struct OneInchExchange.SwapDescription", 349 | "name": "desc", 350 | "type": "tuple" 351 | }, 352 | { 353 | "components": [ 354 | { 355 | "internalType": "uint256", 356 | "name": "targetWithMandatory", 357 | "type": "uint256" 358 | }, 359 | { 360 | "internalType": "uint256", 361 | "name": "gasLimit", 362 | "type": "uint256" 363 | }, 364 | { 365 | "internalType": "uint256", 366 | "name": "value", 367 | "type": "uint256" 368 | }, 369 | { 370 | "internalType": "bytes", 371 | "name": "data", 372 | "type": "bytes" 373 | } 374 | ], 375 | "internalType": "struct IOneInchCaller.CallDescription[]", 376 | "name": "calls", 377 | "type": "tuple[]" 378 | } 379 | ], 380 | "name": "swap", 381 | "outputs": [ 382 | { 383 | "internalType": "uint256", 384 | "name": "returnAmount", 385 | "type": "uint256" 386 | } 387 | ], 388 | "stateMutability": "payable", 389 | "type": "function" 390 | }, 391 | { 392 | "inputs": [ 393 | { 394 | "internalType": "address", 395 | "name": "newOwner", 396 | "type": "address" 397 | } 398 | ], 399 | "name": "transferOwnership", 400 | "outputs": [], 401 | "stateMutability": "nonpayable", 402 | "type": "function" 403 | } 404 | ] 405 | -------------------------------------------------------------------------------- /test/data/1inch_exchange_v2_abi_no_eth.txt: -------------------------------------------------------------------------------- 1 | 0x90411a32000000000000000000000000e069cb01d06ba617bcdf789bf2ff0d5e5ca20c71000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000f970b8e36e23f7fc3fd752eea86f8be8d83375a6000000000000000000000000e069cb01d06ba617bcdf789bf2ff0d5e5ca20c710000000000000000000000002c38b7622241958dc0a097d405c468a9176418a30000000000000000000000000000000000000000000000000000000129c8e900000000000000000000000000000000000000000000000b8cfc3e036ef2502538000000000000000000000000000000000000000000000be8703fee6d197a363500000000000000000000000000000000000000000000000000000000000000040000000000000000000000006884249c226f1443f2b7040a3d6143c170df34f600000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000008600000000000000000000000000000000000000000000000000000000000000b8080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000064eb5625d9000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec70000000000000000000000002f9ec37d6ccfff1cab21733bdadede11c823ccb00000000000000000000000000000000000000000000000000000000129c8e900000000000000000000000000000000000000000000000000000000008000000000000000000000002f9ec37d6ccfff1cab21733bdadede11c823ccb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000104c98fefed00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000129c8e9000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000e069cb01d06ba617bcdf789bf2ff0d5e5ca20c710000000000000000000000000000000000000000000000000000000000000003000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec70000000000000000000000005365b5bc56493f08a38e5eb08e36cbbe6fcc83060000000000000000000000001f573d6fb3f13d689ff844b4ce37794d79a7ff1c000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000042483f1291f000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000003c00000000000000000000000001f573d6fb3f13d689ff844b4ce37794d79a7ff1c000000000000000000000000000000500000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000016080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000064eb5625d90000000000000000000000001f573d6fb3f13d689ff844b4ce37794d79a7ff1c0000000000000000000000002f9ec37d6ccfff1cab21733bdadede11c823ccb00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000008000000000000000000000002f9ec37d6ccfff1cab21733bdadede11c823ccb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000104c98fefed000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000e069cb01d06ba617bcdf789bf2ff0d5e5ca20c7100000000000000000000000000000000000000000000000000000000000000030000000000000000000000001f573d6fb3f13d689ff844b4ce37794d79a7ff1c000000000000000000000000f7b9fa01098f22527db205ff9bb6fdf7c7d9f1c5000000000000000000000000f970b8e36e23f7fc3fd752eea86f8be8d83375a60000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000044800000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002647f8fe7a000000000000000000000000000000000000000000000000000000000000000808000000000000000000000000000000000000000000000000000000000000044000000000000000000000000e069cb01d06ba617bcdf789bf2ff0d5e5ca20c7100000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a405971224000000000000000000000000f970b8e36e23f7fc3fd752eea86f8be8d83375a60000000000000000000000006884249c226f1443f2b7040a3d6143c170df34f600000000000000000000000000000000000000000000000000000000000000010000000000000000042b4998f6b3b8f500000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000004df804219786f1d7f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004470bdb947000000000000000000000000f970b8e36e23f7fc3fd752eea86f8be8d83375a6000000000000000000000000000000000000000000000be8703fee6d197a3635000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000184b3af37c000000000000000000000000000000000000000000000000000000000000000808000000000000000000000000000000000000000000000000000000000000024000000000000000000000000f970b8e36e23f7fc3fd752eea86f8be8d83375a60000000000000000000000000000000100000000000000000000000000000001000000000000000000000000f970b8e36e23f7fc3fd752eea86f8be8d83375a60000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000044a9059cbb0000000000000000000000002c38b7622241958dc0a097d405c468a9176418a300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -------------------------------------------------------------------------------- /test/data/1inch_exchange_v2_abi_with_eth.txt: -------------------------------------------------------------------------------- 1 | 0x90411a32000000000000000000000000b3c9669a5706477a2b237d98edb9b57678926f04000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000b3c9669a5706477a2b237d98edb9b57678926f0400000000000000000000000083b97790c7da251fafb24d6cbfc481cfa4afc4f6000000000000000000000000000000000000000000000000000000010642ac00000000000000000000000000000000000000000000000034e551bf0ab692275a000000000000000000000000000000000000000000000035f9ac3b1a9af32d620000000000000000000000000000000000000000000000000000000000000004000000000000000000000000382ffce2287252f930e1c8dc9328dac5bf282ba100000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003c00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000076000000000000000000000000000000000000000000000000000000000000008c00000000000000000000000000000000000000000000000000000000000000be080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000064eb5625d9000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000002f9ec37d6ccfff1cab21733bdadede11c823ccb0000000000000000000000000000000000000000000000000000000010642ac00000000000000000000000000000000000000000000000000000000008000000000000000000000002f9ec37d6ccfff1cab21733bdadede11c823ccb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000104c98fefed0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000010642ac000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000b3c9669a5706477a2b237d98edb9b57678926f040000000000000000000000000000000000000000000000000000000000000003000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000874d8de5b26c9d9f6aa8d7bab283f9a9c6f777f40000000000000000000000001f573d6fb3f13d689ff844b4ce37794d79a7ff1c0000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000184b3af37c0000000000000000000000000000000000000000000000000000000000000008080000000000000000000000000000000000000000000000000000000000000240000000000000000000000001f573d6fb3f13d689ff844b4ce37794d79a7ff1c00000000000000000000000000000014000000000000000000000000000000140000000000000000000000001f573d6fb3f13d689ff844b4ce37794d79a7ff1c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000044a9059cbb0000000000000000000000003fd4cf9303c4bc9e13772618828712c8eac7dd2f00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a4c9f12e9d0000000000000000000000003fd4cf9303c4bc9e13772618828712c8eac7dd2f0000000000000000000000001f573d6fb3f13d689ff844b4ce37794d79a7ff1c000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000326aad2da94c59524ac0d93f6d6cbf9071d7086f2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a4c9f12e9d00000000000000000000000026aad2da94c59524ac0d93f6d6cbf9071d7086f2000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000003b3c9669a5706477a2b237d98edb9b57678926f04000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002647f8fe7a000000000000000000000000000000000000000000000000000000000000000808000000000000000000000000000000000000000000000000000000000000044000000000000000000000000b3c9669a5706477a2b237d98edb9b57678926f0400000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a405971224000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000382ffce2287252f930e1c8dc9328dac5bf282ba10000000000000000000000000000000000000000000000000000000000000001000000000000000002b79a9b4d8a5c9300000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000fbc539a31bdf05000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004470bdb947000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000000000000000000000000035f9ac3b1a9af32d620000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001a4b3af37c000000000000000000000000000000000000000000000000000000000000000808000000000000000000000000000000000000000000000000000000000000044000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000000000010000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000064d1660f99000000000000000000000000111111111117dc0aa78b770fa6a738034120c30200000000000000000000000083b97790c7da251fafb24d6cbfc481cfa4afc4f600000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -------------------------------------------------------------------------------- /test/data/PayableProxyForSoloMargin_abi.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "constant": true, 4 | "inputs": [], 5 | "name": "SOLO_MARGIN", 6 | "outputs": [ 7 | { 8 | "name": "", 9 | "type": "address" 10 | } 11 | ], 12 | "payable": false, 13 | "stateMutability": "view", 14 | "type": "function" 15 | }, 16 | { 17 | "constant": true, 18 | "inputs": [], 19 | "name": "WETH", 20 | "outputs": [ 21 | { 22 | "name": "", 23 | "type": "address" 24 | } 25 | ], 26 | "payable": false, 27 | "stateMutability": "view", 28 | "type": "function" 29 | }, 30 | { 31 | "constant": false, 32 | "inputs": [ 33 | { 34 | "components": [ 35 | { 36 | "name": "owner", 37 | "type": "address" 38 | }, 39 | { 40 | "name": "number", 41 | "type": "uint256" 42 | } 43 | ], 44 | "name": "accounts", 45 | "type": "tuple[]" 46 | }, 47 | { 48 | "components": [ 49 | { 50 | "name": "actionType", 51 | "type": "uint8" 52 | }, 53 | { 54 | "name": "accountId", 55 | "type": "uint256" 56 | }, 57 | { 58 | "components": [ 59 | { 60 | "name": "sign", 61 | "type": "bool" 62 | }, 63 | { 64 | "name": "denomination", 65 | "type": "uint8" 66 | }, 67 | { 68 | "name": "ref", 69 | "type": "uint8" 70 | }, 71 | { 72 | "name": "value", 73 | "type": "uint256" 74 | } 75 | ], 76 | "name": "amount", 77 | "type": "tuple" 78 | }, 79 | { 80 | "name": "primaryMarketId", 81 | "type": "uint256" 82 | }, 83 | { 84 | "name": "secondaryMarketId", 85 | "type": "uint256" 86 | }, 87 | { 88 | "name": "otherAddress", 89 | "type": "address" 90 | }, 91 | { 92 | "name": "otherAccountId", 93 | "type": "uint256" 94 | }, 95 | { 96 | "name": "data", 97 | "type": "bytes" 98 | } 99 | ], 100 | "name": "actions", 101 | "type": "tuple[]" 102 | }, 103 | { 104 | "name": "sendEthTo", 105 | "type": "address" 106 | } 107 | ], 108 | "name": "operate", 109 | "outputs": [], 110 | "payable": true, 111 | "stateMutability": "payable", 112 | "type": "function" 113 | }, 114 | { 115 | "inputs": [ 116 | { 117 | "name": "soloMargin", 118 | "type": "address" 119 | }, 120 | { 121 | "name": "weth", 122 | "type": "address" 123 | } 124 | ], 125 | "payable": false, 126 | "stateMutability": "nonpayable", 127 | "type": "constructor" 128 | }, 129 | { 130 | "payable": true, 131 | "stateMutability": "payable", 132 | "type": "fallback" 133 | } 134 | ] 135 | -------------------------------------------------------------------------------- /test/data/PayableProxyForSoloMargin_tx_data.txt: -------------------------------------------------------------------------------- 1 | 0xf319142a000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000b929044af6a7b7ae12ef0e653acc59f73cf9577b0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000b929044af6a7b7ae12ef0e653acc59f73cf9577b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006c46038fa803f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a8b39829ce2246f89b31c013b8cde15506fb9a76000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000000 -------------------------------------------------------------------------------- /test/data/abi1.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "constant": false, 4 | "inputs": [ 5 | { 6 | "name": "newAddr", 7 | "type": "address" 8 | } 9 | ], 10 | "name": "setFoundationWallet", 11 | "outputs": [], 12 | "payable": false, 13 | "type": "function" 14 | }, 15 | { 16 | "constant": true, 17 | "inputs": [], 18 | "name": "name", 19 | "outputs": [ 20 | { 21 | "name": "", 22 | "type": "string" 23 | } 24 | ], 25 | "payable": false, 26 | "type": "function" 27 | }, 28 | { 29 | "constant": true, 30 | "inputs": [], 31 | "name": "totalUnrestrictedAssignments", 32 | "outputs": [ 33 | { 34 | "name": "", 35 | "type": "uint256" 36 | } 37 | ], 38 | "payable": false, 39 | "type": "function" 40 | }, 41 | { 42 | "constant": true, 43 | "inputs": [], 44 | "name": "getState", 45 | "outputs": [ 46 | { 47 | "name": "", 48 | "type": "uint8" 49 | } 50 | ], 51 | "payable": false, 52 | "type": "function" 53 | }, 54 | { 55 | "constant": true, 56 | "inputs": [], 57 | "name": "round0StartTime", 58 | "outputs": [ 59 | { 60 | "name": "", 61 | "type": "uint256" 62 | } 63 | ], 64 | "payable": false, 65 | "type": "function" 66 | }, 67 | { 68 | "constant": true, 69 | "inputs": [], 70 | "name": "round0Target", 71 | "outputs": [ 72 | { 73 | "name": "", 74 | "type": "uint256" 75 | } 76 | ], 77 | "payable": false, 78 | "type": "function" 79 | }, 80 | { 81 | "constant": true, 82 | "inputs": [], 83 | "name": "minDonation", 84 | "outputs": [ 85 | { 86 | "name": "", 87 | "type": "uint256" 88 | } 89 | ], 90 | "payable": false, 91 | "type": "function" 92 | }, 93 | { 94 | "constant": true, 95 | "inputs": [ 96 | { 97 | "name": "", 98 | "type": "address" 99 | } 100 | ], 101 | "name": "weiDonated", 102 | "outputs": [ 103 | { 104 | "name": "", 105 | "type": "uint256" 106 | } 107 | ], 108 | "payable": false, 109 | "type": "function" 110 | }, 111 | { 112 | "constant": false, 113 | "inputs": [ 114 | { 115 | "name": "x", 116 | "type": "uint256" 117 | }, 118 | { 119 | "name": "a", 120 | "type": "uint256" 121 | }, 122 | { 123 | "name": "b", 124 | "type": "uint256" 125 | } 126 | ], 127 | "name": "multFracCeiling", 128 | "outputs": [ 129 | { 130 | "name": "", 131 | "type": "uint256" 132 | } 133 | ], 134 | "payable": false, 135 | "type": "function" 136 | }, 137 | { 138 | "constant": true, 139 | "inputs": [], 140 | "name": "totalRestrictedTokens", 141 | "outputs": [ 142 | { 143 | "name": "", 144 | "type": "uint256" 145 | } 146 | ], 147 | "payable": false, 148 | "type": "function" 149 | }, 150 | { 151 | "constant": true, 152 | "inputs": [], 153 | "name": "round1BonusSteps", 154 | "outputs": [ 155 | { 156 | "name": "", 157 | "type": "uint256" 158 | } 159 | ], 160 | "payable": false, 161 | "type": "function" 162 | }, 163 | { 164 | "constant": false, 165 | "inputs": [ 166 | { 167 | "name": "newAuth", 168 | "type": "address" 169 | } 170 | ], 171 | "name": "setExchangeRateAuth", 172 | "outputs": [], 173 | "payable": false, 174 | "type": "function" 175 | }, 176 | { 177 | "constant": true, 178 | "inputs": [], 179 | "name": "round1StartTime", 180 | "outputs": [ 181 | { 182 | "name": "", 183 | "type": "uint256" 184 | } 185 | ], 186 | "payable": false, 187 | "type": "function" 188 | }, 189 | { 190 | "constant": true, 191 | "inputs": [], 192 | "name": "round1EndTime", 193 | "outputs": [ 194 | { 195 | "name": "", 196 | "type": "uint256" 197 | } 198 | ], 199 | "payable": false, 200 | "type": "function" 201 | }, 202 | { 203 | "constant": true, 204 | "inputs": [], 205 | "name": "maxRoundDelay", 206 | "outputs": [ 207 | { 208 | "name": "", 209 | "type": "uint256" 210 | } 211 | ], 212 | "payable": false, 213 | "type": "function" 214 | }, 215 | { 216 | "constant": true, 217 | "inputs": [ 218 | { 219 | "name": "n", 220 | "type": "uint256" 221 | } 222 | ], 223 | "name": "getPhaseStartTime", 224 | "outputs": [ 225 | { 226 | "name": "", 227 | "type": "uint256" 228 | } 229 | ], 230 | "payable": false, 231 | "type": "function" 232 | }, 233 | { 234 | "constant": true, 235 | "inputs": [ 236 | { 237 | "name": "time", 238 | "type": "uint256" 239 | } 240 | ], 241 | "name": "getMultiplierAtTime", 242 | "outputs": [ 243 | { 244 | "name": "", 245 | "type": "uint256" 246 | } 247 | ], 248 | "payable": false, 249 | "type": "function" 250 | }, 251 | { 252 | "constant": true, 253 | "inputs": [ 254 | { 255 | "name": "id", 256 | "type": "uint256" 257 | } 258 | ], 259 | "name": "targetReached", 260 | "outputs": [ 261 | { 262 | "name": "", 263 | "type": "bool" 264 | } 265 | ], 266 | "payable": false, 267 | "type": "function" 268 | }, 269 | { 270 | "constant": false, 271 | "inputs": [ 272 | { 273 | "name": "addr", 274 | "type": "address" 275 | } 276 | ], 277 | "name": "finalize", 278 | "outputs": [], 279 | "payable": false, 280 | "type": "function" 281 | }, 282 | { 283 | "constant": true, 284 | "inputs": [], 285 | "name": "assignmentsClosed", 286 | "outputs": [ 287 | { 288 | "name": "", 289 | "type": "bool" 290 | } 291 | ], 292 | "payable": false, 293 | "type": "function" 294 | }, 295 | { 296 | "constant": true, 297 | "inputs": [ 298 | { 299 | "name": "", 300 | "type": "uint256" 301 | } 302 | ], 303 | "name": "donorList", 304 | "outputs": [ 305 | { 306 | "name": "", 307 | "type": "address" 308 | } 309 | ], 310 | "payable": false, 311 | "type": "function" 312 | }, 313 | { 314 | "constant": true, 315 | "inputs": [], 316 | "name": "phaseLength", 317 | "outputs": [ 318 | { 319 | "name": "", 320 | "type": "uint256" 321 | } 322 | ], 323 | "payable": false, 324 | "type": "function" 325 | }, 326 | { 327 | "constant": false, 328 | "inputs": [ 329 | { 330 | "name": "addr", 331 | "type": "address" 332 | }, 333 | { 334 | "name": "timestamp", 335 | "type": "uint256" 336 | }, 337 | { 338 | "name": "chfCents", 339 | "type": "uint256" 340 | }, 341 | { 342 | "name": "currency", 343 | "type": "string" 344 | }, 345 | { 346 | "name": "memo", 347 | "type": "bytes32" 348 | } 349 | ], 350 | "name": "registerOffChainDonation", 351 | "outputs": [], 352 | "payable": false, 353 | "type": "function" 354 | }, 355 | { 356 | "constant": true, 357 | "inputs": [], 358 | "name": "gracePeriodAfterRound1Target", 359 | "outputs": [ 360 | { 361 | "name": "", 362 | "type": "uint256" 363 | } 364 | ], 365 | "payable": false, 366 | "type": "function" 367 | }, 368 | { 369 | "constant": true, 370 | "inputs": [], 371 | "name": "totalRestrictedAssignments", 372 | "outputs": [ 373 | { 374 | "name": "", 375 | "type": "uint256" 376 | } 377 | ], 378 | "payable": false, 379 | "type": "function" 380 | }, 381 | { 382 | "constant": true, 383 | "inputs": [], 384 | "name": "burnMultNom", 385 | "outputs": [ 386 | { 387 | "name": "", 388 | "type": "uint256" 389 | } 390 | ], 391 | "payable": false, 392 | "type": "function" 393 | }, 394 | { 395 | "constant": true, 396 | "inputs": [], 397 | "name": "foundationWallet", 398 | "outputs": [ 399 | { 400 | "name": "", 401 | "type": "address" 402 | } 403 | ], 404 | "payable": false, 405 | "type": "function" 406 | }, 407 | { 408 | "constant": true, 409 | "inputs": [], 410 | "name": "gracePeriodAfterRound0Target", 411 | "outputs": [ 412 | { 413 | "name": "", 414 | "type": "uint256" 415 | } 416 | ], 417 | "payable": false, 418 | "type": "function" 419 | }, 420 | { 421 | "constant": true, 422 | "inputs": [], 423 | "name": "finalizeStartTime", 424 | "outputs": [ 425 | { 426 | "name": "", 427 | "type": "uint256" 428 | } 429 | ], 430 | "payable": false, 431 | "type": "function" 432 | }, 433 | { 434 | "constant": true, 435 | "inputs": [], 436 | "name": "finalizeEndTime", 437 | "outputs": [ 438 | { 439 | "name": "", 440 | "type": "uint256" 441 | } 442 | ], 443 | "payable": false, 444 | "type": "function" 445 | }, 446 | { 447 | "constant": true, 448 | "inputs": [ 449 | { 450 | "name": "donationRound", 451 | "type": "uint256" 452 | }, 453 | { 454 | "name": "dfnAddr", 455 | "type": "address" 456 | }, 457 | { 458 | "name": "fwdAddr", 459 | "type": "address" 460 | } 461 | ], 462 | "name": "getStatus", 463 | "outputs": [ 464 | { 465 | "name": "currentState", 466 | "type": "uint8" 467 | }, 468 | { 469 | "name": "fxRate", 470 | "type": "uint256" 471 | }, 472 | { 473 | "name": "currentMultiplier", 474 | "type": "uint256" 475 | }, 476 | { 477 | "name": "donationCount", 478 | "type": "uint256" 479 | }, 480 | { 481 | "name": "totalTokenAmount", 482 | "type": "uint256" 483 | }, 484 | { 485 | "name": "startTime", 486 | "type": "uint256" 487 | }, 488 | { 489 | "name": "endTime", 490 | "type": "uint256" 491 | }, 492 | { 493 | "name": "isTargetReached", 494 | "type": "bool" 495 | }, 496 | { 497 | "name": "chfCentsDonated", 498 | "type": "uint256" 499 | }, 500 | { 501 | "name": "tokenAmount", 502 | "type": "uint256" 503 | }, 504 | { 505 | "name": "fwdBalance", 506 | "type": "uint256" 507 | }, 508 | { 509 | "name": "donated", 510 | "type": "uint256" 511 | } 512 | ], 513 | "payable": false, 514 | "type": "function" 515 | }, 516 | { 517 | "constant": true, 518 | "inputs": [], 519 | "name": "burnMultDen", 520 | "outputs": [ 521 | { 522 | "name": "", 523 | "type": "uint256" 524 | } 525 | ], 526 | "payable": false, 527 | "type": "function" 528 | }, 529 | { 530 | "constant": false, 531 | "inputs": [ 532 | { 533 | "name": "donPhase", 534 | "type": "uint256" 535 | }, 536 | { 537 | "name": "timedelta", 538 | "type": "uint256" 539 | } 540 | ], 541 | "name": "delayDonPhase", 542 | "outputs": [], 543 | "payable": false, 544 | "type": "function" 545 | }, 546 | { 547 | "constant": true, 548 | "inputs": [], 549 | "name": "round1Target", 550 | "outputs": [ 551 | { 552 | "name": "", 553 | "type": "uint256" 554 | } 555 | ], 556 | "payable": false, 557 | "type": "function" 558 | }, 559 | { 560 | "constant": true, 561 | "inputs": [ 562 | { 563 | "name": "", 564 | "type": "uint256" 565 | } 566 | ], 567 | "name": "earlyContribList", 568 | "outputs": [ 569 | { 570 | "name": "", 571 | "type": "address" 572 | } 573 | ], 574 | "payable": false, 575 | "type": "function" 576 | }, 577 | { 578 | "constant": true, 579 | "inputs": [], 580 | "name": "round0EndTime", 581 | "outputs": [ 582 | { 583 | "name": "", 584 | "type": "uint256" 585 | } 586 | ], 587 | "payable": false, 588 | "type": "function" 589 | }, 590 | { 591 | "constant": true, 592 | "inputs": [], 593 | "name": "isUnrestricted", 594 | "outputs": [ 595 | { 596 | "name": "", 597 | "type": "bool" 598 | } 599 | ], 600 | "payable": false, 601 | "type": "function" 602 | }, 603 | { 604 | "constant": true, 605 | "inputs": [ 606 | { 607 | "name": "", 608 | "type": "address" 609 | } 610 | ], 611 | "name": "restrictions", 612 | "outputs": [ 613 | { 614 | "name": "", 615 | "type": "uint256" 616 | } 617 | ], 618 | "payable": false, 619 | "type": "function" 620 | }, 621 | { 622 | "constant": true, 623 | "inputs": [], 624 | "name": "earlyContribShare", 625 | "outputs": [ 626 | { 627 | "name": "", 628 | "type": "uint256" 629 | } 630 | ], 631 | "payable": false, 632 | "type": "function" 633 | }, 634 | { 635 | "constant": true, 636 | "inputs": [ 637 | { 638 | "name": "", 639 | "type": "uint256" 640 | } 641 | ], 642 | "name": "target", 643 | "outputs": [ 644 | { 645 | "name": "", 646 | "type": "uint256" 647 | } 648 | ], 649 | "payable": false, 650 | "type": "function" 651 | }, 652 | { 653 | "constant": false, 654 | "inputs": [ 655 | { 656 | "name": "newAuth", 657 | "type": "address" 658 | } 659 | ], 660 | "name": "setRegistrarAuth", 661 | "outputs": [], 662 | "payable": false, 663 | "type": "function" 664 | }, 665 | { 666 | "constant": true, 667 | "inputs": [], 668 | "name": "totalUnrestrictedTokens", 669 | "outputs": [ 670 | { 671 | "name": "", 672 | "type": "uint256" 673 | } 674 | ], 675 | "payable": false, 676 | "type": "function" 677 | }, 678 | { 679 | "constant": true, 680 | "inputs": [], 681 | "name": "weiPerCHF", 682 | "outputs": [ 683 | { 684 | "name": "", 685 | "type": "uint256" 686 | } 687 | ], 688 | "payable": false, 689 | "type": "function" 690 | }, 691 | { 692 | "constant": true, 693 | "inputs": [ 694 | { 695 | "name": "elapsedTime", 696 | "type": "uint256" 697 | } 698 | ], 699 | "name": "getStepFunction", 700 | "outputs": [ 701 | { 702 | "name": "", 703 | "type": "uint256" 704 | } 705 | ], 706 | "payable": false, 707 | "type": "function" 708 | }, 709 | { 710 | "constant": true, 711 | "inputs": [], 712 | "name": "exchangeRateAuth", 713 | "outputs": [ 714 | { 715 | "name": "", 716 | "type": "address" 717 | } 718 | ], 719 | "payable": false, 720 | "type": "function" 721 | }, 722 | { 723 | "constant": true, 724 | "inputs": [ 725 | { 726 | "name": "", 727 | "type": "uint256" 728 | } 729 | ], 730 | "name": "counter", 731 | "outputs": [ 732 | { 733 | "name": "", 734 | "type": "uint256" 735 | } 736 | ], 737 | "payable": false, 738 | "type": "function" 739 | }, 740 | { 741 | "constant": true, 742 | "inputs": [], 743 | "name": "masterAuth", 744 | "outputs": [ 745 | { 746 | "name": "", 747 | "type": "address" 748 | } 749 | ], 750 | "payable": false, 751 | "type": "function" 752 | }, 753 | { 754 | "constant": true, 755 | "inputs": [ 756 | { 757 | "name": "time", 758 | "type": "uint256" 759 | }, 760 | { 761 | "name": "n", 762 | "type": "uint256" 763 | } 764 | ], 765 | "name": "isPhase", 766 | "outputs": [ 767 | { 768 | "name": "", 769 | "type": "bool" 770 | } 771 | ], 772 | "payable": false, 773 | "type": "function" 774 | }, 775 | { 776 | "constant": true, 777 | "inputs": [], 778 | "name": "registrarAuth", 779 | "outputs": [ 780 | { 781 | "name": "", 782 | "type": "address" 783 | } 784 | ], 785 | "payable": false, 786 | "type": "function" 787 | }, 788 | { 789 | "constant": true, 790 | "inputs": [], 791 | "name": "restrictedShare", 792 | "outputs": [ 793 | { 794 | "name": "", 795 | "type": "uint256" 796 | } 797 | ], 798 | "payable": false, 799 | "type": "function" 800 | }, 801 | { 802 | "constant": true, 803 | "inputs": [], 804 | "name": "tokensPerCHF", 805 | "outputs": [ 806 | { 807 | "name": "", 808 | "type": "uint256" 809 | } 810 | ], 811 | "payable": false, 812 | "type": "function" 813 | }, 814 | { 815 | "constant": true, 816 | "inputs": [], 817 | "name": "round1InitialBonus", 818 | "outputs": [ 819 | { 820 | "name": "", 821 | "type": "uint256" 822 | } 823 | ], 824 | "payable": false, 825 | "type": "function" 826 | }, 827 | { 828 | "constant": false, 829 | "inputs": [ 830 | { 831 | "name": "weis", 832 | "type": "uint256" 833 | } 834 | ], 835 | "name": "setWeiPerCHF", 836 | "outputs": [], 837 | "payable": false, 838 | "type": "function" 839 | }, 840 | { 841 | "constant": true, 842 | "inputs": [], 843 | "name": "N", 844 | "outputs": [ 845 | { 846 | "name": "", 847 | "type": "uint256" 848 | } 849 | ], 850 | "payable": false, 851 | "type": "function" 852 | }, 853 | { 854 | "constant": false, 855 | "inputs": [ 856 | { 857 | "name": "addr", 858 | "type": "address" 859 | }, 860 | { 861 | "name": "checksum", 862 | "type": "bytes4" 863 | } 864 | ], 865 | "name": "donateAsWithChecksum", 866 | "outputs": [ 867 | { 868 | "name": "", 869 | "type": "bool" 870 | } 871 | ], 872 | "payable": true, 873 | "type": "function" 874 | }, 875 | { 876 | "constant": true, 877 | "inputs": [ 878 | { 879 | "name": "", 880 | "type": "uint256" 881 | } 882 | ], 883 | "name": "phaseEndTime", 884 | "outputs": [ 885 | { 886 | "name": "", 887 | "type": "uint256" 888 | } 889 | ], 890 | "payable": false, 891 | "type": "function" 892 | }, 893 | { 894 | "constant": true, 895 | "inputs": [ 896 | { 897 | "name": "addr", 898 | "type": "address" 899 | }, 900 | { 901 | "name": "restricted", 902 | "type": "bool" 903 | } 904 | ], 905 | "name": "isRegistered", 906 | "outputs": [ 907 | { 908 | "name": "", 909 | "type": "bool" 910 | } 911 | ], 912 | "payable": false, 913 | "type": "function" 914 | }, 915 | { 916 | "constant": true, 917 | "inputs": [ 918 | { 919 | "name": "", 920 | "type": "uint256" 921 | } 922 | ], 923 | "name": "maxDelay", 924 | "outputs": [ 925 | { 926 | "name": "", 927 | "type": "uint256" 928 | } 929 | ], 930 | "payable": false, 931 | "type": "function" 932 | }, 933 | { 934 | "constant": false, 935 | "inputs": [ 936 | { 937 | "name": "newAuth", 938 | "type": "address" 939 | } 940 | ], 941 | "name": "setMasterAuth", 942 | "outputs": [], 943 | "payable": false, 944 | "type": "function" 945 | }, 946 | { 947 | "constant": true, 948 | "inputs": [], 949 | "name": "step", 950 | "outputs": [ 951 | { 952 | "name": "", 953 | "type": "uint256" 954 | } 955 | ], 956 | "payable": false, 957 | "type": "function" 958 | }, 959 | { 960 | "constant": true, 961 | "inputs": [ 962 | { 963 | "name": "", 964 | "type": "address" 965 | } 966 | ], 967 | "name": "tokens", 968 | "outputs": [ 969 | { 970 | "name": "", 971 | "type": "uint256" 972 | } 973 | ], 974 | "payable": false, 975 | "type": "function" 976 | }, 977 | { 978 | "constant": true, 979 | "inputs": [ 980 | { 981 | "name": "time", 982 | "type": "uint256" 983 | } 984 | ], 985 | "name": "getPhaseAtTime", 986 | "outputs": [ 987 | { 988 | "name": "n", 989 | "type": "uint256" 990 | } 991 | ], 992 | "payable": false, 993 | "type": "function" 994 | }, 995 | { 996 | "constant": true, 997 | "inputs": [], 998 | "name": "round0Bonus", 999 | "outputs": [ 1000 | { 1001 | "name": "", 1002 | "type": "uint256" 1003 | } 1004 | ], 1005 | "payable": false, 1006 | "type": "function" 1007 | }, 1008 | { 1009 | "constant": false, 1010 | "inputs": [], 1011 | "name": "empty", 1012 | "outputs": [ 1013 | { 1014 | "name": "", 1015 | "type": "bool" 1016 | } 1017 | ], 1018 | "payable": false, 1019 | "type": "function" 1020 | }, 1021 | { 1022 | "constant": true, 1023 | "inputs": [], 1024 | "name": "nSteps", 1025 | "outputs": [ 1026 | { 1027 | "name": "", 1028 | "type": "uint256" 1029 | } 1030 | ], 1031 | "payable": false, 1032 | "type": "function" 1033 | }, 1034 | { 1035 | "constant": false, 1036 | "inputs": [ 1037 | { 1038 | "name": "addr", 1039 | "type": "address" 1040 | }, 1041 | { 1042 | "name": "tokenAmount", 1043 | "type": "uint256" 1044 | }, 1045 | { 1046 | "name": "memo", 1047 | "type": "bytes32" 1048 | } 1049 | ], 1050 | "name": "registerEarlyContrib", 1051 | "outputs": [], 1052 | "payable": false, 1053 | "type": "function" 1054 | }, 1055 | { 1056 | "constant": true, 1057 | "inputs": [], 1058 | "name": "totalWeiDonated", 1059 | "outputs": [ 1060 | { 1061 | "name": "", 1062 | "type": "uint256" 1063 | } 1064 | ], 1065 | "payable": false, 1066 | "type": "function" 1067 | }, 1068 | { 1069 | "constant": true, 1070 | "inputs": [], 1071 | "name": "millionInCents", 1072 | "outputs": [ 1073 | { 1074 | "name": "", 1075 | "type": "uint256" 1076 | } 1077 | ], 1078 | "payable": false, 1079 | "type": "function" 1080 | }, 1081 | { 1082 | "inputs": [ 1083 | { 1084 | "name": "_masterAuth", 1085 | "type": "address" 1086 | }, 1087 | { 1088 | "name": "_name", 1089 | "type": "string" 1090 | } 1091 | ], 1092 | "payable": false, 1093 | "type": "constructor" 1094 | }, 1095 | { 1096 | "anonymous": false, 1097 | "inputs": [ 1098 | { 1099 | "indexed": true, 1100 | "name": "addr", 1101 | "type": "address" 1102 | }, 1103 | { 1104 | "indexed": true, 1105 | "name": "currency", 1106 | "type": "string" 1107 | }, 1108 | { 1109 | "indexed": true, 1110 | "name": "bonusMultiplierApplied", 1111 | "type": "uint256" 1112 | }, 1113 | { 1114 | "indexed": false, 1115 | "name": "timestamp", 1116 | "type": "uint256" 1117 | }, 1118 | { 1119 | "indexed": false, 1120 | "name": "tokenAmount", 1121 | "type": "uint256" 1122 | }, 1123 | { 1124 | "indexed": false, 1125 | "name": "memo", 1126 | "type": "bytes32" 1127 | } 1128 | ], 1129 | "name": "DonationReceipt", 1130 | "type": "event" 1131 | }, 1132 | { 1133 | "anonymous": false, 1134 | "inputs": [ 1135 | { 1136 | "indexed": true, 1137 | "name": "addr", 1138 | "type": "address" 1139 | }, 1140 | { 1141 | "indexed": false, 1142 | "name": "tokenAmount", 1143 | "type": "uint256" 1144 | }, 1145 | { 1146 | "indexed": false, 1147 | "name": "memo", 1148 | "type": "bytes32" 1149 | } 1150 | ], 1151 | "name": "EarlyContribReceipt", 1152 | "type": "event" 1153 | }, 1154 | { 1155 | "anonymous": false, 1156 | "inputs": [ 1157 | { 1158 | "indexed": true, 1159 | "name": "addr", 1160 | "type": "address" 1161 | }, 1162 | { 1163 | "indexed": false, 1164 | "name": "tokenAmountBurned", 1165 | "type": "uint256" 1166 | } 1167 | ], 1168 | "name": "BurnReceipt", 1169 | "type": "event" 1170 | } 1171 | ] 1172 | -------------------------------------------------------------------------------- /test/data/abi1_input_data.txt: -------------------------------------------------------------------------------- 1 | 0x67043cae0000000000000000000000005a9dac9315fdd1c3d13ef8af7fdfeb522db08f020000000000000000000000000000000000000000000000000000000058a20230000000000000000000000000000000000000000000000000000000000040293400000000000000000000000000000000000000000000000000000000000000a0f3df64775a2dfb6bc9e09dced96d0816ff5055bf95da13ce5b6c3f53b97071c800000000000000000000000000000000000000000000000000000000000000034254430000000000000000000000000000000000000000000000000000000000 2 | -------------------------------------------------------------------------------- /test/data/abi2.json: -------------------------------------------------------------------------------- 1 | [{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"name","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_allowance","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"totalSupply","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balances","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"decimals","type":"uint8"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"_decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"amountBurned","outputs":[{"name":"amountBurned","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"allowed","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_address","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"currentSupply","outputs":[{"name":"currentSupply","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"symbol","type":"string"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"_currentSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"_symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"_initialSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"_name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_value","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"burn","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"inputs":[],"payable":false,"type":"constructor"},{"payable":false,"type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"currentSupply","type":"uint256"},{"indexed":false,"name":"data","type":"bytes"}],"name":"Burn","type":"event"}] 2 | -------------------------------------------------------------------------------- /test/data/abi3.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"address","name":"theSigner","type":"address"},{"internalType":"address","name":"theWrapper","type":"address"},{"internalType":"address[]","name":"tokens","type":"address[]"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositor","type":"address"},{"indexed":false,"internalType":"uint256","name":"poolTokens","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nDays","type":"uint256"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"inAsset","type":"address"},{"indexed":true,"internalType":"address","name":"outAsset","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"inAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"outAmount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"auxiliaryData","type":"bytes"}],"name":"Swapped","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"withdrawer","type":"address"},{"indexed":false,"internalType":"uint256","name":"poolTokens","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fractionOfPool","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"DESIGNATED_SIGNER","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WRAPPER_CONTRACT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnToWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"theAddress","type":"address"}],"name":"canUnlockDeposit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256[]","name":"depositAmounts","type":"uint256[]"},{"internalType":"uint256","name":"nDays","type":"uint256"},{"internalType":"uint256","name":"poolTokens","type":"uint256"},{"internalType":"uint256","name":"goodUntil","type":"uint256"},{"components":[{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct ClipperDirectExchange.Signature","name":"theSignature","type":"tuple"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"isToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastBalances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"outputToken","type":"address"},{"internalType":"uint256","name":"inputAmount","type":"uint256"},{"internalType":"uint256","name":"outputAmount","type":"uint256"},{"internalType":"uint256","name":"goodUntil","type":"uint256"},{"internalType":"address","name":"destinationAddress","type":"address"},{"components":[{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct ClipperDirectExchange.Signature","name":"theSignature","type":"tuple"},{"internalType":"bytes","name":"auxiliaryData","type":"bytes"}],"name":"sellEthForToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"uint256","name":"inputAmount","type":"uint256"},{"internalType":"uint256","name":"outputAmount","type":"uint256"},{"internalType":"uint256","name":"goodUntil","type":"uint256"},{"internalType":"address","name":"destinationAddress","type":"address"},{"components":[{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct ClipperDirectExchange.Signature","name":"theSignature","type":"tuple"},{"internalType":"bytes","name":"auxiliaryData","type":"bytes"}],"name":"sellTokenForEth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"address","name":"outputToken","type":"address"},{"internalType":"uint256","name":"inputAmount","type":"uint256"},{"internalType":"uint256","name":"outputAmount","type":"uint256"},{"internalType":"uint256","name":"goodUntil","type":"uint256"},{"internalType":"address","name":"destinationAddress","type":"address"},{"components":[{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct ClipperDirectExchange.Signature","name":"theSignature","type":"tuple"},{"internalType":"bytes","name":"auxiliaryData","type":"bytes"}],"name":"swap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"i","type":"uint256"}],"name":"tokenAt","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"depositAmounts","type":"uint256[]"},{"internalType":"uint256","name":"nDays","type":"uint256"},{"internalType":"uint256","name":"poolTokens","type":"uint256"},{"internalType":"uint256","name":"goodUntil","type":"uint256"},{"components":[{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct ClipperDirectExchange.Signature","name":"theSignature","type":"tuple"}],"name":"transmitAndDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"uint256","name":"inputAmount","type":"uint256"},{"internalType":"uint256","name":"outputAmount","type":"uint256"},{"internalType":"uint256","name":"goodUntil","type":"uint256"},{"internalType":"address","name":"destinationAddress","type":"address"},{"components":[{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct ClipperDirectExchange.Signature","name":"theSignature","type":"tuple"},{"internalType":"bytes","name":"auxiliaryData","type":"bytes"}],"name":"transmitAndSellTokenForEth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"address","name":"outputToken","type":"address"},{"internalType":"uint256","name":"inputAmount","type":"uint256"},{"internalType":"uint256","name":"outputAmount","type":"uint256"},{"internalType":"uint256","name":"goodUntil","type":"uint256"},{"internalType":"address","name":"destinationAddress","type":"address"},{"components":[{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct ClipperDirectExchange.Signature","name":"theSignature","type":"tuple"},{"internalType":"bytes","name":"auxiliaryData","type":"bytes"}],"name":"transmitAndSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unlockDeposit","outputs":[{"internalType":"uint256","name":"poolTokens","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"vestingDeposits","outputs":[{"internalType":"uint256","name":"lockedUntil","type":"uint256"},{"internalType":"uint256","name":"poolTokenAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}] 2 | -------------------------------------------------------------------------------- /test/data/abi3_data.txt: -------------------------------------------------------------------------------- 1 | 0x3b26e4eb000000000000000000000000482bc619ee7662759cdc0685b4e78f464da39c730000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa8417400000000000000000000000000000000000000000000000000000000662990800000000000000000000000000000000000000000000000000000000000e7413e0000000000000000000000000000000000000000000000000000000061f81da8000000000000000000000000b0cc32190a06f4ba13027e7d6c516217b49e8eb0000000000000000000000000000000000000000000000000000000000000001be35fd8994857126c80d25bd1994ba96849fa77556d1360a9e605f04cc8f9d7c11f2244a355a9ab6ea4864381e5d38d4d9b09a25291d0bf6e61c6f975a4d5b9f700000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000020436c697070657200000000000000000000000000000000000000000000000000 2 | -------------------------------------------------------------------------------- /test/data/abi4.json: -------------------------------------------------------------------------------- 1 | 2 | [{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldRegistry","type":"address"},{"indexed":false,"internalType":"address","name":"newRegistry","type":"address"}],"name":"NewModuleRegistry","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"fromToken","type":"address"},{"indexed":false,"internalType":"address","name":"toToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"fromAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"}],"name":"Trade","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ETH_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SLINGSHOT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"contract IWETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"str1","type":"string"},{"internalType":"string","name":"str2","type":"string"}],"name":"appendString","outputs":[{"internalType":"string","name":"result","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"fromToken","type":"address"},{"internalType":"address","name":"toToken","type":"address"},{"internalType":"uint256","name":"fromAmount","type":"uint256"},{"components":[{"internalType":"address","name":"moduleAddress","type":"address"},{"internalType":"bytes","name":"encodedCalldata","type":"bytes"}],"internalType":"struct Slingshot.TradeFormat[]","name":"trades","type":"tuple[]"},{"internalType":"uint256","name":"finalAmountMin","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"executeTrades","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isInitialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"moduleRegistry","outputs":[{"internalType":"contract ModuleRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"postUpgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"i","type":"uint256"},{"internalType":"string","name":"str","type":"string"}],"name":"prependNumber","outputs":[{"internalType":"string","name":"result","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"rescueTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_moduleRegistry","type":"address"}],"name":"setModuleRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}] 3 | -------------------------------------------------------------------------------- /test/data/abi4_data.txt: -------------------------------------------------------------------------------- 1 | 0x06e75722000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000000000007735940000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000006d14b423b3af5fc000000000000000000000000cd43aad533e663b726dae4a08185e9db8ebc9f6f00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000e2a1b03cd5d639377b6d6e48d81a50fbc6c955a8000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c44fcfecd10000000000000000000000000000000000000000000000000000000077359400000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000 2 | -------------------------------------------------------------------------------- /test/data/abi5.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"address","name":"_weth","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":false,"inputs":[{"components":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"swapAmount","type":"uint256"},{"internalType":"uint256","name":"limitReturnAmount","type":"uint256"},{"internalType":"uint256","name":"maxPrice","type":"uint256"}],"internalType":"struct ExchangeProxy.Swap[]","name":"swaps","type":"tuple[]"},{"internalType":"contract TokenInterface","name":"tokenIn","type":"address"},{"internalType":"contract TokenInterface","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"totalAmountIn","type":"uint256"},{"internalType":"uint256","name":"minTotalAmountOut","type":"uint256"}],"name":"batchSwapExactIn","outputs":[{"internalType":"uint256","name":"totalAmountOut","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"components":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"swapAmount","type":"uint256"},{"internalType":"uint256","name":"limitReturnAmount","type":"uint256"},{"internalType":"uint256","name":"maxPrice","type":"uint256"}],"internalType":"struct ExchangeProxy.Swap[]","name":"swaps","type":"tuple[]"},{"internalType":"contract TokenInterface","name":"tokenIn","type":"address"},{"internalType":"contract TokenInterface","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"maxTotalAmountIn","type":"uint256"}],"name":"batchSwapExactOut","outputs":[{"internalType":"uint256","name":"totalAmountIn","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"components":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"swapAmount","type":"uint256"},{"internalType":"uint256","name":"limitReturnAmount","type":"uint256"},{"internalType":"uint256","name":"maxPrice","type":"uint256"}],"internalType":"struct ExchangeProxy.Swap[][]","name":"swapSequences","type":"tuple[][]"},{"internalType":"contract TokenInterface","name":"tokenIn","type":"address"},{"internalType":"contract TokenInterface","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"totalAmountIn","type":"uint256"},{"internalType":"uint256","name":"minTotalAmountOut","type":"uint256"}],"name":"multihopBatchSwapExactIn","outputs":[{"internalType":"uint256","name":"totalAmountOut","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"components":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"swapAmount","type":"uint256"},{"internalType":"uint256","name":"limitReturnAmount","type":"uint256"},{"internalType":"uint256","name":"maxPrice","type":"uint256"}],"internalType":"struct ExchangeProxy.Swap[][]","name":"swapSequences","type":"tuple[][]"},{"internalType":"contract TokenInterface","name":"tokenIn","type":"address"},{"internalType":"contract TokenInterface","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"maxTotalAmountIn","type":"uint256"}],"name":"multihopBatchSwapExactOut","outputs":[{"internalType":"uint256","name":"totalAmountIn","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_registry","type":"address"}],"name":"setRegistry","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract TokenInterface","name":"tokenIn","type":"address"},{"internalType":"contract TokenInterface","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"totalAmountIn","type":"uint256"},{"internalType":"uint256","name":"minTotalAmountOut","type":"uint256"},{"internalType":"uint256","name":"nPools","type":"uint256"}],"name":"smartSwapExactIn","outputs":[{"internalType":"uint256","name":"totalAmountOut","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract TokenInterface","name":"tokenIn","type":"address"},{"internalType":"contract TokenInterface","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"totalAmountOut","type":"uint256"},{"internalType":"uint256","name":"maxTotalAmountIn","type":"uint256"},{"internalType":"uint256","name":"nPools","type":"uint256"}],"name":"smartSwapExactOut","outputs":[{"internalType":"uint256","name":"totalAmountIn","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"swapAmount","type":"uint256"},{"internalType":"uint256","name":"nPools","type":"uint256"}],"name":"viewSplitExactIn","outputs":[{"components":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"swapAmount","type":"uint256"},{"internalType":"uint256","name":"limitReturnAmount","type":"uint256"},{"internalType":"uint256","name":"maxPrice","type":"uint256"}],"internalType":"struct ExchangeProxy.Swap[]","name":"swaps","type":"tuple[]"},{"internalType":"uint256","name":"totalOutput","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"swapAmount","type":"uint256"},{"internalType":"uint256","name":"nPools","type":"uint256"}],"name":"viewSplitExactOut","outputs":[{"components":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"swapAmount","type":"uint256"},{"internalType":"uint256","name":"limitReturnAmount","type":"uint256"},{"internalType":"uint256","name":"maxPrice","type":"uint256"}],"internalType":"struct ExchangeProxy.Swap[]","name":"swaps","type":"tuple[]"},{"internalType":"uint256","name":"totalOutput","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}] 2 | -------------------------------------------------------------------------------- /test/data/abi5_data.txt: -------------------------------------------------------------------------------- 1 | 0xe2b3974600000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000002386f26fc100000000000000000000000000000000000000000000000000001b1bd5bfc01a36880000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000020000000000000000000000007842792a8471d0f5ae645f513cc5999b1bb6b182000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006b785a0322126826d8226d77e173d75dafb84d11000000000000000000000000000000000000000000000000002386f26fc100000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000005d87eb9ac9c107424734f2a95f11649206ccfea80000000000000000000000006b785a0322126826d8226d77e173d75dafb84d110000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000001ee30107c0827ea7d0000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 2 | -------------------------------------------------------------------------------- /test/data/abi6.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_WETH","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint256","name":"amountADesired","type":"uint256"},{"internalType":"uint256","name":"amountBDesired","type":"uint256"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"addLiquidity","outputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"},{"internalType":"uint256","name":"liquidity","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountTokenDesired","type":"uint256"},{"internalType":"uint256","name":"amountTokenMin","type":"uint256"},{"internalType":"uint256","name":"amountETHMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"addLiquidityETH","outputs":[{"internalType":"uint256","name":"amountToken","type":"uint256"},{"internalType":"uint256","name":"amountETH","type":"uint256"},{"internalType":"uint256","name":"liquidity","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"reserveIn","type":"uint256"},{"internalType":"uint256","name":"reserveOut","type":"uint256"}],"name":"getAmountIn","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"reserveIn","type":"uint256"},{"internalType":"uint256","name":"reserveOut","type":"uint256"}],"name":"getAmountOut","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"}],"name":"getAmountsIn","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"}],"name":"getAmountsOut","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"reserveA","type":"uint256"},{"internalType":"uint256","name":"reserveB","type":"uint256"}],"name":"quote","outputs":[{"internalType":"uint256","name":"amountB","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"removeLiquidity","outputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountTokenMin","type":"uint256"},{"internalType":"uint256","name":"amountETHMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"removeLiquidityETH","outputs":[{"internalType":"uint256","name":"amountToken","type":"uint256"},{"internalType":"uint256","name":"amountETH","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountTokenMin","type":"uint256"},{"internalType":"uint256","name":"amountETHMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"removeLiquidityETHSupportingFeeOnTransferTokens","outputs":[{"internalType":"uint256","name":"amountETH","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountTokenMin","type":"uint256"},{"internalType":"uint256","name":"amountETHMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bool","name":"approveMax","type":"bool"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"removeLiquidityETHWithPermit","outputs":[{"internalType":"uint256","name":"amountToken","type":"uint256"},{"internalType":"uint256","name":"amountETH","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountTokenMin","type":"uint256"},{"internalType":"uint256","name":"amountETHMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bool","name":"approveMax","type":"bool"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"removeLiquidityETHWithPermitSupportingFeeOnTransferTokens","outputs":[{"internalType":"uint256","name":"amountETH","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bool","name":"approveMax","type":"bool"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"removeLiquidityWithPermit","outputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapETHForExactTokens","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactETHForTokens","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactETHForTokensSupportingFeeOnTransferTokens","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactTokensForETH","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactTokensForETHSupportingFeeOnTransferTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactTokensForTokens","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapExactTokensForTokensSupportingFeeOnTransferTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMax","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapTokensForExactETH","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMax","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"swapTokensForExactTokens","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}] 2 | -------------------------------------------------------------------------------- /test/data/abi6_data.txt: -------------------------------------------------------------------------------- 1 | 0x7ff36ab5000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000e2aefb9d145c6633fb019758d532c20b6c2577b20000000000000000000000000000000000000000000000000000000060c045760000000000000000000000000000000000000000000000000000000000000002000000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000000000000000000000000dd80054103cd4cfed6ef2e0afc8a3cb5ec07a585 2 | -------------------------------------------------------------------------------- /test/data/abi7.json: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_WETH9","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"WETH9","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"}],"internalType":"struct ISwapRouter.ExactInputParams","name":"params","type":"tuple"}],"name":"exactInput","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct ISwapRouter.ExactInputSingleParams","name":"params","type":"tuple"}],"name":"exactInputSingle","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMaximum","type":"uint256"}],"internalType":"struct ISwapRouter.ExactOutputParams","name":"params","type":"tuple"}],"name":"exactOutput","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMaximum","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct ISwapRouter.ExactOutputSingleParams","name":"params","type":"tuple"}],"name":"exactOutputSingle","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"refundETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitAllowed","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitAllowedIfNecessary","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"selfPermitIfNecessary","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"sweepToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"feeBips","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"name":"sweepTokenWithFee","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"unwrapWETH9","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountMinimum","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"feeBips","type":"uint256"},{"internalType":"address","name":"feeRecipient","type":"address"}],"name":"unwrapWETH9WithFee","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}] 2 | -------------------------------------------------------------------------------- /test/data/abi7_data.txt: -------------------------------------------------------------------------------- 1 | 0xc04b8d59000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000007a58b76ffd3989ddbce7bd632fdcf79b50530a690000000000000000000000000000000000000000000000000000000060ffb75c000000000000000000000000000000000000000000000000000000001dcd650000000000000000000000000000000000000000000000001f8587609e8c5bc3bf0000000000000000000000000000000000000000000000000000000000000042dac17f958d2ee523a2206206994597c13d831ec70001f4c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb8aa99199d1e9644b588796f3215089878440d58e0000000000000000000000000000000000000000000000000000000000000 2 | -------------------------------------------------------------------------------- /test/data/contract_creation_data.txt: -------------------------------------------------------------------------------- 1 | 2 | 0x60606040526007805460ff19169055346200000057604051620024213803806200242183398101604052805160208201519091015b62375f00601960055b60165b606481106200004f5762000000565b60008190555b5082811115620000655762000000565b80828115620000005704600f81905581028214620000835762000000565b600d839055600e8190555b5050508060129080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620000df57805160ff19168380011785556200010f565b828001600101855582156200010f579182015b828111156200010f578251825591602001919060010190620000f2565b5b50620001339291505b808211156200012f576000815560010162000119565b5090565b5050601a80546c0100000000000000000000000080850204600160a060020a03199182168117909255601d8054821683179055601c8054821683179055601b805490911690911790556000805260136020527f8fa6efc3be94b5b348b21fea823fe8d100408cee9b7f90524494500445d8ff6c805460ff19166001179055620001ce63587e5ba064010000000062001ded6200044982021704565b600160005260136020527f4155c2f711f2cdd34f8262ab8fb9b7020a700fe7b6948222152f7670d1fdf34d805460ff19166002179055620002216358b5baa064010000000062001ded6200044982021704565b600260005260136020527f0b9d2c0c271bb30544eb78c59bdaebdae2728e5f65814c07768a0abe90ed1923805460ff191660041790556200027463591c819064010000000062001ded6200044982021704565b6003600081905260136020527f0d2a6872ef858a7f8ead18dc4f3f2e8d35c853d47e2816cbb9cdd49202554e0c805460ff19169091179055620002c9635953e09064010000000062001ded6200044982021704565b6004600081905260136020527f01413ff7a3b1d5b6c016c061d48e2c7014700c777a29fcd068fff04265813d5d805460ff191690911790556200031e63595d1b1064010000000062001ded6200044982021704565b6005600081905260136020527ff4b2859895858d6aa26d656e4999d552f6a869b74c43bba7d2a941c4d22c3559805460ff19169091179055620003746407b10e471064010000000062001ded6200044982021704565b6006600081815260136020527f709d0e3cf89777a1e1f9c99632e4494f29b0327befd0df15e277a12d94825795805460ff19169092179091556001601e556003601f55620003d590630163f50064010000000062001e9b6200050182021704565b620003fe6001601f5403630163f500620005016401000000000262001e9b176401000000009004565b601e546200041f906305f5e10064010000000062001ebf6200052782021704565b601f546200044090637735940064010000000062001ebf6200052782021704565b5b50506200053d565b6000600b541180156200047d5750600a6001600b540381548110156200000057906000526020600020900160005b50548111155b15620004895762000000565b428111620004975762000000565b600a8054806001018281815481835581811511620004dd57600083815260209020620004dd9181019083015b808211156200012f576000815560010162000119565b5090565b5b505050916000526020600020900160005b5082905550600b805460010190555b50565b600b548210620005115762000000565b6000828152600c602052604090208190555b5050565b60008281526011602052604090208190555b5050565b611ed5806200054c6000396000f3606060405236156103005760e060020a6000350463015493b4811461030557806306fdde0314610317578063182e0c49146103925780631865c57d146103b15780631a7cf619146103dc5780631bd72647146103fb5780631c0e02251461041a5780631e4adcf7146104395780632fabc1741461045b5780632fe20e941461048357806330389c45146104a257806334f20f31146104c1578063384baa8a146104d357806339e8d1a4146104f25780633aaf32321461051157806341de2164146105305780634d39fa7d146105525780634de1454f146105745780634ef39b751461059857806356979da7146105aa5780635eed3dcb146105cb57806361012e15146105f757806367043cae14610616578063688f5ed214610673578063696830801461069257806369aa2c9f146106b15780636b7ae8dc146106d05780636ddc7e65146106f95780636e7525481461071857806372440c3114610737578063765b59d2146107565780637e429f02146107d95780637f40d9d8146107f8578063800087941461080d5780638314b4901461082c57806383d4f946146108585780638911e26b146108775780638d334529146108985780638ddf52bd146108ba5780639811c7c1146108d9578063986c1938146108fb5780639dcbed8b1461090d578063a23bfd841461092c578063a4ec11b11461094b578063a7c6f4831461096d578063b1f525c614610996578063b4150f17146109b8578063b7845c97146109e1578063b90ae5a114610a08578063be4f4fdf14610a31578063c2baa88214610a50578063c486d13314610a6f578063c4f141ff14610a8e578063c9e525df14610aa0578063ceadd9c814610abf578063d41bcb8114610ae1578063d5ce91fd14610b03578063dbb6123814610b2a578063dbd54b6214610b4c578063e25fe17514610b5e578063e486033914610b7d578063e831884e14610b9f578063e8a478ad14610bc1578063f2a75fe414610be0578063f3b585cc14610c01578063f69c3b2414610c20578063f6e5c6a414610c38578063fe742c6a146103fb575b610000565b3461000057610315600435610c76565b005b3461000057610324610cc5565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f1680156103845780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b346100005761039f610d53565b60408051918252519081900360200190f35b34610000576103be610d59565b60405180826006811161000057815260200191505060405180910390f35b346100005761039f610d82565b60408051918252519081900360200190f35b346100005761039f610d8a565b60408051918252519081900360200190f35b346100005761039f610d92565b60408051918252519081900360200190f35b346100005761039f600435610d9e565b60408051918252519081900360200190f35b346100005761039f600435602435604435610db0565b60408051918252519081900360200190f35b346100005761039f610ddb565b60408051918252519081900360200190f35b346100005761039f610de1565b60408051918252519081900360200190f35b3461000057610315600435610de6565b005b346100005761039f610e1f565b60408051918252519081900360200190f35b346100005761039f610e27565b60408051918252519081900360200190f35b346100005761039f610e2f565b60408051918252519081900360200190f35b346100005761039f600435610e37565b60408051918252519081900360200190f35b346100005761039f600435610e6c565b60408051918252519081900360200190f35b3461000057610584600435610ef1565b604080519115158252519081900360200190f35b3461000057610315600435610f14565b005b3461000057610584610fa1565b604080519115158252519081900360200190f35b34610000576105db600435610faa565b60408051600160a060020a039092168252519081900360200190f35b346100005761039f610fda565b60408051918252519081900360200190f35b3461000057604080516020600460643581810135601f810184900484028501840190955284845261031594823594602480359560443595946084949201919081908401838280828437509496505093359350610fe092505050565b005b346100005761039f61114a565b60408051918252519081900360200190f35b346100005761039f61114f565b60408051918252519081900360200190f35b346100005761039f611155565b60408051918252519081900360200190f35b34610000576105db61115b565b60408051600160a060020a039092168252519081900360200190f35b346100005761039f61116a565b60408051918252519081900360200190f35b346100005761039f611171565b60408051918252519081900360200190f35b346100005761039f611179565b60408051918252519081900360200190f35b346100005761076c600435602435604435611182565b604051808d60068111610000578152602081019c909c52506040808c019a909a5260608b019890985260808a019690965260a089019490945260c0880192909252151560e08701526101008601526101208501526101408401526101608301525190819003610180019150f35b346100005761039f6112b1565b60408051918252519081900360200190f35b34610000576103156004356024356112b7565b005b346100005761039f61130c565b60408051918252519081900360200190f35b34610000576105db600435611314565b60408051600160a060020a039092168252519081900360200190f35b346100005761039f611344565b60408051918252519081900360200190f35b346100005761058461134c565b604080519115158252519081900360200190f35b346100005761039f600435611367565b60408051918252519081900360200190f35b346100005761039f611379565b60408051918252519081900360200190f35b346100005761039f60043561137e565b60408051918252519081900360200190f35b3461000057610315600435611390565b005b346100005761039f6113c9565b60408051918252519081900360200190f35b346100005761039f6113cf565b60408051918252519081900360200190f35b346100005761039f6004356113d5565b60408051918252519081900360200190f35b34610000576105db611417565b60408051600160a060020a039092168252519081900360200190f35b346100005761039f600435611426565b60408051918252519081900360200190f35b34610000576105db611438565b60408051600160a060020a039092168252519081900360200190f35b3461000057610584600435602435611447565b604080519115158252519081900360200190f35b34610000576105db6114e1565b60408051600160a060020a039092168252519081900360200190f35b346100005761039f6114f0565b60408051918252519081900360200190f35b346100005761039f6114f6565b60408051918252519081900360200190f35b346100005761039f6114fb565b60408051918252519081900360200190f35b3461000057610315600435611500565b005b346100005761039f611524565b60408051918252519081900360200190f35b61058460043560243561152a565b604080519115158252519081900360200190f35b346100005761039f6004356115b9565b60408051918252519081900360200190f35b34610000576105846004356024356115da565b604080519115158252519081900360200190f35b346100005761039f60043561162d565b60408051918252519081900360200190f35b346100005761031560043561163f565b005b346100005761039f611678565b60408051918252519081900360200190f35b346100005761039f60043561167e565b60408051918252519081900360200190f35b346100005761039f600435611690565b60408051918252519081900360200190f35b346100005761039f6116df565b60408051918252519081900360200190f35b34610000576105846116e4565b604080519115158252519081900360200190f35b346100005761039f611714565b60408051918252519081900360200190f35b346100005761031560043560243560443561171a565b005b346100005761039f611832565b60408051918252519081900360200190f35b346100005761039f610d8a565b60408051918252519081900360200190f35b601d5433600160a060020a03908116911614610c9157610000565b601e54610c9d42611690565b10610ca757610000565b601a8054600160a060020a031916606060020a838102041790555b50565b6012805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610d4b5780601f10610d2057610100808354040283529160200191610d4b565b820191906000526020600020905b815481529060010190602001808311610d2e57829003601f168201915b505050505081565b60065481565b600060136000610d6842611690565b815260208101919091526040016000205460ff1690505b90565b63587e5ba081565b6305f5e10081565b670de0b6b3a764000081565b60196020526000908152604090205481565b6000821515610dc157506000610dd4565b8160018303848602018115610000570490505b9392505050565b60035481565b600581565b601d5433600160a060020a03908116911614610e0157610000565b601c8054600160a060020a031916606060020a838102041790555b50565b63591c819081565b635953e09081565b630163f50081565b6000811515610e4557610000565b600a60018303815481101561000057906000526020600020900160005b505490505b919050565b60006000610e7983611690565b9050600260008281526013602052604090205460ff1660068111610000571415610ea75761012c9150610eeb565b600360008281526013602052604090205460ff166006811161000057141561030057610edc610ed582610e37565b84036113d5565b6064019150610eeb565b610000565b50919050565b60008181526011602090815260408083205460109092529091205410155b919050565b60006005610f20610d59565b600681116100005714610f3257610000565b610f3a611840565b610f43826118a5565b604080518281529051919250600160a060020a038416917fcab925a3b0cfe3f811ef93b233616633bf1eeb7f9849ec9f49411c45c8500eeb9181900360200190a2610f8c61134c565b15610f9b57610f9b600061193d565b5b5b5050565b60075460ff1681565b601581815481101561000057906000526020600020900160005b915054906101000a9004600160a060020a031681565b600d5481565b601b5460009081908190819033600160a060020a0390811691161461100457610000565b61100d42611690565b60008181526013602052604090205490945060ff1692506002836006811161000057141580156110465750600383600681116100005714155b801561105b5750600483600681116100005714155b1561106557610000565b4288111561107257610000565b61107b88611690565b60008181526013602052604090205490925060ff169050600283600681116100005714806110b157506003836006811161000057145b80156110cd575082600681116100005781600681116100005714155b156110d757610000565b60048360068111610000571480156110f25750600184038214155b156110fc57610000565b60008581526014602052604090205460ff161561111857610000565b6000858152601460205260409020805460ff1916600117905561113e89898989896119af565b5b505050505050505050565b600081565b60055481565b60095481565b601a54600160a060020a031681565b6201518081565b63595d1b1081565b6407b10e471081565b6000600060006000600060006000600060006000600060006111a2610d59565b9b5060028c600681116100005714806111c3575060038c6006811161000057145b156111d4576111d142610e6c565b99505b6017549a50600654985060045497508e60001415611230576111f7601e54610e37565b9650611207601e54600101610e37565b9550611214601e54610ef1565b601e546000908152601060205260409020549095509350611270565b61123b601f54610e37565b965061124b601f54600101610e37565b9550611258601f54610ef1565b601f5460009081526010602052604090205490955093505b505050600160a060020a03808c1660009081526001602090815260408083205460199092529091205490918c1631905b93979b5093979b5093979b5093979b565b60085481565b601b5433600160a060020a039081169116146112d257610000565b8115156112ed576112e86001601e540382611b58565b610f9b565b8160011415610f9b57610f9b6001601f540382611b58565b5b5b5b5050565b637735940081565b601681815481101561000057906000526020600020900160005b915054906101000a9004600160a060020a031681565b6358b5baa081565b60075460009060ff1680156113615750600354155b90505b90565b60026020526000908152604090205481565b601681565b60116020526000908152604090205481565b601d5433600160a060020a039081169116146113ab57610000565b601b8054600160a060020a031916606060020a838102041790555b50565b60045481565b60175481565b600060006000600d54841015156113eb57610000565b600d54600e546000198683030193506001018302811561000057049050600f54810292505b5050919050565b601c54600160a060020a031681565b60106020526000908152604090205481565b601d54600160a060020a031681565b60004283111561145657610000565b600b54821061146457610000565b600082118015611491575082600a60018403815481101561000057906000526020600020900160005b5054115b1561149e575060006114db565b600b54821080156114ca5750600a82815481101561000057906000526020600020900160005b50548310155b156114d7575060006114db565b5060015b92915050565b601b54600160a060020a031681565b60005481565b600a81565b601981565b601c5433600160a060020a0390811691161461151b57610000565b60178190555b50565b600b5481565b600060006002846000604051602001526040518082600160a060020a0316606060020a0281526014019150506020604051808303816000866161da5a03f1156100005750506040515190507fffffffff00000000000000000000000000000000000000000000000000000000808216908416146115a657610000565b6115af84611bff565b91505b5092915050565b600a81815481101561000057906000526020600020900160005b5054905081565b600081156116065750600160a060020a038216600090815260026020526040812054116114db566114db565b50600160a060020a038216600090815260016020526040812054116114db565b5b92915050565b600c6020526000908152604090205481565b601d5433600160a060020a0390811691161461165a57610000565b601d8054600160a060020a031916606060020a838102041790555b50565b600f5481565b60016020526000908152604090205481565b60004282111561169f57610000565b5b600b54811080156116cc575081600a82815481101561000057906000526020600020900160005b505411155b15610e67576001016116a0565b5b919050565b60c881565b601a54604051600091600160a060020a03908116913090911631908381818185876185025a03f193505050505b90565b600e5481565b601b5433600160a060020a0390811691161461173557610000565b600161173f610d59565b60068111610000571461175157610000565b61175c8360016115da565b15156117dd57601680548060010182818154818355818115116117a4576000838152602090206117a49181019083015b808211156117a0576000815560010161178c565b5090565b5b505050916000526020600020900160005b8154606060020a808802046101009290920a918202600160a060020a039092021916179055505b6117e983836001611d0e565b60408051838152602081018390528151600160a060020a038616927feda6e2db2282248e45eea25fb8cc7367122b2cebe6a93042fad94be959db3649928290030190a25b505050565b60185481565b6305f5e10081565b6007546000908190819060ff16156118575761182d565b6007805460ff1916600117905560005460045460649182039102811561000057049250600454600354019150600090508282111561189457508181035b60098190556003546008555b505050565b6007546000908190819060ff1615156118bd57610000565b600160a060020a03841660009081526002602052604090205491508115156118e457610000565b6118f382600954600854610db0565b600160a060020a03851660009081526001602090815260408083208054859003905560029091528120556003805484900390556004805482850301905592508290505b5050919050565b600061194842611690565b600b54909150811061195957610000565b81151561196557600191505b600a81815481101561000057906000526020600020900160005b50548242011015610f9b57814201600a82815481101561000057906000526020600020900160005b50555b5b5050565b60006000600060006119c088611690565b93506119cc8488611d8e565b92508280156119e257506119df42611690565b84145b15611a1657601e54841415611a02576119fd6201518061193d565b611a16565b601f54841415611a1657611a16600061193d565b5b5b5b611a2288610e6c565b915060648783020496506064600a8802049050611a408960006115da565b1515611ac15760158054806001018281815481835581811511611a8857600083815260209020611a889181019083015b808211156117a0576000815560010161178c565b5090565b5b505050916000526020600020900160005b8154606060020a808e02046101009290920a918202600160a060020a039092021916179055505b611acd89826000611d0e565b8186604051808280519060200190808383829060006004602084601f0104600302600f01f150604080519390910183900383208e8452602084018890528382018c90529051909450600160a060020a038f1693507f9e251c6f2df2b591abddc2ad71988acda2cc1851040e7fcdf1ddcf1936f6dbb7928190036060019150a45b505050505050505050565b600b546000908310611b6957610000565b600a83815481101561000057906000526020600020900160005b50544210611b9057610000565b6000838152600c6020526040902054821115611bab57610000565b506000828152600c6020526040902080548290039055815b600b5481101561182d5781600a82815481101561000057906000526020600020900160005b50805490910190555b600101611bc3565b5b505050565b600060006000611c0d610d59565b9150600282600681116100005714158015611c315750600382600681116100005714155b15611c3b57610000565b670de0b6b3a7640000341015611c5057610000565b6017541515611c5e57610000565b6018805434908101909155600160a060020a038516600090815260196020526040902080548201905560175490606402811561000057049050611cde844283604060405190810160405280600381526020017f455448000000000000000000000000000000000000000000000000000000000081526020015060006119af565b601a54604051600160a060020a039182169130163190600081818185876185025a03f195505050505b5050919050565b60075460ff1615611d1e57610000565b600160a060020a03831660009081526001602052604090208054830190558015611d76576003805483019055600580546001019055600160a060020a038316600090815260026020526040902080548301905561182d565b60048054830190556006805460010190555b5b505050565b6000828152601160209081526040808320546010909252822054108015611dd05750600083815260116020908152604080832054601090925290912054830110155b600084815260106020526040902080548401905590505b92915050565b6000600b54118015611e1f5750600a6001600b5403815481101561000057906000526020600020900160005b50548111155b15611e2957610000565b428111611e3557610000565b600a8054806001018281815481835581811511611e7757600083815260209020611e779181019083015b808211156117a0576000815560010161178c565b5090565b5b505050916000526020600020900160005b5082905550600b805460010190555b50565b600b548210611ea957610000565b6000828152600c602052604090208190555b5050565b60008281526011602052604090208190555b505056000000000000000000000000b2cb826c945d8df01802b5cf3c4105685d4933a0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000145354494654554e47204466696e69747920464443000000000000000000000000 3 | -------------------------------------------------------------------------------- /test/data/erc721_abi.json: -------------------------------------------------------------------------------- 1 | [{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"_name","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"name":"_approved","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"implementsERC721","outputs":[{"name":"_implementsERC721","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"_totalSupply","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"name":"_tokenId","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"name":"_owner","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"tokenMetadata","outputs":[{"name":"_infoUrl","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"_balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"},{"name":"_tokenId","type":"uint256"},{"name":"_approvedAddress","type":"address"},{"name":"_metadata","type":"string"}],"name":"mint","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"_symbol","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"}],"name":"transfer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"numTokensTotal","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"getOwnerTokens","outputs":[{"name":"_tokenIds","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_to","type":"address"},{"indexed":true,"name":"_tokenId","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_approved","type":"address"},{"indexed":false,"name":"_tokenId","type":"uint256"}],"name":"Approval","type":"event"}] 2 | -------------------------------------------------------------------------------- /test/data/erc721_transferfrom_tx_data.txt: -------------------------------------------------------------------------------- 1 | 0x23b872dd00000000000000000000000010017ca37b1257ac0771e24652aa28c758e378eb8075d21666a33e4c636f8131e7a632d89104385bdd3992eeb82cffeb48e4e5390000000000000000000000000000000000000000000000000000000000005dc5 2 | -------------------------------------------------------------------------------- /test/data/set_exchange_issuance_lib.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "constant":true, 4 | "inputs":[], 5 | "name":"transferProxyInstance", 6 | "outputs":[{"name":"","type":"address"}], 7 | "payable":false, 8 | "stateMutability":"view", 9 | "type":"function" 10 | }, 11 | { 12 | "constant":true, 13 | "inputs":[], 14 | "name":"exchangeIssuanceModuleInstance", 15 | "outputs":[{"name":"","type":"address"}], 16 | "payable":false, 17 | "stateMutability":"view", 18 | "type":"function" 19 | }, 20 | { 21 | "constant":true, 22 | "inputs":[], 23 | "name":"vaultInstance", 24 | "outputs":[{"name":"","type":"address"}], 25 | "payable":false, 26 | "stateMutability":"view", 27 | "type":"function" 28 | }, 29 | { 30 | "constant":true, 31 | "inputs":[], 32 | "name":"wethInstance", 33 | "outputs":[{"name":"","type":"address"}], 34 | "payable":false, 35 | "stateMutability":"view", 36 | "type":"function" 37 | }, 38 | { 39 | "constant":true, 40 | "inputs":[], 41 | "name":"coreInstance", 42 | "outputs":[{"name":"","type":"address"}], 43 | "payable":false, 44 | "stateMutability":"view", 45 | "type":"function" 46 | }, 47 | { 48 | "inputs":[ 49 | {"name":"_core","type":"address"}, 50 | {"name":"_transferProxy","type":"address"}, 51 | {"name":"_exchangeIssuanceModule","type":"address"}, 52 | {"name":"_wrappedEther","type":"address"}, 53 | {"name":"_vault","type":"address"} 54 | ], 55 | "payable":false, 56 | "stateMutability":"nonpayable", 57 | "type":"constructor" 58 | }, 59 | {"payable":true,"stateMutability":"payable","type":"fallback"}, 60 | { 61 | "anonymous":false, 62 | "inputs":[ 63 | {"indexed":true,"name":"rebalancingSetAddress","type":"address"}, 64 | {"indexed":true,"name":"callerAddress","type":"address"}, 65 | {"indexed":false,"name":"paymentTokenAddress","type":"address"}, 66 | {"indexed":false,"name":"rebalancingSetQuantity","type":"uint256"}, 67 | {"indexed":false,"name":"paymentTokenReturned","type":"uint256"} 68 | ], 69 | "name":"LogPayableExchangeIssue", 70 | "type":"event" 71 | }, 72 | { 73 | "anonymous":false, 74 | "inputs":[ 75 | {"indexed":true,"name":"rebalancingSetAddress","type":"address"}, 76 | {"indexed":true,"name":"callerAddress","type":"address"}, 77 | {"indexed":false,"name":"outputTokenAddress","type":"address"}, 78 | {"indexed":false,"name":"rebalancingSetQuantity","type":"uint256"}, 79 | {"indexed":false,"name":"outputTokenQuantity","type":"uint256"} 80 | ], 81 | "name":"LogPayableExchangeRedeem", 82 | "type":"event" 83 | }, 84 | { 85 | "constant":false, 86 | "inputs":[ 87 | {"name":"_rebalancingSetAddress","type":"address"}, 88 | {"name":"_rebalancingSetQuantity","type":"uint256"}, 89 | { 90 | "components":[ 91 | {"name":"setAddress","type":"address"}, 92 | {"name":"quantity","type":"uint256"}, 93 | {"name":"sendTokenExchangeIds","type":"uint8[]"}, 94 | {"name":"sendTokens","type":"address[]"}, 95 | {"name":"sendTokenAmounts","type":"uint256[]"}, 96 | {"name":"receiveTokens","type":"address[]"}, 97 | {"name":"receiveTokenAmounts","type":"uint256[]"} 98 | ], 99 | "name":"_exchangeIssuanceParams", 100 | "type":"tuple" 101 | }, 102 | {"name":"_orderData","type":"bytes"}, 103 | {"name":"_keepChangeInVault","type":"bool"} 104 | ], 105 | "name":"issueRebalancingSetWithEther", 106 | "outputs":[], 107 | "payable":true, 108 | "stateMutability":"payable", 109 | "type":"function" 110 | }, 111 | { 112 | "constant":false, 113 | "inputs":[ 114 | {"name":"_rebalancingSetAddress","type":"address"}, 115 | {"name":"_rebalancingSetQuantity","type":"uint256"}, 116 | {"name":"_paymentTokenAddress","type":"address"}, 117 | {"name":"_paymentTokenQuantity","type":"uint256"}, 118 | { 119 | "components":[ 120 | {"name":"setAddress","type":"address"}, 121 | {"name":"quantity","type":"uint256"}, 122 | {"name":"sendTokenExchangeIds","type":"uint8[]"}, 123 | {"name":"sendTokens","type":"address[]"}, 124 | {"name":"sendTokenAmounts","type":"uint256[]"}, 125 | {"name":"receiveTokens","type":"address[]"}, 126 | {"name":"receiveTokenAmounts","type":"uint256[]"} 127 | ], 128 | "name":"_exchangeIssuanceParams", 129 | "type":"tuple" 130 | }, 131 | {"name":"_orderData","type":"bytes"}, 132 | {"name":"_keepChangeInVault","type":"bool"} 133 | ], 134 | "name":"issueRebalancingSetWithERC20", 135 | "outputs":[], 136 | "payable":false, 137 | "stateMutability":"nonpayable", 138 | "type":"function" 139 | }, 140 | { 141 | "constant":false, 142 | "inputs":[ 143 | {"name":"_rebalancingSetAddress","type":"address"}, 144 | {"name":"_rebalancingSetQuantity","type":"uint256"}, 145 | { 146 | "components":[ 147 | {"name":"setAddress","type":"address"}, 148 | {"name":"quantity","type":"uint256"}, 149 | {"name":"sendTokenExchangeIds","type":"uint8[]"}, 150 | {"name":"sendTokens","type":"address[]"}, 151 | {"name":"sendTokenAmounts","type":"uint256[]"}, 152 | {"name":"receiveTokens","type":"address[]"}, 153 | {"name":"receiveTokenAmounts","type":"uint256[]"} 154 | ], 155 | "name":"_exchangeIssuanceParams", 156 | "type":"tuple" 157 | }, 158 | {"name":"_orderData","type":"bytes"}, 159 | {"name":"_keepChangeInVault","type":"bool"} 160 | ], 161 | "name":"redeemRebalancingSetIntoEther", 162 | "outputs":[], 163 | "payable":false, 164 | "stateMutability":"nonpayable", 165 | "type":"function" 166 | }, 167 | { 168 | "constant":false, 169 | "inputs":[ 170 | {"name":"_rebalancingSetAddress","type":"address"}, 171 | {"name":"_rebalancingSetQuantity","type":"uint256"}, 172 | {"name":"_outputTokenAddress","type":"address"}, 173 | { 174 | "components":[ 175 | {"name":"setAddress","type":"address"}, 176 | {"name":"quantity","type":"uint256"}, 177 | {"name":"sendTokenExchangeIds","type":"uint8[]"}, 178 | {"name":"sendTokens","type":"address[]"}, 179 | {"name":"sendTokenAmounts","type":"uint256[]"}, 180 | {"name":"receiveTokens","type":"address[]"}, 181 | {"name":"receiveTokenAmounts","type":"uint256[]"} 182 | ], 183 | "name":"_exchangeIssuanceParams", 184 | "type":"tuple" 185 | }, 186 | {"name":"_orderData","type":"bytes"}, 187 | {"name":"_keepChangeInVault","type":"bool"} 188 | ], 189 | "name":"redeemRebalancingSetIntoERC20", 190 | "outputs":[], 191 | "payable":false, 192 | "stateMutability":"nonpayable", 193 | "type":"function" 194 | } 195 | ] 196 | -------------------------------------------------------------------------------- /test/data/set_issuance.txt: -------------------------------------------------------------------------------- 1 | 0x16919b9700000000000000000000000081c55017f7ce6e72451ced49ff7bab1e3df64d0c00000000000000000000000000000000000000000000000027019ab6af61124000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000a37de6790861b5541b0daa7d0c0e651f44c6f4d9000000000000000000000000000000000000000000000000003bf6ab7ba2400000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000001a04a045412d3457000000000000000000000000000000000000000000000000000000000000000200000000000000000000000089d24a6b4ccb1b6faa2625fe562bdd9a232603590000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c5990000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000006989640c83ea4a200000000000000000000000000000000000000000000000000000000000019c110000000000000000000000000000000000000000000000000000000000000046400000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000040400000000000000000000000000000000000000000000000000000000000000420000000000000000000000000000000000000000000000000d5a4cdef78c36901bc9ab7c3108c7d7b06f183e7d71c591bb6c677e3fa2958310a2520b916b792c6538b8e43ccb9a1773e94daa441307827c377f3b197d6549f9de54794a806b697a0300000000000000000000000056178a0d5f301baf6cf3e1cd53d9863437345bf90000000000000000000000000acd0b5cf881cd8398ac563872209de1ce15df0f00000000000000000000000055662e225a3376759c24331a9aed764f8f0c9fbb0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006b70202a2f0d520000000000000000000000000000000000000000000000000000d97e20f757ec00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005dfa648800000000000000000000000000000000000000000000000015e187ad8bbe980000000000000000000000000089d24a6b4ccb1b6faa2625fe562bdd9a23260359000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000000000420000000000000000000000000000000000000000000000000caa536649a0fdc71bd88fc3a7ecf72f2082e39783296db7a0236b404ca968873f51ce89b4237ecdcf0da1d3cee4306348664629deacaca7f7961ada746036229c5b161612cdb96bad0300000000000000000000000056178a0d5f301baf6cf3e1cd53d9863437345bf90000000000000000000000000acd0b5cf881cd8398ac563872209de1ce15df0f00000000000000000000000055662e225a3376759c24331a9aed764f8f0c9fbb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a38050000000000000000000000000000000000000000000000000ce4d38704d0c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005dfa648800000000000000000000000000000000000000000000000015e187ad8bbe98000000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000 2 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": [ 3 | "dist/*" 4 | ], 5 | "exclude": [], 6 | "compilerOptions": { 7 | "lib": [ 8 | "es2015", 9 | "dom", 10 | "dom.iterable" 11 | ], 12 | "target": "ES2018", 13 | "declaration": true, 14 | "declarationDir": ".", 15 | "noEmitOnError": true, 16 | "noErrorTruncation": true, 17 | "module": "CommonJS", 18 | "moduleResolution": "node", 19 | "resolveJsonModule": true, 20 | "allowSyntheticDefaultImports": true, 21 | "noImplicitThis": true, 22 | "noUnusedLocals": true, 23 | "noUnusedParameters": true, 24 | "baseUrl": ".", 25 | "declarationMap": true 26 | } 27 | } 28 | --------------------------------------------------------------------------------