├── .github └── FUNDING.yml ├── .gitignore ├── .npmignore ├── LICENSE.md ├── README.md ├── contracts └── multicall.sol ├── lib.commonjs ├── README.md ├── _build.d.ts ├── _build.d.ts.map ├── _build.js ├── _build.js.map ├── _contract.d.ts ├── _contract.d.ts.map ├── _contract.js ├── _contract.js.map ├── index.d.ts ├── index.d.ts.map ├── index.js ├── index.js.map ├── multicall.d.ts ├── multicall.d.ts.map ├── multicall.js ├── multicall.js.map ├── multicaller.d.ts ├── multicaller.d.ts.map ├── multicaller.js ├── multicaller.js.map ├── package.json ├── provider-multicall.d.ts ├── provider-multicall.d.ts.map ├── provider-multicall.js ├── provider-multicall.js.map ├── test.d.ts ├── test.d.ts.map ├── test.js └── test.js.map ├── lib.esm ├── README.md ├── _build.d.ts ├── _build.d.ts.map ├── _build.js ├── _build.js.map ├── _contract.d.ts ├── _contract.d.ts.map ├── _contract.js ├── _contract.js.map ├── index.d.ts ├── index.d.ts.map ├── index.js ├── index.js.map ├── multicall.d.ts ├── multicall.d.ts.map ├── multicall.js ├── multicall.js.map ├── multicaller.d.ts ├── multicaller.d.ts.map ├── multicaller.js ├── multicaller.js.map ├── package.json ├── provider-multicall.d.ts ├── provider-multicall.d.ts.map ├── provider-multicall.js ├── provider-multicall.js.map ├── test.d.ts ├── test.d.ts.map ├── test.js └── test.js.map ├── misc ├── basedirs │ ├── lib.commonjs │ │ ├── README.md │ │ └── package.json │ └── lib.esm │ │ ├── README.md │ │ └── package.json └── output │ ├── contracts_multicall_sol_Multicall.abi │ ├── contracts_multicall_sol_Multicall.bin │ └── result.json ├── package-lock.json ├── package.json ├── solc-config.json ├── src.ts ├── _build.ts ├── _contract.ts ├── index.ts ├── multicall.ts ├── multicaller.ts ├── package.json ├── provider-multicall.ts └── test.ts ├── tsconfig.base.json ├── tsconfig.commonjs.json └── tsconfig.esm.json /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [ ethers-io ] 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/** 2 | 3 | **/*.swp 4 | **/*.tgz 5 | **/*.gz 6 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | 2 | # Ignore TypeScript config and caches 3 | tsconfig.*.json 4 | tsconfig.tsbuildinfo 5 | rollup.config.js 6 | rollup.config.cjs 7 | rollup.config.mjs 8 | output/** 9 | .github/** 10 | 11 | 12 | # Ignore random junk 13 | .DS_Store 14 | node_modules/** 15 | misc/** 16 | **/*.tgz 17 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016-2023 Richard Moore 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do 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 | Ethers: MulticallProvider 2 | ========================= 3 | 4 | The MulticallProvider is designed to reduce the latency and large 5 | number of calls that can occur, especially on the initial loading 6 | of page. 7 | 8 | This does not require any multicall contract be deployed to the network, 9 | and does not deploy any multicall contract to the network. It is only 10 | designed to assist in read-only call operations, and does not 11 | currently support sending multicall transactions. 12 | 13 | For inspiration, see: 14 | 15 | - [Ethers v5 multicall](https://github.com/ricmoo/multicall) 16 | - [multicall3](https://www.multicall3.com) 17 | 18 | 19 | Installing 20 | ---------- 21 | 22 | ```shell 23 | /home/ricmoo> npm install @ethers-ext/provider-multicall 24 | ``` 25 | 26 | 27 | Usage 28 | ----- 29 | 30 | ```javascript 31 | import { MulticallProvider } from "@ethers-ext/provider-multicall"; 32 | 33 | // Create the provider which will serve as the main transport 34 | const provider = new InfuraProvider(); 35 | 36 | // Create the multicall provider, which will aggregate calls 37 | const multicaller = new MulticallProvider(provider); 38 | 39 | // Connect your contracts to the multicaller 40 | const dai = new Contract("dai.tokens.ethers.eth", daiAbi, multicaller); 41 | 42 | // Make your multicalls 43 | const [ sym, name, totalSupply ] = await Promise.all([ 44 | dai.symbol(), 45 | dai.name(), 46 | dai.totalSupply(), 47 | ]); 48 | ``` 49 | 50 | 51 | API 52 | --- 53 | 54 | ### `new MulticallProvider(provider)` 55 | 56 | Create a new MulticallProvider using `provider` as the transport. 57 | 58 | ### `provider.queueCall(to, data) => Promise>` 59 | 60 | Place a call into the queue to be called on the next drain. Any normal 61 | `provider.call` will call this internally. 62 | 63 | ### `provider.drainCallQueue() => Promise` 64 | 65 | Regardless of the remaining time before the `drainInterval`, trigger all 66 | calls. This **must** be called explicitly when using *manual drain* (i.e. 67 | the `drainInterval` is `-1`). 68 | 69 | ### `provider.drainInterval` 70 | 71 | The drainInterval (by default, 10ms) specifies the interval to aggregate 72 | calls within. If the `drainInterval` is set to `0`, then only calls 73 | made within a single event loop will be aggregated and if `-1` is used 74 | then the `provider.drainCallQueue` MUST be called manually. 75 | 76 | Pay special attention when using manual a `drainInterval`, as it can 77 | easily lead to deadlock, if a response is `await`-ed without another 78 | execution in the event loop to trigger a drain. 79 | 80 | 81 | Contributing 82 | ------------ 83 | 84 | If the multicall contract is changed (`./contracts/multicall.sol`), 85 | then you must call `npm run build-solc` before the changes will be 86 | added to the `./src.ts/_contract.ts` file, which is a TypeScript 87 | version of the ABI and bytecode, generated using `./src.ts/_build.ts`. 88 | 89 | Please open a discussion before making any changes. `:o)`. 90 | 91 | 92 | Notes 93 | ----- 94 | 95 | This is designed for Ethers v6. For Ethers v5, see the old 96 | [Multicaller](https://github.com/ricmoo/multicall/tree/main). 97 | 98 | 99 | License 100 | ------- 101 | 102 | MIT License. 103 | -------------------------------------------------------------------------------- /contracts/multicall.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.21; 4 | 5 | function getBytes(address addr, bytes memory data) view returns (bool status, bytes memory result) { 6 | assembly { 7 | // Allocate a new slot for the output 8 | result := mload(0x40) 9 | 10 | // Initialize the output as length 0 (in case things go wrong) 11 | mstore(result, 0) 12 | mstore(0x40, add(result, 32)) 13 | 14 | // Call the target address with the data, limiting gas usage 15 | status := staticcall(gas(), addr, add(data, 32), mload(data), 0, 0) 16 | 17 | // Allocate enough space to store the ceil_32(len_32(result) + result) 18 | mstore(0x40, add(result, and(add(add(returndatasize(), 0x20), 0x1f), not(0x1f)))) 19 | 20 | // Place the length of the result value into the output 21 | mstore(result, returndatasize()) 22 | 23 | // Copy the result value into the output 24 | returndatacopy(add(result, 32), 0, returndatasize()) 25 | } 26 | } 27 | 28 | contract Multicall { 29 | 30 | struct Call { 31 | address target; 32 | bytes data; 33 | } 34 | 35 | struct Result { 36 | bool status; 37 | bytes data; 38 | } 39 | 40 | constructor(Call[] memory calls) { 41 | Result[] memory result = new Result[](calls.length); 42 | 43 | // Make each call 44 | for (uint256 i = 0; i < calls.length; i++) { 45 | (result[i].status, result[i].data) = getBytes(calls[i].target, calls[i].data); 46 | } 47 | 48 | // Override the initcode with our result 49 | bytes memory output = abi.encode(block.number, result); 50 | assembly { 51 | return(add(output, 0x20), mload(output)) 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /lib.commonjs/README.md: -------------------------------------------------------------------------------- 1 | Generated Code (CommonJS) 2 | ========================= 3 | 4 | Do not modify code in this folder. 5 | 6 | See `/src.ts/` and `/tsconfig.commonjs.json`. 7 | -------------------------------------------------------------------------------- /lib.commonjs/_build.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This creates an importable version of the multicall bytecode and 3 | * ABI for use in otther parts of the library. 4 | * 5 | * Build command: npm run build-solc 6 | * Output: src.ts/_contract.ts 7 | */ 8 | export {}; 9 | //# sourceMappingURL=_build.d.ts.map -------------------------------------------------------------------------------- /lib.commonjs/_build.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"_build.d.ts","sourceRoot":"","sources":["../src.ts/_build.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"} -------------------------------------------------------------------------------- /lib.commonjs/_build.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /** 3 | * This creates an importable version of the multicall bytecode and 4 | * ABI for use in otther parts of the library. 5 | * 6 | * Build command: npm run build-solc 7 | * Output: src.ts/_contract.ts 8 | */ 9 | var __importDefault = (this && this.__importDefault) || function (mod) { 10 | return (mod && mod.__esModule) ? mod : { "default": mod }; 11 | }; 12 | Object.defineProperty(exports, "__esModule", { value: true }); 13 | const fs_1 = __importDefault(require("fs")); 14 | const ethers_1 = require("ethers"); 15 | function stripErrors(lines) { 16 | const output = []; 17 | for (const line of lines.split(/\n/g)) { 18 | if (line.startsWith(">>>")) { 19 | continue; 20 | } 21 | output.push(line); 22 | } 23 | return output.join("\n"); 24 | } 25 | const _result = fs_1.default.readFileSync("./misc/output/result.json").toString(); 26 | const result = JSON.parse(stripErrors(_result)); 27 | const abi = result.contracts["multicall.sol"].Multicall.abi; 28 | const iface = new ethers_1.Interface(abi); 29 | const bin = (0, ethers_1.getBytes)("0x" + result.contracts["multicall.sol"].Multicall.evm.bytecode.object); 30 | const output = []; 31 | output.push(`/* Do NOT modify this file; it is generated by _build.ts. */`); 32 | output.push(`/* Any changes will be clobbered on the next build. */`); 33 | output.push(`import { decodeBase64, hexlify } from "ethers";`); 34 | output.push(`export const bin = hexlify(decodeBase64("${(0, ethers_1.encodeBase64)(bin)}"));`); 35 | output.push(`export const abi = [`); 36 | for (let fragment of iface.format()) { 37 | if (fragment.match(/constructor/)) { 38 | fragment = fragment.replace(/ nonpayable/, ""); 39 | } 40 | output.push(` ${JSON.stringify(fragment)},`); 41 | } 42 | output.push(`];`); 43 | fs_1.default.writeFileSync("./src.ts/_contract.ts", output.join("\n")); 44 | //# sourceMappingURL=_build.js.map -------------------------------------------------------------------------------- /lib.commonjs/_build.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"_build.js","sourceRoot":"","sources":["../src.ts/_build.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;AAEH,4CAAoB;AAEpB,mCAA2D;AAE3D,SAAS,WAAW,CAAC,KAAa;IAC9B,MAAM,MAAM,GAAkB,EAAG,CAAC;IAClC,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QACpC,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YAAC,SAAS;QAAC,CAAC;QACzC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,OAAO,GAAG,YAAE,CAAC,YAAY,CAAC,2BAA2B,CAAC,CAAC,QAAQ,EAAE,CAAC;AACxE,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;AAChD,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC;AAC5D,MAAM,KAAK,GAAG,IAAI,kBAAS,CAAC,GAAG,CAAC,CAAC;AACjC,MAAM,GAAG,GAAG,IAAA,iBAAQ,EAAC,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAE7F,MAAM,MAAM,GAAG,EAAG,CAAC;AACnB,MAAM,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;AAC5E,MAAM,CAAC,IAAI,CAAC,yDAAyD,CAAC,CAAC;AACvE,MAAM,CAAC,IAAI,CAAC,iDAAiD,CAAC,CAAC;AAC/D,MAAM,CAAC,IAAI,CAAC,4CAA6C,IAAA,qBAAY,EAAC,GAAG,CAAE,MAAM,CAAC,CAAC;AACnF,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;AACpC,KAAK,IAAI,QAAQ,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;IAClC,IAAI,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC;QAChC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;IACnD,CAAC;IACD,MAAM,CAAC,IAAI,CAAC,KAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAE,GAAG,CAAC,CAAC;AACpD,CAAC;AACD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAGlB,YAAE,CAAC,aAAa,CAAC,uBAAuB,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC"} -------------------------------------------------------------------------------- /lib.commonjs/_contract.d.ts: -------------------------------------------------------------------------------- 1 | export declare const bin: string; 2 | export declare const abi: string[]; 3 | //# sourceMappingURL=_contract.d.ts.map -------------------------------------------------------------------------------- /lib.commonjs/_contract.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"_contract.d.ts","sourceRoot":"","sources":["../src.ts/_contract.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,GAAG,QAAgmD,CAAC;AACjnD,eAAO,MAAM,GAAG,UAEf,CAAC"} -------------------------------------------------------------------------------- /lib.commonjs/_contract.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.abi = exports.bin = void 0; 4 | /* Do NOT modify this file; it is generated by _build.ts. */ 5 | /* Any changes will be clobbered on the next build. */ 6 | const ethers_1 = require("ethers"); 7 | exports.bin = (0, ethers_1.hexlify)((0, ethers_1.decodeBase64)("YIBgQFI0gBVhABBXYACA/VtQYEBRYQSxOAOAYQSxgzmBAWBAgZBSYQAvkWECWlZbYACBUWABYEBgAgoDgREVYQBKV2EASmEBr1ZbYEBRkICCUoBgIAJgIAGCAWBAUoAVYQCQV4FgIAFbYECAUYCCAZCRUmAAgVJgYGAgggFSgVJgIAGQYAGQA5CBYQBoV5BQW1CQUGAAW4JRgRAVYQE/V2EA8oOCgVGBEGEAtFdhALRhA+NWW2AgAmAgAQFRYAABUYSDgVGBEGEA0ldhANJhA+NWW2AgAmAgAQFRYCABUWEBbmQBAAAAAAJkAQAAAACQBFZbg4OBUYEQYQEEV2EBBGED41ZbYCACYCABAVFgAAGEhIFRgRBhASFXYQEhYQPjVltgIJCBApGQkQGBAVEBkZCRUpAVFZBSYAEBYQCWVltQYABDgmBAUWAgAWEBVZKRkGEEElZbYEBRYCCBgwMDgVKQYEBSkFCAUWAgggHzW2AAYGBgQFGQUGAAgVJgIIEBYEBSYACAhFFgIIYBh1r6YD89AWAfGRaCAWBAUj2CUpFQPWAAYCCDAT6SUJKQUFZbf05Ie3EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYABSYEFgBFJgJGAA/VtgQIBRkIEBYAFgQGACCgOBEYKCEBcVYQIAV2ECAGEBr1ZbYEBSkFZbYEBRYB+CAWAfGRaBAWABYEBgAgoDgRGCghAXFWECLldhAi5hAa9WW2BAUpGQUFZbYABbg4EQFWECUVeBgQFRg4IBUmAgAWECOVZbUFBgAJEBUlZbYABgIIKEAxIVYQJsV2AAgP1bgVFgAWBAYAIKA4ERFWECgldgAID9W4IBYB+BAYQTYQKTV2AAgP1bgFFgAWBAYAIKA4ERFWECrFdhAqxhAa9WW2AggQJhArxgIIIBYQIGVluRglJgIIGEAYEBkpCBAZCHhBEVYQLYV2AAgP1bYCCFAZJQW4ODEBVhA9hXglFgAWBAYAIKA4ERFWEC/VdgAID9W4UBYECBigNgHxkBEhVhAxNXYACA/VthAxthAd5WW2AgggFRYAFgoGACCgOBFoEUYQM1V2AAgP1bgVJgQIIBUWABYEBgAgoDgREVYQNQV2AAgP1bYCCBhAEBklBQiWAfgwESYQNoV2AAgP1bgVFgAWBAYAIKA4ERFWEDgVdhA4FhAa9WW2EDlGAfggFgHxkWYCABYQIGVluBgVKLYCCDhgEBERVhA6lXYACA/VthA7qCYCCDAWAghwFhAjZWW4BgIIQBUlBQgIRSUFBgIIIBkVBgIIMBklBhAt9WW5eWUFBQUFBQUFZbf05Ie3EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYABSYDJgBFJgJGAA/VtgAGBAggGEg1JgQGAghAFSgIRRgINSYGCFAZFQYGBgIIIChgEBklBgIIYBYABbgoEQFWEEo1dgXxmHhgMBhFKBUYBRFRWGUmAggQFRkFBgQGAghwFSgFGAYECIAVJhBICBYGCJAWAghQFhAjZWW2AfAWAfGRaVkJUBYGABlFBgIJOEAZORkJEBkGABAWEEQFZbUJKXllBQUFBQUFBW/g==")); 8 | exports.abi = [ 9 | "constructor((address target, bytes data)[] calls)", 10 | ]; 11 | //# sourceMappingURL=_contract.js.map -------------------------------------------------------------------------------- /lib.commonjs/_contract.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"_contract.js","sourceRoot":"","sources":["../src.ts/_contract.ts"],"names":[],"mappings":";;;AAAA,4DAA4D;AAC5D,uDAAuD;AACvD,mCAA+C;AAClC,QAAA,GAAG,GAAG,IAAA,gBAAO,EAAC,IAAA,qBAAY,EAAC,skDAAskD,CAAC,CAAC,CAAC;AACpmD,QAAA,GAAG,GAAG;IACjB,mDAAmD;CACpD,CAAC"} -------------------------------------------------------------------------------- /lib.commonjs/index.d.ts: -------------------------------------------------------------------------------- 1 | export { MulticallProvider } from "./provider-multicall.js"; 2 | export type { CallResult } from "./provider-multicall.js"; 3 | //# sourceMappingURL=index.d.ts.map -------------------------------------------------------------------------------- /lib.commonjs/index.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC"} -------------------------------------------------------------------------------- /lib.commonjs/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.MulticallProvider = void 0; 4 | var provider_multicall_js_1 = require("./provider-multicall.js"); 5 | Object.defineProperty(exports, "MulticallProvider", { enumerable: true, get: function () { return provider_multicall_js_1.MulticallProvider; } }); 6 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /lib.commonjs/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":";;;AACA,iEAA4D;AAAnD,0HAAA,iBAAiB,OAAA"} -------------------------------------------------------------------------------- /lib.commonjs/multicall.d.ts: -------------------------------------------------------------------------------- 1 | import type { Result } from "ethers"; 2 | export declare function encodeCall(calls: Array<{ 3 | to: string; 4 | data: string; 5 | }>): string; 6 | export declare function decodeResult(data: string): Result; 7 | //# sourceMappingURL=multicall.d.ts.map -------------------------------------------------------------------------------- /lib.commonjs/multicall.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"multicall.d.ts","sourceRoot":"","sources":["../src.ts/multicall.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,MAAM,CAI7E;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD"} -------------------------------------------------------------------------------- /lib.commonjs/multicall.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | // @TODO: expose a nice API for the encode/decode directly 3 | Object.defineProperty(exports, "__esModule", { value: true }); 4 | exports.encodeCall = encodeCall; 5 | exports.decodeResult = decodeResult; 6 | const ethers_1 = require("ethers"); 7 | const _contract_js_1 = require("./_contract.js"); 8 | function encodeCall(calls) { 9 | return (0, ethers_1.concat)([_contract_js_1.bin, ethers_1.AbiCoder.defaultAbiCoder().encode([ 10 | "tuple(address to, bytes data)[]" 11 | ], [calls])]); 12 | } 13 | function decodeResult(data) { 14 | throw new Error("not implemented"); 15 | } 16 | //# sourceMappingURL=multicall.js.map -------------------------------------------------------------------------------- /lib.commonjs/multicall.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"multicall.js","sourceRoot":"","sources":["../src.ts/multicall.ts"],"names":[],"mappings":";AAAA,0DAA0D;;AAQ1D,gCAIC;AAED,oCAEC;AAdD,mCAA0C;AAE1C,iDAAqC;AAIrC,SAAgB,UAAU,CAAC,KAA0C;IACjE,OAAO,IAAA,eAAM,EAAC,CAAE,kBAAG,EAAE,iBAAQ,CAAC,eAAe,EAAE,CAAC,MAAM,CAAC;YAC/C,iCAAiC;SACpC,EAAE,CAAE,KAAK,CAAE,CAAC,CAAC,CAAC,CAAC;AACxB,CAAC;AAED,SAAgB,YAAY,CAAC,IAAY;IACrC,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;AACvC,CAAC"} -------------------------------------------------------------------------------- /lib.commonjs/multicaller.d.ts: -------------------------------------------------------------------------------- 1 | import { Result } from "ethers"; 2 | import type { Provider } from "ethers"; 3 | export interface Call { 4 | target: string; 5 | data: string; 6 | } 7 | export interface CallResult { 8 | status: boolean; 9 | data: string; 10 | } 11 | export interface PreparedCall { 12 | resolve: () => Promise; 13 | decode: (status: boolean, data: string) => Result; 14 | } 15 | export declare class Multicaller { 16 | readonly provider: Provider; 17 | constructor(provider: Provider); 18 | _multicall(calls: Array): Promise>; 19 | multicall(_calls: Array): Promise>; 20 | } 21 | //# sourceMappingURL=multicaller.d.ts.map -------------------------------------------------------------------------------- /lib.commonjs/multicaller.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"multicaller.d.ts","sourceRoot":"","sources":["../src.ts/multicaller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIlD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAGvC,MAAM,WAAW,IAAI;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,UAAU;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CAChB;AAID,MAAM,WAAW,YAAY;IACzB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACrD;AAGD,qBAAa,WAAW;IACpB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;gBAEhB,QAAQ,EAAE,QAAQ;IAIxB,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAgB1D,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;CAavE"} -------------------------------------------------------------------------------- /lib.commonjs/multicaller.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 3 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 4 | return new (P || (P = Promise))(function (resolve, reject) { 5 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 6 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 7 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 8 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 9 | }); 10 | }; 11 | Object.defineProperty(exports, "__esModule", { value: true }); 12 | exports.Multicaller = void 0; 13 | const ethers_1 = require("ethers"); 14 | const _contract_js_1 = require("./_contract.js"); 15 | class Multicaller { 16 | constructor(provider) { 17 | this.provider = provider; 18 | } 19 | _multicall(calls) { 20 | return __awaiter(this, void 0, void 0, function* () { 21 | const data = (0, ethers_1.concat)([_contract_js_1.bin, ethers_1.AbiCoder.defaultAbiCoder().encode([ 22 | "tuple(address target, bytes data)[]" 23 | ], [calls])]); 24 | const resultData = yield this.provider.call({ data }); 25 | const [blockNumber, results] = ethers_1.AbiCoder.defaultAbiCoder().decode([ 26 | "uint blockNumber", "tuple(bool status, bytes data)[] results" 27 | ], resultData); 28 | if (blockNumber) { } // @TODO: check block number 29 | return results.map((result) => ({ status: result[0], data: result[1] })); 30 | }); 31 | } 32 | multicall(_calls) { 33 | return __awaiter(this, void 0, void 0, function* () { 34 | const calls = yield Promise.all(_calls.map((call) => call.resolve())); 35 | const results = yield this._multicall(calls); 36 | return ethers_1.Result.fromItems(results.map(({ status, data }, index) => { 37 | try { 38 | return _calls[index].decode(status, data); 39 | } 40 | catch (error) { 41 | return error; 42 | } 43 | })); 44 | }); 45 | } 46 | } 47 | exports.Multicaller = Multicaller; 48 | //# sourceMappingURL=multicaller.js.map -------------------------------------------------------------------------------- /lib.commonjs/multicaller.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"multicaller.js","sourceRoot":"","sources":["../src.ts/multicaller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAAkD;AAElD,iDAAqC;AAuBrC,MAAa,WAAW;IAGpB,YAAY,QAAkB;QAC1B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAEK,UAAU,CAAC,KAAkB;;YAC/B,MAAM,IAAI,GAAG,IAAA,eAAM,EAAC,CAAE,kBAAG,EAAE,iBAAQ,CAAC,eAAe,EAAE,CAAC,MAAM,CAAC;oBACzD,qCAAqC;iBACxC,EAAE,CAAE,KAAK,CAAE,CAAC,CAAC,CAAC,CAAC;YAEhB,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;YAEtD,MAAM,CAAE,WAAW,EAAE,OAAO,CAAE,GAAG,iBAAQ,CAAC,eAAe,EAAE,CAAC,MAAM,CAAC;gBAC/D,kBAAkB,EAAE,0CAA0C;aACjE,EAAE,UAAU,CAAC,CAAC;YAEf,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,4BAA4B;YAEjD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAW,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAClF,CAAC;KAAA;IAEK,SAAS,CAAC,MAA2B;;YACvC,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YAEtE,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YAE7C,OAAO,eAAM,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE;gBAC5D,IAAI,CAAC;oBACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;gBAC9C,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACb,OAAO,KAAK,CAAC;gBACjB,CAAC;YACL,CAAC,CAAC,CAAC,CAAC;QACR,CAAC;KAAA;CACJ;AApCD,kCAoCC"} -------------------------------------------------------------------------------- /lib.commonjs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "sideEffects": false, 3 | "type": "commonjs" 4 | } 5 | -------------------------------------------------------------------------------- /lib.commonjs/provider-multicall.d.ts: -------------------------------------------------------------------------------- 1 | import { AbstractProvider } from "ethers"; 2 | import type { PerformActionRequest, BlockTag } from "ethers"; 3 | export type DebugEventMulticallProvider = { 4 | action: "sendMulticall"; 5 | calls: Array<{ 6 | to: string; 7 | data: string; 8 | }>; 9 | data: string; 10 | } | { 11 | action: "receiveMulticallResult"; 12 | calls: Array<{ 13 | to: string; 14 | data: string; 15 | }>; 16 | data: string; 17 | status: boolean; 18 | result: string; 19 | }; 20 | export type CallResult = { 21 | status: boolean; 22 | data: string; 23 | }; 24 | export declare class MulticallProvider extends AbstractProvider { 25 | #private; 26 | readonly subprovider: AbstractProvider; 27 | constructor(provider: AbstractProvider); 28 | get drainInterval(): number; 29 | set drainInterval(value: number); 30 | queueCall(to: string, data: string, blockTag?: BlockTag): Promise; 31 | drainCallQueue(): Promise; 32 | _detectNetwork(): Promise; 33 | _perform(req: PerformActionRequest): Promise; 34 | } 35 | //# sourceMappingURL=provider-multicall.d.ts.map -------------------------------------------------------------------------------- /lib.commonjs/provider-multicall.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"provider-multicall.d.ts","sourceRoot":"","sources":["../src.ts/provider-multicall.ts"],"names":[],"mappings":"AAAA,OAAO,EACO,gBAAgB,EAE7B,MAAM,QAAQ,CAAC;AAEhB,OAAO,KAAK,EACR,oBAAoB,EAEpB,QAAQ,EACX,MAAM,QAAQ,CAAC;AAIhB,MAAM,MAAM,2BAA2B,GAAG;IACtC,MAAM,EAAE,eAAe,CAAC;IACxB,KAAK,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3C,IAAI,EAAE,MAAM,CAAC;CAChB,GAAG;IACA,MAAM,EAAE,wBAAwB,CAAC;IACjC,KAAK,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAQ3D,qBAAa,iBAAkB,SAAQ,gBAAgB;;IACnD,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC;gBAM3B,QAAQ,EAAE,gBAAgB;IAStC,IAAI,aAAa,IAAI,MAAM,CAAgC;IAC3D,IAAI,aAAa,CAAC,KAAK,EAAE,MAAM,EAyB9B;IAED,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IAYvE,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAyErC,cAAc;IAIR,QAAQ,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,CAAC,CAAC;CAgBjE"} -------------------------------------------------------------------------------- /lib.commonjs/provider-multicall.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 3 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 4 | return new (P || (P = Promise))(function (resolve, reject) { 5 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 6 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 7 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 8 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 9 | }); 10 | }; 11 | var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { 12 | if (kind === "m") throw new TypeError("Private method is not writable"); 13 | if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); 14 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); 15 | return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; 16 | }; 17 | var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { 18 | if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); 19 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); 20 | return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); 21 | }; 22 | var _MulticallProvider_callQueue, _MulticallProvider_drainInterval, _MulticallProvider_drainTimer; 23 | Object.defineProperty(exports, "__esModule", { value: true }); 24 | exports.MulticallProvider = void 0; 25 | const ethers_1 = require("ethers"); 26 | const _contract_js_1 = require("./_contract.js"); 27 | class MulticallProvider extends ethers_1.AbstractProvider { 28 | constructor(provider) { 29 | super(); 30 | _MulticallProvider_callQueue.set(this, void 0); 31 | _MulticallProvider_drainInterval.set(this, void 0); 32 | _MulticallProvider_drainTimer.set(this, void 0); 33 | this.subprovider = provider; 34 | __classPrivateFieldSet(this, _MulticallProvider_callQueue, [], "f"); 35 | __classPrivateFieldSet(this, _MulticallProvider_drainInterval, 10, "f"); 36 | __classPrivateFieldSet(this, _MulticallProvider_drainTimer, null, "f"); 37 | } 38 | get drainInterval() { return __classPrivateFieldGet(this, _MulticallProvider_drainInterval, "f"); } 39 | set drainInterval(value) { 40 | if (value < 0) { 41 | value = -1; 42 | } 43 | if (value === __classPrivateFieldGet(this, _MulticallProvider_drainInterval, "f")) { 44 | return; 45 | } 46 | __classPrivateFieldSet(this, _MulticallProvider_drainInterval, value, "f"); 47 | if (__classPrivateFieldGet(this, _MulticallProvider_drainInterval, "f") >= 0) { 48 | // Clear any existing timer 49 | if (__classPrivateFieldGet(this, _MulticallProvider_drainTimer, "f")) { 50 | clearTimeout(__classPrivateFieldGet(this, _MulticallProvider_drainTimer, "f")); 51 | __classPrivateFieldSet(this, _MulticallProvider_drainTimer, null, "f"); 52 | } 53 | // Start a new one with the updated interval 54 | if (__classPrivateFieldGet(this, _MulticallProvider_callQueue, "f").length) { 55 | __classPrivateFieldSet(this, _MulticallProvider_drainTimer, setTimeout(() => { 56 | this.drainCallQueue(); 57 | }, __classPrivateFieldGet(this, _MulticallProvider_drainInterval, "f")), "f"); 58 | } 59 | } 60 | else if (__classPrivateFieldGet(this, _MulticallProvider_drainTimer, "f")) { 61 | // Disable any existing timer; switching to manual mode 62 | clearTimeout(__classPrivateFieldGet(this, _MulticallProvider_drainTimer, "f")); 63 | __classPrivateFieldSet(this, _MulticallProvider_drainTimer, null, "f"); 64 | } 65 | } 66 | ; 67 | queueCall(to, data, blockTag) { 68 | if (__classPrivateFieldGet(this, _MulticallProvider_drainTimer, "f") == null && __classPrivateFieldGet(this, _MulticallProvider_drainInterval, "f") >= 0) { 69 | __classPrivateFieldSet(this, _MulticallProvider_drainTimer, setTimeout(() => { 70 | this.drainCallQueue(); 71 | }, __classPrivateFieldGet(this, _MulticallProvider_drainInterval, "f")), "f"); 72 | } 73 | return new Promise((resolve, reject) => { 74 | __classPrivateFieldGet(this, _MulticallProvider_callQueue, "f").push({ request: { to, data, blockTag }, resolve, reject }); 75 | }); 76 | } 77 | drainCallQueue() { 78 | return __awaiter(this, void 0, void 0, function* () { 79 | __classPrivateFieldSet(this, _MulticallProvider_drainTimer, null, "f"); 80 | const _callQueue = __classPrivateFieldGet(this, _MulticallProvider_callQueue, "f"); 81 | __classPrivateFieldSet(this, _MulticallProvider_callQueue, [], "f"); 82 | const blockTags = _callQueue.reduce((accum, { request }) => { 83 | const blockTag = request.blockTag; 84 | if (blockTag != null && accum.indexOf(blockTag) === -1) { 85 | accum.push(blockTag); 86 | } 87 | return accum; 88 | }, []); 89 | const runners = []; 90 | for (const blockTag of blockTags) { 91 | const callQueue = _callQueue.filter(({ request }) => request.blockTag === blockTag); 92 | const data = (0, ethers_1.concat)([_contract_js_1.bin, ethers_1.AbiCoder.defaultAbiCoder().encode([ 93 | "tuple(address, bytes)[]" 94 | ], [ 95 | callQueue.map(({ request }) => { 96 | return [request.to, request.data]; 97 | }) 98 | ])]); 99 | this.emit("debug", { 100 | action: "sendMulticall", data, 101 | call: callQueue.map(({ request }) => { 102 | return { to: request.to, data: request.data }; 103 | }) 104 | }); 105 | runners.push((() => __awaiter(this, void 0, void 0, function* () { 106 | const _data = yield this.subprovider.call({ data, blockTag }); 107 | const [_blockNumber, results] = ethers_1.AbiCoder.defaultAbiCoder().decode(["uint", "tuple(bool, bytes)[]"], _data); 108 | const blockNumber = (0, ethers_1.toQuantity)(_blockNumber); 109 | if (blockTag !== "latest" && blockTag !== "pending" && blockNumber !== blockTag) { 110 | callQueue.forEach(({ reject }) => { 111 | reject((0, ethers_1.makeError)("backend does not support archive access", "UNSUPPORTED_OPERATION", { 112 | operation: "call(blockTag)", 113 | info: { expectedBlockTag: blockTag, blockNumber } 114 | })); 115 | }); 116 | } 117 | this.emit("debug", { 118 | action: "receiveMulticallResult", data, 119 | call: callQueue.map(({ request }, i) => { 120 | return { 121 | to: request.to, data: request.data, 122 | status: results[i][0], result: results[i][1] 123 | }; 124 | }) 125 | }); 126 | const output = []; 127 | for (let i = 0; i < callQueue.length; i++) { 128 | const result = results[i]; 129 | const { resolve } = callQueue[i]; 130 | resolve({ status: result[0], data: result[1] }); 131 | output.push({ status: result[0], data: result[1] }); 132 | } 133 | }))()); 134 | } 135 | yield Promise.all(runners); 136 | }); 137 | } 138 | _detectNetwork() { 139 | return this.subprovider._detectNetwork(); 140 | } 141 | _perform(req) { 142 | return __awaiter(this, void 0, void 0, function* () { 143 | if (req.method === "call") { 144 | const tx = req.transaction; 145 | const to = (tx.to || null), data = (tx.data || "0x"); 146 | (0, ethers_1.assertArgument)(typeof (to) === "string", "deployment transactions unsupported", "tx.to", tx.to); 147 | const result = yield this.queueCall(to, data, req.blockTag); 148 | if (result.status) { 149 | return result.data; 150 | } 151 | // Throw a CallException 152 | throw ethers_1.AbiCoder.getBuiltinCallException("call", { to, data }, result.data); 153 | } 154 | return yield this.subprovider._perform(req); 155 | }); 156 | } 157 | } 158 | exports.MulticallProvider = MulticallProvider; 159 | _MulticallProvider_callQueue = new WeakMap(), _MulticallProvider_drainInterval = new WeakMap(), _MulticallProvider_drainTimer = new WeakMap(); 160 | //# sourceMappingURL=provider-multicall.js.map -------------------------------------------------------------------------------- /lib.commonjs/provider-multicall.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"provider-multicall.js","sourceRoot":"","sources":["../src.ts/provider-multicall.ts"],"names":[],"mappings":"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"} -------------------------------------------------------------------------------- /lib.commonjs/test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | //# sourceMappingURL=test.d.ts.map -------------------------------------------------------------------------------- /lib.commonjs/test.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../src.ts/test.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /lib.commonjs/test.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 3 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 4 | return new (P || (P = Promise))(function (resolve, reject) { 5 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 6 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 7 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 8 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 9 | }); 10 | }; 11 | Object.defineProperty(exports, "__esModule", { value: true }); 12 | const ethers_1 = require("ethers"); 13 | const provider_multicall_js_1 = require("./provider-multicall.js"); 14 | /* 15 | import { bin, abi } from "./_contract.js"; 16 | (async function() { 17 | const provider = new ethers.InfuraProvider(); 18 | 19 | const contract = new ethers.Contract("dai.tokens.ethers.eth", [ 20 | "function name() view returns (string)", 21 | "function symbol() view returns (string)", 22 | ], provider); 23 | 24 | const calls = await Promise.all([ 25 | contract.name.populateTransaction(), 26 | contract.symbol.populateTransaction(), 27 | ]); 28 | console.log("CALLS", calls); 29 | 30 | const iface = new ethers.Interface(abi); 31 | console.log(iface.deploy); 32 | const args = calls.map((c) => { 33 | //(address, bool, bytes) 34 | return [ c.to, false, c.data ]; 35 | }); 36 | console.log("ARGS", args); 37 | const data = ethers.concat([ 38 | bin, 39 | iface.encodeDeploy([ args ]) 40 | ]); 41 | console.log("DATA", data); 42 | 43 | let result = await provider.call({ data }); 44 | // result = ethers.concat([ 45 | // "0x0000000000000000000000000000000000000000000000000000000000000020", 46 | // result 47 | // ]); 48 | 49 | console.log("RESULT", result); 50 | console.log(iface.getFunction("aggregate3Value")); 51 | console.log(iface.decodeFunctionResult("aggregate3Value", result)); 52 | })(); 53 | */ 54 | (function () { 55 | return __awaiter(this, void 0, void 0, function* () { 56 | const subprovider = new ethers_1.ethers.InfuraProvider(); 57 | //const subprovider = new ethers.ChainstackProvider(); 58 | //const subprovider = new ethers.QuickNodeProvider(); 59 | /* 60 | subprovider.on("debug", (req) => { 61 | console.log("SUB"); 62 | console.dir(req, { depth: null }); 63 | }); 64 | */ 65 | const provider = new provider_multicall_js_1.MulticallProvider(subprovider); 66 | const contract = new ethers_1.ethers.Contract("dai.tokens.ethers.eth", [ 67 | "function name() view returns (string)", 68 | "function symbol() view returns (string)", 69 | "function balanceOf(address) view returns (uint256)", 70 | "function balanceOf(address) view returns (uint256)", 71 | ], provider); 72 | /* 73 | provider.on("debug", (req) => { 74 | console.log("MULTI"); 75 | console.dir(req, { depth: null }); 76 | }); 77 | */ 78 | const blockNumber = yield provider.getBlockNumber(); 79 | const ricmooEth = "0x5555763613a12d8f3e73be831dff8598089d3dca"; 80 | const [name, sym, balance, balance_1] = yield Promise.all([ 81 | contract.name({ blockTag: "latest" }), 82 | contract.symbol({ blockTag: "latest" }), 83 | contract.balanceOf(ricmooEth, { blockTag: "latest" }), 84 | contract.balanceOf(ricmooEth, { blockTag: blockNumber - 1 }), 85 | ]); 86 | console.log({ name, sym, balance, balance_1 }); 87 | }); 88 | })(); 89 | //# sourceMappingURL=test.js.map -------------------------------------------------------------------------------- /lib.commonjs/test.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"test.js","sourceRoot":"","sources":["../src.ts/test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mCAAgC;AAEhC,mEAA4D;AAC5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCE;AAEF,CAAC;;QACG,MAAM,WAAW,GAAG,IAAI,eAAM,CAAC,cAAc,EAAE,CAAC;QAChD,sDAAsD;QACtD,qDAAqD;QACrD;;;;;UAKE;QAEF,MAAM,QAAQ,GAAG,IAAI,yCAAiB,CAAC,WAAW,CAAC,CAAC;QAEpD,MAAM,QAAQ,GAAG,IAAI,eAAM,CAAC,QAAQ,CAAC,uBAAuB,EAAE;YAC1D,uCAAuC;YACvC,yCAAyC;YACzC,oDAAoD;YACpD,oDAAoD;SACvD,EAAE,QAAQ,CAAC,CAAC;QACjB;;;;;UAKE;QACE,MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC,cAAc,EAAE,CAAC;QACpD,MAAM,SAAS,GAAG,4CAA4C,CAAC;QAE/D,MAAM,CAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,CAAE,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACxD,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;YACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;YACvC,QAAQ,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;YACrD,QAAQ,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,WAAW,GAAG,CAAC,EAAE,CAAC;SAC/D,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;IACnD,CAAC;CAAA,CAAC,EAAE,CAAC"} -------------------------------------------------------------------------------- /lib.esm/README.md: -------------------------------------------------------------------------------- 1 | Generated Code (ESM) 2 | ==================== 3 | 4 | Do not modify code in this folder. 5 | 6 | See `/src.ts/` and `/tsconfig.esm.json`. 7 | -------------------------------------------------------------------------------- /lib.esm/_build.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This creates an importable version of the multicall bytecode and 3 | * ABI for use in otther parts of the library. 4 | * 5 | * Build command: npm run build-solc 6 | * Output: src.ts/_contract.ts 7 | */ 8 | export {}; 9 | //# sourceMappingURL=_build.d.ts.map -------------------------------------------------------------------------------- /lib.esm/_build.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"_build.d.ts","sourceRoot":"","sources":["../src.ts/_build.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"} -------------------------------------------------------------------------------- /lib.esm/_build.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This creates an importable version of the multicall bytecode and 3 | * ABI for use in otther parts of the library. 4 | * 5 | * Build command: npm run build-solc 6 | * Output: src.ts/_contract.ts 7 | */ 8 | import fs from "fs"; 9 | import { encodeBase64, getBytes, Interface } from "ethers"; 10 | function stripErrors(lines) { 11 | const output = []; 12 | for (const line of lines.split(/\n/g)) { 13 | if (line.startsWith(">>>")) { 14 | continue; 15 | } 16 | output.push(line); 17 | } 18 | return output.join("\n"); 19 | } 20 | const _result = fs.readFileSync("./misc/output/result.json").toString(); 21 | const result = JSON.parse(stripErrors(_result)); 22 | const abi = result.contracts["multicall.sol"].Multicall.abi; 23 | const iface = new Interface(abi); 24 | const bin = getBytes("0x" + result.contracts["multicall.sol"].Multicall.evm.bytecode.object); 25 | const output = []; 26 | output.push(`/* Do NOT modify this file; it is generated by _build.ts. */`); 27 | output.push(`/* Any changes will be clobbered on the next build. */`); 28 | output.push(`import { decodeBase64, hexlify } from "ethers";`); 29 | output.push(`export const bin = hexlify(decodeBase64("${encodeBase64(bin)}"));`); 30 | output.push(`export const abi = [`); 31 | for (let fragment of iface.format()) { 32 | if (fragment.match(/constructor/)) { 33 | fragment = fragment.replace(/ nonpayable/, ""); 34 | } 35 | output.push(` ${JSON.stringify(fragment)},`); 36 | } 37 | output.push(`];`); 38 | fs.writeFileSync("./src.ts/_contract.ts", output.join("\n")); 39 | //# sourceMappingURL=_build.js.map -------------------------------------------------------------------------------- /lib.esm/_build.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"_build.js","sourceRoot":"","sources":["../src.ts/_build.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAE3D,SAAS,WAAW,CAAC,KAAa;IAC9B,MAAM,MAAM,GAAkB,EAAG,CAAC;IAClC,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QACpC,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YAAC,SAAS;QAAC,CAAC;QACzC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,2BAA2B,CAAC,CAAC,QAAQ,EAAE,CAAC;AACxE,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;AAChD,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC;AAC5D,MAAM,KAAK,GAAG,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC;AACjC,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAE7F,MAAM,MAAM,GAAG,EAAG,CAAC;AACnB,MAAM,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;AAC5E,MAAM,CAAC,IAAI,CAAC,yDAAyD,CAAC,CAAC;AACvE,MAAM,CAAC,IAAI,CAAC,iDAAiD,CAAC,CAAC;AAC/D,MAAM,CAAC,IAAI,CAAC,4CAA6C,YAAY,CAAC,GAAG,CAAE,MAAM,CAAC,CAAC;AACnF,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;AACpC,KAAK,IAAI,QAAQ,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;IAClC,IAAI,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC;QAChC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;IACnD,CAAC;IACD,MAAM,CAAC,IAAI,CAAC,KAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAE,GAAG,CAAC,CAAC;AACpD,CAAC;AACD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAGlB,EAAE,CAAC,aAAa,CAAC,uBAAuB,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC"} -------------------------------------------------------------------------------- /lib.esm/_contract.d.ts: -------------------------------------------------------------------------------- 1 | export declare const bin: string; 2 | export declare const abi: string[]; 3 | //# sourceMappingURL=_contract.d.ts.map -------------------------------------------------------------------------------- /lib.esm/_contract.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"_contract.d.ts","sourceRoot":"","sources":["../src.ts/_contract.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,GAAG,QAAgmD,CAAC;AACjnD,eAAO,MAAM,GAAG,UAEf,CAAC"} -------------------------------------------------------------------------------- /lib.esm/_contract.js: -------------------------------------------------------------------------------- 1 | /* Do NOT modify this file; it is generated by _build.ts. */ 2 | /* Any changes will be clobbered on the next build. */ 3 | import { decodeBase64, hexlify } from "ethers"; 4 | export const bin = hexlify(decodeBase64("YIBgQFI0gBVhABBXYACA/VtQYEBRYQSxOAOAYQSxgzmBAWBAgZBSYQAvkWECWlZbYACBUWABYEBgAgoDgREVYQBKV2EASmEBr1ZbYEBRkICCUoBgIAJgIAGCAWBAUoAVYQCQV4FgIAFbYECAUYCCAZCRUmAAgVJgYGAgggFSgVJgIAGQYAGQA5CBYQBoV5BQW1CQUGAAW4JRgRAVYQE/V2EA8oOCgVGBEGEAtFdhALRhA+NWW2AgAmAgAQFRYAABUYSDgVGBEGEA0ldhANJhA+NWW2AgAmAgAQFRYCABUWEBbmQBAAAAAAJkAQAAAACQBFZbg4OBUYEQYQEEV2EBBGED41ZbYCACYCABAVFgAAGEhIFRgRBhASFXYQEhYQPjVltgIJCBApGQkQGBAVEBkZCRUpAVFZBSYAEBYQCWVltQYABDgmBAUWAgAWEBVZKRkGEEElZbYEBRYCCBgwMDgVKQYEBSkFCAUWAgggHzW2AAYGBgQFGQUGAAgVJgIIEBYEBSYACAhFFgIIYBh1r6YD89AWAfGRaCAWBAUj2CUpFQPWAAYCCDAT6SUJKQUFZbf05Ie3EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYABSYEFgBFJgJGAA/VtgQIBRkIEBYAFgQGACCgOBEYKCEBcVYQIAV2ECAGEBr1ZbYEBSkFZbYEBRYB+CAWAfGRaBAWABYEBgAgoDgRGCghAXFWECLldhAi5hAa9WW2BAUpGQUFZbYABbg4EQFWECUVeBgQFRg4IBUmAgAWECOVZbUFBgAJEBUlZbYABgIIKEAxIVYQJsV2AAgP1bgVFgAWBAYAIKA4ERFWECgldgAID9W4IBYB+BAYQTYQKTV2AAgP1bgFFgAWBAYAIKA4ERFWECrFdhAqxhAa9WW2AggQJhArxgIIIBYQIGVluRglJgIIGEAYEBkpCBAZCHhBEVYQLYV2AAgP1bYCCFAZJQW4ODEBVhA9hXglFgAWBAYAIKA4ERFWEC/VdgAID9W4UBYECBigNgHxkBEhVhAxNXYACA/VthAxthAd5WW2AgggFRYAFgoGACCgOBFoEUYQM1V2AAgP1bgVJgQIIBUWABYEBgAgoDgREVYQNQV2AAgP1bYCCBhAEBklBQiWAfgwESYQNoV2AAgP1bgVFgAWBAYAIKA4ERFWEDgVdhA4FhAa9WW2EDlGAfggFgHxkWYCABYQIGVluBgVKLYCCDhgEBERVhA6lXYACA/VthA7qCYCCDAWAghwFhAjZWW4BgIIQBUlBQgIRSUFBgIIIBkVBgIIMBklBhAt9WW5eWUFBQUFBQUFZbf05Ie3EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYABSYDJgBFJgJGAA/VtgAGBAggGEg1JgQGAghAFSgIRRgINSYGCFAZFQYGBgIIIChgEBklBgIIYBYABbgoEQFWEEo1dgXxmHhgMBhFKBUYBRFRWGUmAggQFRkFBgQGAghwFSgFGAYECIAVJhBICBYGCJAWAghQFhAjZWW2AfAWAfGRaVkJUBYGABlFBgIJOEAZORkJEBkGABAWEEQFZbUJKXllBQUFBQUFBW/g==")); 5 | export const abi = [ 6 | "constructor((address target, bytes data)[] calls)", 7 | ]; 8 | //# sourceMappingURL=_contract.js.map -------------------------------------------------------------------------------- /lib.esm/_contract.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"_contract.js","sourceRoot":"","sources":["../src.ts/_contract.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,uDAAuD;AACvD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAC/C,MAAM,CAAC,MAAM,GAAG,GAAG,OAAO,CAAC,YAAY,CAAC,skDAAskD,CAAC,CAAC,CAAC;AACjnD,MAAM,CAAC,MAAM,GAAG,GAAG;IACjB,mDAAmD;CACpD,CAAC"} -------------------------------------------------------------------------------- /lib.esm/index.d.ts: -------------------------------------------------------------------------------- 1 | export { MulticallProvider } from "./provider-multicall.js"; 2 | export type { CallResult } from "./provider-multicall.js"; 3 | //# sourceMappingURL=index.d.ts.map -------------------------------------------------------------------------------- /lib.esm/index.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC"} -------------------------------------------------------------------------------- /lib.esm/index.js: -------------------------------------------------------------------------------- 1 | export { MulticallProvider } from "./provider-multicall.js"; 2 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /lib.esm/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC"} -------------------------------------------------------------------------------- /lib.esm/multicall.d.ts: -------------------------------------------------------------------------------- 1 | import type { Result } from "ethers"; 2 | export declare function encodeCall(calls: Array<{ 3 | to: string; 4 | data: string; 5 | }>): string; 6 | export declare function decodeResult(data: string): Result; 7 | //# sourceMappingURL=multicall.d.ts.map -------------------------------------------------------------------------------- /lib.esm/multicall.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"multicall.d.ts","sourceRoot":"","sources":["../src.ts/multicall.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,MAAM,CAI7E;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD"} -------------------------------------------------------------------------------- /lib.esm/multicall.js: -------------------------------------------------------------------------------- 1 | // @TODO: expose a nice API for the encode/decode directly 2 | import { AbiCoder, concat } from "ethers"; 3 | import { bin } from "./_contract.js"; 4 | export function encodeCall(calls) { 5 | return concat([bin, AbiCoder.defaultAbiCoder().encode([ 6 | "tuple(address to, bytes data)[]" 7 | ], [calls])]); 8 | } 9 | export function decodeResult(data) { 10 | throw new Error("not implemented"); 11 | } 12 | //# sourceMappingURL=multicall.js.map -------------------------------------------------------------------------------- /lib.esm/multicall.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"multicall.js","sourceRoot":"","sources":["../src.ts/multicall.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAE1D,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE1C,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAIrC,MAAM,UAAU,UAAU,CAAC,KAA0C;IACjE,OAAO,MAAM,CAAC,CAAE,GAAG,EAAE,QAAQ,CAAC,eAAe,EAAE,CAAC,MAAM,CAAC;YAC/C,iCAAiC;SACpC,EAAE,CAAE,KAAK,CAAE,CAAC,CAAC,CAAC,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAY;IACrC,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;AACvC,CAAC"} -------------------------------------------------------------------------------- /lib.esm/multicaller.d.ts: -------------------------------------------------------------------------------- 1 | import { Result } from "ethers"; 2 | import type { Provider } from "ethers"; 3 | export interface Call { 4 | target: string; 5 | data: string; 6 | } 7 | export interface CallResult { 8 | status: boolean; 9 | data: string; 10 | } 11 | export interface PreparedCall { 12 | resolve: () => Promise; 13 | decode: (status: boolean, data: string) => Result; 14 | } 15 | export declare class Multicaller { 16 | readonly provider: Provider; 17 | constructor(provider: Provider); 18 | _multicall(calls: Array): Promise>; 19 | multicall(_calls: Array): Promise>; 20 | } 21 | //# sourceMappingURL=multicaller.d.ts.map -------------------------------------------------------------------------------- /lib.esm/multicaller.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"multicaller.d.ts","sourceRoot":"","sources":["../src.ts/multicaller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIlD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAGvC,MAAM,WAAW,IAAI;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,UAAU;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CAChB;AAID,MAAM,WAAW,YAAY;IACzB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACrD;AAGD,qBAAa,WAAW;IACpB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;gBAEhB,QAAQ,EAAE,QAAQ;IAIxB,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAgB1D,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;CAavE"} -------------------------------------------------------------------------------- /lib.esm/multicaller.js: -------------------------------------------------------------------------------- 1 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 2 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 3 | return new (P || (P = Promise))(function (resolve, reject) { 4 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 5 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 6 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 7 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 8 | }); 9 | }; 10 | import { AbiCoder, concat, Result } from "ethers"; 11 | import { bin } from "./_contract.js"; 12 | export class Multicaller { 13 | constructor(provider) { 14 | this.provider = provider; 15 | } 16 | _multicall(calls) { 17 | return __awaiter(this, void 0, void 0, function* () { 18 | const data = concat([bin, AbiCoder.defaultAbiCoder().encode([ 19 | "tuple(address target, bytes data)[]" 20 | ], [calls])]); 21 | const resultData = yield this.provider.call({ data }); 22 | const [blockNumber, results] = AbiCoder.defaultAbiCoder().decode([ 23 | "uint blockNumber", "tuple(bool status, bytes data)[] results" 24 | ], resultData); 25 | if (blockNumber) { } // @TODO: check block number 26 | return results.map((result) => ({ status: result[0], data: result[1] })); 27 | }); 28 | } 29 | multicall(_calls) { 30 | return __awaiter(this, void 0, void 0, function* () { 31 | const calls = yield Promise.all(_calls.map((call) => call.resolve())); 32 | const results = yield this._multicall(calls); 33 | return Result.fromItems(results.map(({ status, data }, index) => { 34 | try { 35 | return _calls[index].decode(status, data); 36 | } 37 | catch (error) { 38 | return error; 39 | } 40 | })); 41 | }); 42 | } 43 | } 44 | //# sourceMappingURL=multicaller.js.map -------------------------------------------------------------------------------- /lib.esm/multicaller.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"multicaller.js","sourceRoot":"","sources":["../src.ts/multicaller.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAElD,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAuBrC,MAAM,OAAO,WAAW;IAGpB,YAAY,QAAkB;QAC1B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAEK,UAAU,CAAC,KAAkB;;YAC/B,MAAM,IAAI,GAAG,MAAM,CAAC,CAAE,GAAG,EAAE,QAAQ,CAAC,eAAe,EAAE,CAAC,MAAM,CAAC;oBACzD,qCAAqC;iBACxC,EAAE,CAAE,KAAK,CAAE,CAAC,CAAC,CAAC,CAAC;YAEhB,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;YAEtD,MAAM,CAAE,WAAW,EAAE,OAAO,CAAE,GAAG,QAAQ,CAAC,eAAe,EAAE,CAAC,MAAM,CAAC;gBAC/D,kBAAkB,EAAE,0CAA0C;aACjE,EAAE,UAAU,CAAC,CAAC;YAEf,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,4BAA4B;YAEjD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAW,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAClF,CAAC;KAAA;IAEK,SAAS,CAAC,MAA2B;;YACvC,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YAEtE,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YAE7C,OAAO,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE;gBAC5D,IAAI,CAAC;oBACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;gBAC9C,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACb,OAAO,KAAK,CAAC;gBACjB,CAAC;YACL,CAAC,CAAC,CAAC,CAAC;QACR,CAAC;KAAA;CACJ"} -------------------------------------------------------------------------------- /lib.esm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "sideEffects": false, 3 | "type": "module" 4 | } 5 | -------------------------------------------------------------------------------- /lib.esm/provider-multicall.d.ts: -------------------------------------------------------------------------------- 1 | import { AbstractProvider } from "ethers"; 2 | import type { PerformActionRequest, BlockTag } from "ethers"; 3 | export type DebugEventMulticallProvider = { 4 | action: "sendMulticall"; 5 | calls: Array<{ 6 | to: string; 7 | data: string; 8 | }>; 9 | data: string; 10 | } | { 11 | action: "receiveMulticallResult"; 12 | calls: Array<{ 13 | to: string; 14 | data: string; 15 | }>; 16 | data: string; 17 | status: boolean; 18 | result: string; 19 | }; 20 | export type CallResult = { 21 | status: boolean; 22 | data: string; 23 | }; 24 | export declare class MulticallProvider extends AbstractProvider { 25 | #private; 26 | readonly subprovider: AbstractProvider; 27 | constructor(provider: AbstractProvider); 28 | get drainInterval(): number; 29 | set drainInterval(value: number); 30 | queueCall(to: string, data: string, blockTag?: BlockTag): Promise; 31 | drainCallQueue(): Promise; 32 | _detectNetwork(): Promise; 33 | _perform(req: PerformActionRequest): Promise; 34 | } 35 | //# sourceMappingURL=provider-multicall.d.ts.map -------------------------------------------------------------------------------- /lib.esm/provider-multicall.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"provider-multicall.d.ts","sourceRoot":"","sources":["../src.ts/provider-multicall.ts"],"names":[],"mappings":"AAAA,OAAO,EACO,gBAAgB,EAE7B,MAAM,QAAQ,CAAC;AAEhB,OAAO,KAAK,EACR,oBAAoB,EAEpB,QAAQ,EACX,MAAM,QAAQ,CAAC;AAIhB,MAAM,MAAM,2BAA2B,GAAG;IACtC,MAAM,EAAE,eAAe,CAAC;IACxB,KAAK,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3C,IAAI,EAAE,MAAM,CAAC;CAChB,GAAG;IACA,MAAM,EAAE,wBAAwB,CAAC;IACjC,KAAK,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAQ3D,qBAAa,iBAAkB,SAAQ,gBAAgB;;IACnD,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC;gBAM3B,QAAQ,EAAE,gBAAgB;IAStC,IAAI,aAAa,IAAI,MAAM,CAAgC;IAC3D,IAAI,aAAa,CAAC,KAAK,EAAE,MAAM,EAyB9B;IAED,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IAYvE,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAyErC,cAAc;IAIR,QAAQ,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,CAAC,CAAC;CAgBjE"} -------------------------------------------------------------------------------- /lib.esm/provider-multicall.js: -------------------------------------------------------------------------------- 1 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 2 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 3 | return new (P || (P = Promise))(function (resolve, reject) { 4 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 5 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 6 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 7 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 8 | }); 9 | }; 10 | var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { 11 | if (kind === "m") throw new TypeError("Private method is not writable"); 12 | if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); 13 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); 14 | return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; 15 | }; 16 | var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { 17 | if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); 18 | if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); 19 | return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); 20 | }; 21 | var _MulticallProvider_callQueue, _MulticallProvider_drainInterval, _MulticallProvider_drainTimer; 22 | import { AbiCoder, AbstractProvider, toQuantity, assertArgument, concat, makeError } from "ethers"; 23 | import { bin } from "./_contract.js"; 24 | export class MulticallProvider extends AbstractProvider { 25 | constructor(provider) { 26 | super(); 27 | _MulticallProvider_callQueue.set(this, void 0); 28 | _MulticallProvider_drainInterval.set(this, void 0); 29 | _MulticallProvider_drainTimer.set(this, void 0); 30 | this.subprovider = provider; 31 | __classPrivateFieldSet(this, _MulticallProvider_callQueue, [], "f"); 32 | __classPrivateFieldSet(this, _MulticallProvider_drainInterval, 10, "f"); 33 | __classPrivateFieldSet(this, _MulticallProvider_drainTimer, null, "f"); 34 | } 35 | get drainInterval() { return __classPrivateFieldGet(this, _MulticallProvider_drainInterval, "f"); } 36 | set drainInterval(value) { 37 | if (value < 0) { 38 | value = -1; 39 | } 40 | if (value === __classPrivateFieldGet(this, _MulticallProvider_drainInterval, "f")) { 41 | return; 42 | } 43 | __classPrivateFieldSet(this, _MulticallProvider_drainInterval, value, "f"); 44 | if (__classPrivateFieldGet(this, _MulticallProvider_drainInterval, "f") >= 0) { 45 | // Clear any existing timer 46 | if (__classPrivateFieldGet(this, _MulticallProvider_drainTimer, "f")) { 47 | clearTimeout(__classPrivateFieldGet(this, _MulticallProvider_drainTimer, "f")); 48 | __classPrivateFieldSet(this, _MulticallProvider_drainTimer, null, "f"); 49 | } 50 | // Start a new one with the updated interval 51 | if (__classPrivateFieldGet(this, _MulticallProvider_callQueue, "f").length) { 52 | __classPrivateFieldSet(this, _MulticallProvider_drainTimer, setTimeout(() => { 53 | this.drainCallQueue(); 54 | }, __classPrivateFieldGet(this, _MulticallProvider_drainInterval, "f")), "f"); 55 | } 56 | } 57 | else if (__classPrivateFieldGet(this, _MulticallProvider_drainTimer, "f")) { 58 | // Disable any existing timer; switching to manual mode 59 | clearTimeout(__classPrivateFieldGet(this, _MulticallProvider_drainTimer, "f")); 60 | __classPrivateFieldSet(this, _MulticallProvider_drainTimer, null, "f"); 61 | } 62 | } 63 | ; 64 | queueCall(to, data, blockTag) { 65 | if (__classPrivateFieldGet(this, _MulticallProvider_drainTimer, "f") == null && __classPrivateFieldGet(this, _MulticallProvider_drainInterval, "f") >= 0) { 66 | __classPrivateFieldSet(this, _MulticallProvider_drainTimer, setTimeout(() => { 67 | this.drainCallQueue(); 68 | }, __classPrivateFieldGet(this, _MulticallProvider_drainInterval, "f")), "f"); 69 | } 70 | return new Promise((resolve, reject) => { 71 | __classPrivateFieldGet(this, _MulticallProvider_callQueue, "f").push({ request: { to, data, blockTag }, resolve, reject }); 72 | }); 73 | } 74 | drainCallQueue() { 75 | return __awaiter(this, void 0, void 0, function* () { 76 | __classPrivateFieldSet(this, _MulticallProvider_drainTimer, null, "f"); 77 | const _callQueue = __classPrivateFieldGet(this, _MulticallProvider_callQueue, "f"); 78 | __classPrivateFieldSet(this, _MulticallProvider_callQueue, [], "f"); 79 | const blockTags = _callQueue.reduce((accum, { request }) => { 80 | const blockTag = request.blockTag; 81 | if (blockTag != null && accum.indexOf(blockTag) === -1) { 82 | accum.push(blockTag); 83 | } 84 | return accum; 85 | }, []); 86 | const runners = []; 87 | for (const blockTag of blockTags) { 88 | const callQueue = _callQueue.filter(({ request }) => request.blockTag === blockTag); 89 | const data = concat([bin, AbiCoder.defaultAbiCoder().encode([ 90 | "tuple(address, bytes)[]" 91 | ], [ 92 | callQueue.map(({ request }) => { 93 | return [request.to, request.data]; 94 | }) 95 | ])]); 96 | this.emit("debug", { 97 | action: "sendMulticall", data, 98 | call: callQueue.map(({ request }) => { 99 | return { to: request.to, data: request.data }; 100 | }) 101 | }); 102 | runners.push((() => __awaiter(this, void 0, void 0, function* () { 103 | const _data = yield this.subprovider.call({ data, blockTag }); 104 | const [_blockNumber, results] = AbiCoder.defaultAbiCoder().decode(["uint", "tuple(bool, bytes)[]"], _data); 105 | const blockNumber = toQuantity(_blockNumber); 106 | if (blockTag !== "latest" && blockTag !== "pending" && blockNumber !== blockTag) { 107 | callQueue.forEach(({ reject }) => { 108 | reject(makeError("backend does not support archive access", "UNSUPPORTED_OPERATION", { 109 | operation: "call(blockTag)", 110 | info: { expectedBlockTag: blockTag, blockNumber } 111 | })); 112 | }); 113 | } 114 | this.emit("debug", { 115 | action: "receiveMulticallResult", data, 116 | call: callQueue.map(({ request }, i) => { 117 | return { 118 | to: request.to, data: request.data, 119 | status: results[i][0], result: results[i][1] 120 | }; 121 | }) 122 | }); 123 | const output = []; 124 | for (let i = 0; i < callQueue.length; i++) { 125 | const result = results[i]; 126 | const { resolve } = callQueue[i]; 127 | resolve({ status: result[0], data: result[1] }); 128 | output.push({ status: result[0], data: result[1] }); 129 | } 130 | }))()); 131 | } 132 | yield Promise.all(runners); 133 | }); 134 | } 135 | _detectNetwork() { 136 | return this.subprovider._detectNetwork(); 137 | } 138 | _perform(req) { 139 | return __awaiter(this, void 0, void 0, function* () { 140 | if (req.method === "call") { 141 | const tx = req.transaction; 142 | const to = (tx.to || null), data = (tx.data || "0x"); 143 | assertArgument(typeof (to) === "string", "deployment transactions unsupported", "tx.to", tx.to); 144 | const result = yield this.queueCall(to, data, req.blockTag); 145 | if (result.status) { 146 | return result.data; 147 | } 148 | // Throw a CallException 149 | throw AbiCoder.getBuiltinCallException("call", { to, data }, result.data); 150 | } 151 | return yield this.subprovider._perform(req); 152 | }); 153 | } 154 | } 155 | _MulticallProvider_callQueue = new WeakMap(), _MulticallProvider_drainInterval = new WeakMap(), _MulticallProvider_drainTimer = new WeakMap(); 156 | //# sourceMappingURL=provider-multicall.js.map -------------------------------------------------------------------------------- /lib.esm/provider-multicall.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"provider-multicall.js","sourceRoot":"","sources":["../src.ts/provider-multicall.ts"],"names":[],"mappings":"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"} -------------------------------------------------------------------------------- /lib.esm/test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | //# sourceMappingURL=test.d.ts.map -------------------------------------------------------------------------------- /lib.esm/test.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../src.ts/test.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /lib.esm/test.js: -------------------------------------------------------------------------------- 1 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 2 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 3 | return new (P || (P = Promise))(function (resolve, reject) { 4 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 5 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 6 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 7 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 8 | }); 9 | }; 10 | import { ethers } from "ethers"; 11 | import { MulticallProvider } from "./provider-multicall.js"; 12 | /* 13 | import { bin, abi } from "./_contract.js"; 14 | (async function() { 15 | const provider = new ethers.InfuraProvider(); 16 | 17 | const contract = new ethers.Contract("dai.tokens.ethers.eth", [ 18 | "function name() view returns (string)", 19 | "function symbol() view returns (string)", 20 | ], provider); 21 | 22 | const calls = await Promise.all([ 23 | contract.name.populateTransaction(), 24 | contract.symbol.populateTransaction(), 25 | ]); 26 | console.log("CALLS", calls); 27 | 28 | const iface = new ethers.Interface(abi); 29 | console.log(iface.deploy); 30 | const args = calls.map((c) => { 31 | //(address, bool, bytes) 32 | return [ c.to, false, c.data ]; 33 | }); 34 | console.log("ARGS", args); 35 | const data = ethers.concat([ 36 | bin, 37 | iface.encodeDeploy([ args ]) 38 | ]); 39 | console.log("DATA", data); 40 | 41 | let result = await provider.call({ data }); 42 | // result = ethers.concat([ 43 | // "0x0000000000000000000000000000000000000000000000000000000000000020", 44 | // result 45 | // ]); 46 | 47 | console.log("RESULT", result); 48 | console.log(iface.getFunction("aggregate3Value")); 49 | console.log(iface.decodeFunctionResult("aggregate3Value", result)); 50 | })(); 51 | */ 52 | (function () { 53 | return __awaiter(this, void 0, void 0, function* () { 54 | const subprovider = new ethers.InfuraProvider(); 55 | //const subprovider = new ethers.ChainstackProvider(); 56 | //const subprovider = new ethers.QuickNodeProvider(); 57 | /* 58 | subprovider.on("debug", (req) => { 59 | console.log("SUB"); 60 | console.dir(req, { depth: null }); 61 | }); 62 | */ 63 | const provider = new MulticallProvider(subprovider); 64 | const contract = new ethers.Contract("dai.tokens.ethers.eth", [ 65 | "function name() view returns (string)", 66 | "function symbol() view returns (string)", 67 | "function balanceOf(address) view returns (uint256)", 68 | "function balanceOf(address) view returns (uint256)", 69 | ], provider); 70 | /* 71 | provider.on("debug", (req) => { 72 | console.log("MULTI"); 73 | console.dir(req, { depth: null }); 74 | }); 75 | */ 76 | const blockNumber = yield provider.getBlockNumber(); 77 | const ricmooEth = "0x5555763613a12d8f3e73be831dff8598089d3dca"; 78 | const [name, sym, balance, balance_1] = yield Promise.all([ 79 | contract.name({ blockTag: "latest" }), 80 | contract.symbol({ blockTag: "latest" }), 81 | contract.balanceOf(ricmooEth, { blockTag: "latest" }), 82 | contract.balanceOf(ricmooEth, { blockTag: blockNumber - 1 }), 83 | ]); 84 | console.log({ name, sym, balance, balance_1 }); 85 | }); 86 | })(); 87 | //# sourceMappingURL=test.js.map -------------------------------------------------------------------------------- /lib.esm/test.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"test.js","sourceRoot":"","sources":["../src.ts/test.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCE;AAEF,CAAC;;QACG,MAAM,WAAW,GAAG,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;QAChD,sDAAsD;QACtD,qDAAqD;QACrD;;;;;UAKE;QAEF,MAAM,QAAQ,GAAG,IAAI,iBAAiB,CAAC,WAAW,CAAC,CAAC;QAEpD,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,QAAQ,CAAC,uBAAuB,EAAE;YAC1D,uCAAuC;YACvC,yCAAyC;YACzC,oDAAoD;YACpD,oDAAoD;SACvD,EAAE,QAAQ,CAAC,CAAC;QACjB;;;;;UAKE;QACE,MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC,cAAc,EAAE,CAAC;QACpD,MAAM,SAAS,GAAG,4CAA4C,CAAC;QAE/D,MAAM,CAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,CAAE,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACxD,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;YACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;YACvC,QAAQ,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;YACrD,QAAQ,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,WAAW,GAAG,CAAC,EAAE,CAAC;SAC/D,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;IACnD,CAAC;CAAA,CAAC,EAAE,CAAC"} -------------------------------------------------------------------------------- /misc/basedirs/lib.commonjs/README.md: -------------------------------------------------------------------------------- 1 | Generated Code (CommonJS) 2 | ========================= 3 | 4 | Do not modify code in this folder. 5 | 6 | See `/src.ts/` and `/tsconfig.commonjs.json`. 7 | -------------------------------------------------------------------------------- /misc/basedirs/lib.commonjs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "sideEffects": false, 3 | "type": "commonjs" 4 | } 5 | -------------------------------------------------------------------------------- /misc/basedirs/lib.esm/README.md: -------------------------------------------------------------------------------- 1 | Generated Code (ESM) 2 | ==================== 3 | 4 | Do not modify code in this folder. 5 | 6 | See `/src.ts/` and `/tsconfig.esm.json`. 7 | -------------------------------------------------------------------------------- /misc/basedirs/lib.esm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "sideEffects": false, 3 | "type": "module" 4 | } 5 | -------------------------------------------------------------------------------- /misc/output/contracts_multicall_sol_Multicall.abi: -------------------------------------------------------------------------------- 1 | [{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Multicall.Call[]","name":"calls","type":"tuple[]"}],"stateMutability":"nonpayable","type":"constructor"}] -------------------------------------------------------------------------------- /misc/output/contracts_multicall_sol_Multicall.bin: -------------------------------------------------------------------------------- 1 | 608060405234801561000f575f80fd5b5060405161046138038061046183398101604081905261002e91610233565b5f81516001600160401b03811115610048576100486101a5565b60405190808252806020026020018201604052801561008d57816020015b604080518082019091525f8152606060208201528152602001906001900390816100665790505b5090505f5b825181101561013a576100e48382815181106100b0576100b0610394565b60200260200101515f01518483815181106100cd576100cd610394565b60200260200101516020015161016860201b60201c565b8383815181106100f6576100f6610394565b60200260200101515f0184848151811061011257610112610394565b6020908102919091018101510191909152901515905280610132816103a8565b915050610092565b505f438260405160200161014f9291906103cc565b6040516020818303038152906040529050805160208201f35b5f606060405190505f8152602081016040525f80845160208601875afa603f3d01601f191682016040523d825291503d5f602083013e9250929050565b634e487b7160e01b5f52604160045260245ffd5b604080519081016001600160401b03811182821017156101db576101db6101a5565b60405290565b604051601f8201601f191681016001600160401b0381118282101715610209576102096101a5565b604052919050565b5f5b8381101561022b578181015183820152602001610213565b50505f910152565b5f6020808385031215610244575f80fd5b82516001600160401b038082111561025a575f80fd5b818501915085601f83011261026d575f80fd5b81518181111561027f5761027f6101a5565b8060051b61028e8582016101e1565b91825283810185019185810190898411156102a7575f80fd5b86860192505b83831015610387578251858111156102c4575f8081fd5b86016040601f19828d0381018213156102dc575f8081fd5b6102e46101b9565b838b01516001600160a01b03811681146102fd575f8081fd5b81528383015189811115610310575f8081fd5b8085019450508d603f850112610325575f8081fd5b8a84015189811115610339576103396101a5565b6103498c84601f840116016101e1565b92508083528e8482870101111561035f575f8081fd5b61036e818d8501868801610211565b50808b01919091528452505091860191908601906102ad565b9998505050505050505050565b634e487b7160e01b5f52603260045260245ffd5b5f600182016103c557634e487b7160e01b5f52601160045260245ffd5b5060010190565b5f604080830185845260208281860152818651808452606093508387019150838160051b8801018389015f5b8381101561045057898303605f1901855281518051151584528601518684018990528051898501819052610431818a8701848b01610211565b95870195601f01601f19169390930187019250908501906001016103f8565b50909a995050505050505050505056fe -------------------------------------------------------------------------------- /misc/output/result.json: -------------------------------------------------------------------------------- 1 | >>> Cannot retry compilation with SMT because there are no SMT solvers available. 2 | {"contracts":{"multicall.sol":{"Multicall":{"abi":[{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Multicall.Call[]","name":"calls","type":"tuple[]"}],"stateMutability":"nonpayable","type":"constructor"}],"evm":{"bytecode":{"functionDebugData":{"@_89":{"entryPoint":null,"id":89,"parameterSlots":1,"returnSlots":0},"@getBytes_14":{"entryPoint":366,"id":14,"parameterSlots":2,"returnSlots":2},"abi_decode_tuple_t_array$_t_struct$_Call_$19_memory_ptr_$dyn_memory_ptr_fromMemory":{"entryPoint":602,"id":null,"parameterSlots":2,"returnSlots":1},"abi_encode_tuple_t_uint256_t_array$_t_struct$_Result_$24_memory_ptr_$dyn_memory_ptr__to_t_uint256_t_array$_t_struct$_Result_$24_memory_ptr_$dyn_memory_ptr__fromStack_reversed":{"entryPoint":1042,"id":null,"parameterSlots":3,"returnSlots":1},"allocate_memory":{"entryPoint":518,"id":null,"parameterSlots":1,"returnSlots":1},"allocate_memory_1263":{"entryPoint":478,"id":null,"parameterSlots":0,"returnSlots":1},"copy_memory_to_memory_with_cleanup":{"entryPoint":566,"id":null,"parameterSlots":3,"returnSlots":0},"panic_error_0x32":{"entryPoint":995,"id":null,"parameterSlots":0,"returnSlots":0},"panic_error_0x41":{"entryPoint":431,"id":null,"parameterSlots":0,"returnSlots":0}},"generatedSources":[{"ast":{"nativeSrc":"0:4513:1","nodeType":"YulBlock","src":"0:4513:1","statements":[{"nativeSrc":"6:3:1","nodeType":"YulBlock","src":"6:3:1","statements":[]},{"body":{"nativeSrc":"46:152:1","nodeType":"YulBlock","src":"46:152:1","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"63:1:1","nodeType":"YulLiteral","src":"63:1:1","type":"","value":"0"},{"kind":"number","nativeSrc":"66:77:1","nodeType":"YulLiteral","src":"66:77:1","type":"","value":"35408467139433450592217433187231851964531694900788300625387963629091585785856"}],"functionName":{"name":"mstore","nativeSrc":"56:6:1","nodeType":"YulIdentifier","src":"56:6:1"},"nativeSrc":"56:88:1","nodeType":"YulFunctionCall","src":"56:88:1"},"nativeSrc":"56:88:1","nodeType":"YulExpressionStatement","src":"56:88:1"},{"expression":{"arguments":[{"kind":"number","nativeSrc":"160:1:1","nodeType":"YulLiteral","src":"160:1:1","type":"","value":"4"},{"kind":"number","nativeSrc":"163:4:1","nodeType":"YulLiteral","src":"163:4:1","type":"","value":"0x41"}],"functionName":{"name":"mstore","nativeSrc":"153:6:1","nodeType":"YulIdentifier","src":"153:6:1"},"nativeSrc":"153:15:1","nodeType":"YulFunctionCall","src":"153:15:1"},"nativeSrc":"153:15:1","nodeType":"YulExpressionStatement","src":"153:15:1"},{"expression":{"arguments":[{"kind":"number","nativeSrc":"184:1:1","nodeType":"YulLiteral","src":"184:1:1","type":"","value":"0"},{"kind":"number","nativeSrc":"187:4:1","nodeType":"YulLiteral","src":"187:4:1","type":"","value":"0x24"}],"functionName":{"name":"revert","nativeSrc":"177:6:1","nodeType":"YulIdentifier","src":"177:6:1"},"nativeSrc":"177:15:1","nodeType":"YulFunctionCall","src":"177:15:1"},"nativeSrc":"177:15:1","nodeType":"YulExpressionStatement","src":"177:15:1"}]},"name":"panic_error_0x41","nativeSrc":"14:184:1","nodeType":"YulFunctionDefinition","src":"14:184:1"},{"body":{"nativeSrc":"249:211:1","nodeType":"YulBlock","src":"249:211:1","statements":[{"nativeSrc":"259:21:1","nodeType":"YulAssignment","src":"259:21:1","value":{"arguments":[{"kind":"number","nativeSrc":"275:4:1","nodeType":"YulLiteral","src":"275:4:1","type":"","value":"0x40"}],"functionName":{"name":"mload","nativeSrc":"269:5:1","nodeType":"YulIdentifier","src":"269:5:1"},"nativeSrc":"269:11:1","nodeType":"YulFunctionCall","src":"269:11:1"},"variableNames":[{"name":"memPtr","nativeSrc":"259:6:1","nodeType":"YulIdentifier","src":"259:6:1"}]},{"nativeSrc":"289:35:1","nodeType":"YulVariableDeclaration","src":"289:35:1","value":{"arguments":[{"name":"memPtr","nativeSrc":"311:6:1","nodeType":"YulIdentifier","src":"311:6:1"},{"kind":"number","nativeSrc":"319:4:1","nodeType":"YulLiteral","src":"319:4:1","type":"","value":"0x40"}],"functionName":{"name":"add","nativeSrc":"307:3:1","nodeType":"YulIdentifier","src":"307:3:1"},"nativeSrc":"307:17:1","nodeType":"YulFunctionCall","src":"307:17:1"},"variables":[{"name":"newFreePtr","nativeSrc":"293:10:1","nodeType":"YulTypedName","src":"293:10:1","type":""}]},{"body":{"nativeSrc":"399:22:1","nodeType":"YulBlock","src":"399:22:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error_0x41","nativeSrc":"401:16:1","nodeType":"YulIdentifier","src":"401:16:1"},"nativeSrc":"401:18:1","nodeType":"YulFunctionCall","src":"401:18:1"},"nativeSrc":"401:18:1","nodeType":"YulExpressionStatement","src":"401:18:1"}]},"condition":{"arguments":[{"arguments":[{"name":"newFreePtr","nativeSrc":"342:10:1","nodeType":"YulIdentifier","src":"342:10:1"},{"kind":"number","nativeSrc":"354:18:1","nodeType":"YulLiteral","src":"354:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nativeSrc":"339:2:1","nodeType":"YulIdentifier","src":"339:2:1"},"nativeSrc":"339:34:1","nodeType":"YulFunctionCall","src":"339:34:1"},{"arguments":[{"name":"newFreePtr","nativeSrc":"378:10:1","nodeType":"YulIdentifier","src":"378:10:1"},{"name":"memPtr","nativeSrc":"390:6:1","nodeType":"YulIdentifier","src":"390:6:1"}],"functionName":{"name":"lt","nativeSrc":"375:2:1","nodeType":"YulIdentifier","src":"375:2:1"},"nativeSrc":"375:22:1","nodeType":"YulFunctionCall","src":"375:22:1"}],"functionName":{"name":"or","nativeSrc":"336:2:1","nodeType":"YulIdentifier","src":"336:2:1"},"nativeSrc":"336:62:1","nodeType":"YulFunctionCall","src":"336:62:1"},"nativeSrc":"333:88:1","nodeType":"YulIf","src":"333:88:1"},{"expression":{"arguments":[{"kind":"number","nativeSrc":"437:4:1","nodeType":"YulLiteral","src":"437:4:1","type":"","value":"0x40"},{"name":"newFreePtr","nativeSrc":"443:10:1","nodeType":"YulIdentifier","src":"443:10:1"}],"functionName":{"name":"mstore","nativeSrc":"430:6:1","nodeType":"YulIdentifier","src":"430:6:1"},"nativeSrc":"430:24:1","nodeType":"YulFunctionCall","src":"430:24:1"},"nativeSrc":"430:24:1","nodeType":"YulExpressionStatement","src":"430:24:1"}]},"name":"allocate_memory_1263","nativeSrc":"203:257:1","nodeType":"YulFunctionDefinition","returnVariables":[{"name":"memPtr","nativeSrc":"238:6:1","nodeType":"YulTypedName","src":"238:6:1","type":""}],"src":"203:257:1"},{"body":{"nativeSrc":"510:230:1","nodeType":"YulBlock","src":"510:230:1","statements":[{"nativeSrc":"520:19:1","nodeType":"YulAssignment","src":"520:19:1","value":{"arguments":[{"kind":"number","nativeSrc":"536:2:1","nodeType":"YulLiteral","src":"536:2:1","type":"","value":"64"}],"functionName":{"name":"mload","nativeSrc":"530:5:1","nodeType":"YulIdentifier","src":"530:5:1"},"nativeSrc":"530:9:1","nodeType":"YulFunctionCall","src":"530:9:1"},"variableNames":[{"name":"memPtr","nativeSrc":"520:6:1","nodeType":"YulIdentifier","src":"520:6:1"}]},{"nativeSrc":"548:58:1","nodeType":"YulVariableDeclaration","src":"548:58:1","value":{"arguments":[{"name":"memPtr","nativeSrc":"570:6:1","nodeType":"YulIdentifier","src":"570:6:1"},{"arguments":[{"arguments":[{"name":"size","nativeSrc":"586:4:1","nodeType":"YulIdentifier","src":"586:4:1"},{"kind":"number","nativeSrc":"592:2:1","nodeType":"YulLiteral","src":"592:2:1","type":"","value":"31"}],"functionName":{"name":"add","nativeSrc":"582:3:1","nodeType":"YulIdentifier","src":"582:3:1"},"nativeSrc":"582:13:1","nodeType":"YulFunctionCall","src":"582:13:1"},{"arguments":[{"kind":"number","nativeSrc":"601:2:1","nodeType":"YulLiteral","src":"601:2:1","type":"","value":"31"}],"functionName":{"name":"not","nativeSrc":"597:3:1","nodeType":"YulIdentifier","src":"597:3:1"},"nativeSrc":"597:7:1","nodeType":"YulFunctionCall","src":"597:7:1"}],"functionName":{"name":"and","nativeSrc":"578:3:1","nodeType":"YulIdentifier","src":"578:3:1"},"nativeSrc":"578:27:1","nodeType":"YulFunctionCall","src":"578:27:1"}],"functionName":{"name":"add","nativeSrc":"566:3:1","nodeType":"YulIdentifier","src":"566:3:1"},"nativeSrc":"566:40:1","nodeType":"YulFunctionCall","src":"566:40:1"},"variables":[{"name":"newFreePtr","nativeSrc":"552:10:1","nodeType":"YulTypedName","src":"552:10:1","type":""}]},{"body":{"nativeSrc":"681:22:1","nodeType":"YulBlock","src":"681:22:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error_0x41","nativeSrc":"683:16:1","nodeType":"YulIdentifier","src":"683:16:1"},"nativeSrc":"683:18:1","nodeType":"YulFunctionCall","src":"683:18:1"},"nativeSrc":"683:18:1","nodeType":"YulExpressionStatement","src":"683:18:1"}]},"condition":{"arguments":[{"arguments":[{"name":"newFreePtr","nativeSrc":"624:10:1","nodeType":"YulIdentifier","src":"624:10:1"},{"kind":"number","nativeSrc":"636:18:1","nodeType":"YulLiteral","src":"636:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nativeSrc":"621:2:1","nodeType":"YulIdentifier","src":"621:2:1"},"nativeSrc":"621:34:1","nodeType":"YulFunctionCall","src":"621:34:1"},{"arguments":[{"name":"newFreePtr","nativeSrc":"660:10:1","nodeType":"YulIdentifier","src":"660:10:1"},{"name":"memPtr","nativeSrc":"672:6:1","nodeType":"YulIdentifier","src":"672:6:1"}],"functionName":{"name":"lt","nativeSrc":"657:2:1","nodeType":"YulIdentifier","src":"657:2:1"},"nativeSrc":"657:22:1","nodeType":"YulFunctionCall","src":"657:22:1"}],"functionName":{"name":"or","nativeSrc":"618:2:1","nodeType":"YulIdentifier","src":"618:2:1"},"nativeSrc":"618:62:1","nodeType":"YulFunctionCall","src":"618:62:1"},"nativeSrc":"615:88:1","nodeType":"YulIf","src":"615:88:1"},{"expression":{"arguments":[{"kind":"number","nativeSrc":"719:2:1","nodeType":"YulLiteral","src":"719:2:1","type":"","value":"64"},{"name":"newFreePtr","nativeSrc":"723:10:1","nodeType":"YulIdentifier","src":"723:10:1"}],"functionName":{"name":"mstore","nativeSrc":"712:6:1","nodeType":"YulIdentifier","src":"712:6:1"},"nativeSrc":"712:22:1","nodeType":"YulFunctionCall","src":"712:22:1"},"nativeSrc":"712:22:1","nodeType":"YulExpressionStatement","src":"712:22:1"}]},"name":"allocate_memory","nativeSrc":"465:275:1","nodeType":"YulFunctionDefinition","parameters":[{"name":"size","nativeSrc":"490:4:1","nodeType":"YulTypedName","src":"490:4:1","type":""}],"returnVariables":[{"name":"memPtr","nativeSrc":"499:6:1","nodeType":"YulTypedName","src":"499:6:1","type":""}],"src":"465:275:1"},{"body":{"nativeSrc":"811:184:1","nodeType":"YulBlock","src":"811:184:1","statements":[{"nativeSrc":"821:10:1","nodeType":"YulVariableDeclaration","src":"821:10:1","value":{"kind":"number","nativeSrc":"830:1:1","nodeType":"YulLiteral","src":"830:1:1","type":"","value":"0"},"variables":[{"name":"i","nativeSrc":"825:1:1","nodeType":"YulTypedName","src":"825:1:1","type":""}]},{"body":{"nativeSrc":"890:63:1","nodeType":"YulBlock","src":"890:63:1","statements":[{"expression":{"arguments":[{"arguments":[{"name":"dst","nativeSrc":"915:3:1","nodeType":"YulIdentifier","src":"915:3:1"},{"name":"i","nativeSrc":"920:1:1","nodeType":"YulIdentifier","src":"920:1:1"}],"functionName":{"name":"add","nativeSrc":"911:3:1","nodeType":"YulIdentifier","src":"911:3:1"},"nativeSrc":"911:11:1","nodeType":"YulFunctionCall","src":"911:11:1"},{"arguments":[{"arguments":[{"name":"src","nativeSrc":"934:3:1","nodeType":"YulIdentifier","src":"934:3:1"},{"name":"i","nativeSrc":"939:1:1","nodeType":"YulIdentifier","src":"939:1:1"}],"functionName":{"name":"add","nativeSrc":"930:3:1","nodeType":"YulIdentifier","src":"930:3:1"},"nativeSrc":"930:11:1","nodeType":"YulFunctionCall","src":"930:11:1"}],"functionName":{"name":"mload","nativeSrc":"924:5:1","nodeType":"YulIdentifier","src":"924:5:1"},"nativeSrc":"924:18:1","nodeType":"YulFunctionCall","src":"924:18:1"}],"functionName":{"name":"mstore","nativeSrc":"904:6:1","nodeType":"YulIdentifier","src":"904:6:1"},"nativeSrc":"904:39:1","nodeType":"YulFunctionCall","src":"904:39:1"},"nativeSrc":"904:39:1","nodeType":"YulExpressionStatement","src":"904:39:1"}]},"condition":{"arguments":[{"name":"i","nativeSrc":"851:1:1","nodeType":"YulIdentifier","src":"851:1:1"},{"name":"length","nativeSrc":"854:6:1","nodeType":"YulIdentifier","src":"854:6:1"}],"functionName":{"name":"lt","nativeSrc":"848:2:1","nodeType":"YulIdentifier","src":"848:2:1"},"nativeSrc":"848:13:1","nodeType":"YulFunctionCall","src":"848:13:1"},"nativeSrc":"840:113:1","nodeType":"YulForLoop","post":{"nativeSrc":"862:19:1","nodeType":"YulBlock","src":"862:19:1","statements":[{"nativeSrc":"864:15:1","nodeType":"YulAssignment","src":"864:15:1","value":{"arguments":[{"name":"i","nativeSrc":"873:1:1","nodeType":"YulIdentifier","src":"873:1:1"},{"kind":"number","nativeSrc":"876:2:1","nodeType":"YulLiteral","src":"876:2:1","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"869:3:1","nodeType":"YulIdentifier","src":"869:3:1"},"nativeSrc":"869:10:1","nodeType":"YulFunctionCall","src":"869:10:1"},"variableNames":[{"name":"i","nativeSrc":"864:1:1","nodeType":"YulIdentifier","src":"864:1:1"}]}]},"pre":{"nativeSrc":"844:3:1","nodeType":"YulBlock","src":"844:3:1","statements":[]},"src":"840:113:1"},{"expression":{"arguments":[{"arguments":[{"name":"dst","nativeSrc":"973:3:1","nodeType":"YulIdentifier","src":"973:3:1"},{"name":"length","nativeSrc":"978:6:1","nodeType":"YulIdentifier","src":"978:6:1"}],"functionName":{"name":"add","nativeSrc":"969:3:1","nodeType":"YulIdentifier","src":"969:3:1"},"nativeSrc":"969:16:1","nodeType":"YulFunctionCall","src":"969:16:1"},{"kind":"number","nativeSrc":"987:1:1","nodeType":"YulLiteral","src":"987:1:1","type":"","value":"0"}],"functionName":{"name":"mstore","nativeSrc":"962:6:1","nodeType":"YulIdentifier","src":"962:6:1"},"nativeSrc":"962:27:1","nodeType":"YulFunctionCall","src":"962:27:1"},"nativeSrc":"962:27:1","nodeType":"YulExpressionStatement","src":"962:27:1"}]},"name":"copy_memory_to_memory_with_cleanup","nativeSrc":"745:250:1","nodeType":"YulFunctionDefinition","parameters":[{"name":"src","nativeSrc":"789:3:1","nodeType":"YulTypedName","src":"789:3:1","type":""},{"name":"dst","nativeSrc":"794:3:1","nodeType":"YulTypedName","src":"794:3:1","type":""},{"name":"length","nativeSrc":"799:6:1","nodeType":"YulTypedName","src":"799:6:1","type":""}],"src":"745:250:1"},{"body":{"nativeSrc":"1126:1928:1","nodeType":"YulBlock","src":"1126:1928:1","statements":[{"body":{"nativeSrc":"1172:16:1","nodeType":"YulBlock","src":"1172:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"1181:1:1","nodeType":"YulLiteral","src":"1181:1:1","type":"","value":"0"},{"kind":"number","nativeSrc":"1184:1:1","nodeType":"YulLiteral","src":"1184:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nativeSrc":"1174:6:1","nodeType":"YulIdentifier","src":"1174:6:1"},"nativeSrc":"1174:12:1","nodeType":"YulFunctionCall","src":"1174:12:1"},"nativeSrc":"1174:12:1","nodeType":"YulExpressionStatement","src":"1174:12:1"}]},"condition":{"arguments":[{"arguments":[{"name":"dataEnd","nativeSrc":"1147:7:1","nodeType":"YulIdentifier","src":"1147:7:1"},{"name":"headStart","nativeSrc":"1156:9:1","nodeType":"YulIdentifier","src":"1156:9:1"}],"functionName":{"name":"sub","nativeSrc":"1143:3:1","nodeType":"YulIdentifier","src":"1143:3:1"},"nativeSrc":"1143:23:1","nodeType":"YulFunctionCall","src":"1143:23:1"},{"kind":"number","nativeSrc":"1168:2:1","nodeType":"YulLiteral","src":"1168:2:1","type":"","value":"32"}],"functionName":{"name":"slt","nativeSrc":"1139:3:1","nodeType":"YulIdentifier","src":"1139:3:1"},"nativeSrc":"1139:32:1","nodeType":"YulFunctionCall","src":"1139:32:1"},"nativeSrc":"1136:52:1","nodeType":"YulIf","src":"1136:52:1"},{"nativeSrc":"1197:30:1","nodeType":"YulVariableDeclaration","src":"1197:30:1","value":{"arguments":[{"name":"headStart","nativeSrc":"1217:9:1","nodeType":"YulIdentifier","src":"1217:9:1"}],"functionName":{"name":"mload","nativeSrc":"1211:5:1","nodeType":"YulIdentifier","src":"1211:5:1"},"nativeSrc":"1211:16:1","nodeType":"YulFunctionCall","src":"1211:16:1"},"variables":[{"name":"offset","nativeSrc":"1201:6:1","nodeType":"YulTypedName","src":"1201:6:1","type":""}]},{"body":{"nativeSrc":"1270:16:1","nodeType":"YulBlock","src":"1270:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"1279:1:1","nodeType":"YulLiteral","src":"1279:1:1","type":"","value":"0"},{"kind":"number","nativeSrc":"1282:1:1","nodeType":"YulLiteral","src":"1282:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nativeSrc":"1272:6:1","nodeType":"YulIdentifier","src":"1272:6:1"},"nativeSrc":"1272:12:1","nodeType":"YulFunctionCall","src":"1272:12:1"},"nativeSrc":"1272:12:1","nodeType":"YulExpressionStatement","src":"1272:12:1"}]},"condition":{"arguments":[{"name":"offset","nativeSrc":"1242:6:1","nodeType":"YulIdentifier","src":"1242:6:1"},{"kind":"number","nativeSrc":"1250:18:1","nodeType":"YulLiteral","src":"1250:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nativeSrc":"1239:2:1","nodeType":"YulIdentifier","src":"1239:2:1"},"nativeSrc":"1239:30:1","nodeType":"YulFunctionCall","src":"1239:30:1"},"nativeSrc":"1236:50:1","nodeType":"YulIf","src":"1236:50:1"},{"nativeSrc":"1295:32:1","nodeType":"YulVariableDeclaration","src":"1295:32:1","value":{"arguments":[{"name":"headStart","nativeSrc":"1309:9:1","nodeType":"YulIdentifier","src":"1309:9:1"},{"name":"offset","nativeSrc":"1320:6:1","nodeType":"YulIdentifier","src":"1320:6:1"}],"functionName":{"name":"add","nativeSrc":"1305:3:1","nodeType":"YulIdentifier","src":"1305:3:1"},"nativeSrc":"1305:22:1","nodeType":"YulFunctionCall","src":"1305:22:1"},"variables":[{"name":"_1","nativeSrc":"1299:2:1","nodeType":"YulTypedName","src":"1299:2:1","type":""}]},{"body":{"nativeSrc":"1375:16:1","nodeType":"YulBlock","src":"1375:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"1384:1:1","nodeType":"YulLiteral","src":"1384:1:1","type":"","value":"0"},{"kind":"number","nativeSrc":"1387:1:1","nodeType":"YulLiteral","src":"1387:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nativeSrc":"1377:6:1","nodeType":"YulIdentifier","src":"1377:6:1"},"nativeSrc":"1377:12:1","nodeType":"YulFunctionCall","src":"1377:12:1"},"nativeSrc":"1377:12:1","nodeType":"YulExpressionStatement","src":"1377:12:1"}]},"condition":{"arguments":[{"arguments":[{"arguments":[{"name":"_1","nativeSrc":"1354:2:1","nodeType":"YulIdentifier","src":"1354:2:1"},{"kind":"number","nativeSrc":"1358:4:1","nodeType":"YulLiteral","src":"1358:4:1","type":"","value":"0x1f"}],"functionName":{"name":"add","nativeSrc":"1350:3:1","nodeType":"YulIdentifier","src":"1350:3:1"},"nativeSrc":"1350:13:1","nodeType":"YulFunctionCall","src":"1350:13:1"},{"name":"dataEnd","nativeSrc":"1365:7:1","nodeType":"YulIdentifier","src":"1365:7:1"}],"functionName":{"name":"slt","nativeSrc":"1346:3:1","nodeType":"YulIdentifier","src":"1346:3:1"},"nativeSrc":"1346:27:1","nodeType":"YulFunctionCall","src":"1346:27:1"}],"functionName":{"name":"iszero","nativeSrc":"1339:6:1","nodeType":"YulIdentifier","src":"1339:6:1"},"nativeSrc":"1339:35:1","nodeType":"YulFunctionCall","src":"1339:35:1"},"nativeSrc":"1336:55:1","nodeType":"YulIf","src":"1336:55:1"},{"nativeSrc":"1400:23:1","nodeType":"YulVariableDeclaration","src":"1400:23:1","value":{"arguments":[{"name":"_1","nativeSrc":"1420:2:1","nodeType":"YulIdentifier","src":"1420:2:1"}],"functionName":{"name":"mload","nativeSrc":"1414:5:1","nodeType":"YulIdentifier","src":"1414:5:1"},"nativeSrc":"1414:9:1","nodeType":"YulFunctionCall","src":"1414:9:1"},"variables":[{"name":"length","nativeSrc":"1404:6:1","nodeType":"YulTypedName","src":"1404:6:1","type":""}]},{"body":{"nativeSrc":"1466:22:1","nodeType":"YulBlock","src":"1466:22:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error_0x41","nativeSrc":"1468:16:1","nodeType":"YulIdentifier","src":"1468:16:1"},"nativeSrc":"1468:18:1","nodeType":"YulFunctionCall","src":"1468:18:1"},"nativeSrc":"1468:18:1","nodeType":"YulExpressionStatement","src":"1468:18:1"}]},"condition":{"arguments":[{"name":"length","nativeSrc":"1438:6:1","nodeType":"YulIdentifier","src":"1438:6:1"},{"kind":"number","nativeSrc":"1446:18:1","nodeType":"YulLiteral","src":"1446:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nativeSrc":"1435:2:1","nodeType":"YulIdentifier","src":"1435:2:1"},"nativeSrc":"1435:30:1","nodeType":"YulFunctionCall","src":"1435:30:1"},"nativeSrc":"1432:56:1","nodeType":"YulIf","src":"1432:56:1"},{"nativeSrc":"1497:25:1","nodeType":"YulVariableDeclaration","src":"1497:25:1","value":{"arguments":[{"name":"length","nativeSrc":"1511:6:1","nodeType":"YulIdentifier","src":"1511:6:1"},{"kind":"number","nativeSrc":"1519:2:1","nodeType":"YulLiteral","src":"1519:2:1","type":"","value":"32"}],"functionName":{"name":"mul","nativeSrc":"1507:3:1","nodeType":"YulIdentifier","src":"1507:3:1"},"nativeSrc":"1507:15:1","nodeType":"YulFunctionCall","src":"1507:15:1"},"variables":[{"name":"_2","nativeSrc":"1501:2:1","nodeType":"YulTypedName","src":"1501:2:1","type":""}]},{"nativeSrc":"1531:39:1","nodeType":"YulVariableDeclaration","src":"1531:39:1","value":{"arguments":[{"arguments":[{"name":"_2","nativeSrc":"1562:2:1","nodeType":"YulIdentifier","src":"1562:2:1"},{"kind":"number","nativeSrc":"1566:2:1","nodeType":"YulLiteral","src":"1566:2:1","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"1558:3:1","nodeType":"YulIdentifier","src":"1558:3:1"},"nativeSrc":"1558:11:1","nodeType":"YulFunctionCall","src":"1558:11:1"}],"functionName":{"name":"allocate_memory","nativeSrc":"1542:15:1","nodeType":"YulIdentifier","src":"1542:15:1"},"nativeSrc":"1542:28:1","nodeType":"YulFunctionCall","src":"1542:28:1"},"variables":[{"name":"dst","nativeSrc":"1535:3:1","nodeType":"YulTypedName","src":"1535:3:1","type":""}]},{"nativeSrc":"1579:16:1","nodeType":"YulVariableDeclaration","src":"1579:16:1","value":{"name":"dst","nativeSrc":"1592:3:1","nodeType":"YulIdentifier","src":"1592:3:1"},"variables":[{"name":"array","nativeSrc":"1583:5:1","nodeType":"YulTypedName","src":"1583:5:1","type":""}]},{"expression":{"arguments":[{"name":"dst","nativeSrc":"1611:3:1","nodeType":"YulIdentifier","src":"1611:3:1"},{"name":"length","nativeSrc":"1616:6:1","nodeType":"YulIdentifier","src":"1616:6:1"}],"functionName":{"name":"mstore","nativeSrc":"1604:6:1","nodeType":"YulIdentifier","src":"1604:6:1"},"nativeSrc":"1604:19:1","nodeType":"YulFunctionCall","src":"1604:19:1"},"nativeSrc":"1604:19:1","nodeType":"YulExpressionStatement","src":"1604:19:1"},{"nativeSrc":"1632:19:1","nodeType":"YulAssignment","src":"1632:19:1","value":{"arguments":[{"name":"dst","nativeSrc":"1643:3:1","nodeType":"YulIdentifier","src":"1643:3:1"},{"kind":"number","nativeSrc":"1648:2:1","nodeType":"YulLiteral","src":"1648:2:1","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"1639:3:1","nodeType":"YulIdentifier","src":"1639:3:1"},"nativeSrc":"1639:12:1","nodeType":"YulFunctionCall","src":"1639:12:1"},"variableNames":[{"name":"dst","nativeSrc":"1632:3:1","nodeType":"YulIdentifier","src":"1632:3:1"}]},{"nativeSrc":"1660:34:1","nodeType":"YulVariableDeclaration","src":"1660:34:1","value":{"arguments":[{"arguments":[{"name":"_1","nativeSrc":"1682:2:1","nodeType":"YulIdentifier","src":"1682:2:1"},{"name":"_2","nativeSrc":"1686:2:1","nodeType":"YulIdentifier","src":"1686:2:1"}],"functionName":{"name":"add","nativeSrc":"1678:3:1","nodeType":"YulIdentifier","src":"1678:3:1"},"nativeSrc":"1678:11:1","nodeType":"YulFunctionCall","src":"1678:11:1"},{"kind":"number","nativeSrc":"1691:2:1","nodeType":"YulLiteral","src":"1691:2:1","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"1674:3:1","nodeType":"YulIdentifier","src":"1674:3:1"},"nativeSrc":"1674:20:1","nodeType":"YulFunctionCall","src":"1674:20:1"},"variables":[{"name":"srcEnd","nativeSrc":"1664:6:1","nodeType":"YulTypedName","src":"1664:6:1","type":""}]},{"body":{"nativeSrc":"1726:16:1","nodeType":"YulBlock","src":"1726:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"1735:1:1","nodeType":"YulLiteral","src":"1735:1:1","type":"","value":"0"},{"kind":"number","nativeSrc":"1738:1:1","nodeType":"YulLiteral","src":"1738:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nativeSrc":"1728:6:1","nodeType":"YulIdentifier","src":"1728:6:1"},"nativeSrc":"1728:12:1","nodeType":"YulFunctionCall","src":"1728:12:1"},"nativeSrc":"1728:12:1","nodeType":"YulExpressionStatement","src":"1728:12:1"}]},"condition":{"arguments":[{"name":"srcEnd","nativeSrc":"1709:6:1","nodeType":"YulIdentifier","src":"1709:6:1"},{"name":"dataEnd","nativeSrc":"1717:7:1","nodeType":"YulIdentifier","src":"1717:7:1"}],"functionName":{"name":"gt","nativeSrc":"1706:2:1","nodeType":"YulIdentifier","src":"1706:2:1"},"nativeSrc":"1706:19:1","nodeType":"YulFunctionCall","src":"1706:19:1"},"nativeSrc":"1703:39:1","nodeType":"YulIf","src":"1703:39:1"},{"nativeSrc":"1751:22:1","nodeType":"YulVariableDeclaration","src":"1751:22:1","value":{"arguments":[{"name":"_1","nativeSrc":"1766:2:1","nodeType":"YulIdentifier","src":"1766:2:1"},{"kind":"number","nativeSrc":"1770:2:1","nodeType":"YulLiteral","src":"1770:2:1","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"1762:3:1","nodeType":"YulIdentifier","src":"1762:3:1"},"nativeSrc":"1762:11:1","nodeType":"YulFunctionCall","src":"1762:11:1"},"variables":[{"name":"src","nativeSrc":"1755:3:1","nodeType":"YulTypedName","src":"1755:3:1","type":""}]},{"body":{"nativeSrc":"1838:1186:1","nodeType":"YulBlock","src":"1838:1186:1","statements":[{"nativeSrc":"1852:29:1","nodeType":"YulVariableDeclaration","src":"1852:29:1","value":{"arguments":[{"name":"src","nativeSrc":"1877:3:1","nodeType":"YulIdentifier","src":"1877:3:1"}],"functionName":{"name":"mload","nativeSrc":"1871:5:1","nodeType":"YulIdentifier","src":"1871:5:1"},"nativeSrc":"1871:10:1","nodeType":"YulFunctionCall","src":"1871:10:1"},"variables":[{"name":"innerOffset","nativeSrc":"1856:11:1","nodeType":"YulTypedName","src":"1856:11:1","type":""}]},{"body":{"nativeSrc":"1933:16:1","nodeType":"YulBlock","src":"1933:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"1942:1:1","nodeType":"YulLiteral","src":"1942:1:1","type":"","value":"0"},{"kind":"number","nativeSrc":"1945:1:1","nodeType":"YulLiteral","src":"1945:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nativeSrc":"1935:6:1","nodeType":"YulIdentifier","src":"1935:6:1"},"nativeSrc":"1935:12:1","nodeType":"YulFunctionCall","src":"1935:12:1"},"nativeSrc":"1935:12:1","nodeType":"YulExpressionStatement","src":"1935:12:1"}]},"condition":{"arguments":[{"name":"innerOffset","nativeSrc":"1900:11:1","nodeType":"YulIdentifier","src":"1900:11:1"},{"kind":"number","nativeSrc":"1913:18:1","nodeType":"YulLiteral","src":"1913:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nativeSrc":"1897:2:1","nodeType":"YulIdentifier","src":"1897:2:1"},"nativeSrc":"1897:35:1","nodeType":"YulFunctionCall","src":"1897:35:1"},"nativeSrc":"1894:55:1","nodeType":"YulIf","src":"1894:55:1"},{"nativeSrc":"1962:30:1","nodeType":"YulVariableDeclaration","src":"1962:30:1","value":{"arguments":[{"name":"_1","nativeSrc":"1976:2:1","nodeType":"YulIdentifier","src":"1976:2:1"},{"name":"innerOffset","nativeSrc":"1980:11:1","nodeType":"YulIdentifier","src":"1980:11:1"}],"functionName":{"name":"add","nativeSrc":"1972:3:1","nodeType":"YulIdentifier","src":"1972:3:1"},"nativeSrc":"1972:20:1","nodeType":"YulFunctionCall","src":"1972:20:1"},"variables":[{"name":"_3","nativeSrc":"1966:2:1","nodeType":"YulTypedName","src":"1966:2:1","type":""}]},{"body":{"nativeSrc":"2050:16:1","nodeType":"YulBlock","src":"2050:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"2059:1:1","nodeType":"YulLiteral","src":"2059:1:1","type":"","value":"0"},{"kind":"number","nativeSrc":"2062:1:1","nodeType":"YulLiteral","src":"2062:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nativeSrc":"2052:6:1","nodeType":"YulIdentifier","src":"2052:6:1"},"nativeSrc":"2052:12:1","nodeType":"YulFunctionCall","src":"2052:12:1"},"nativeSrc":"2052:12:1","nodeType":"YulExpressionStatement","src":"2052:12:1"}]},"condition":{"arguments":[{"arguments":[{"arguments":[{"name":"dataEnd","nativeSrc":"2020:7:1","nodeType":"YulIdentifier","src":"2020:7:1"},{"name":"_3","nativeSrc":"2029:2:1","nodeType":"YulIdentifier","src":"2029:2:1"}],"functionName":{"name":"sub","nativeSrc":"2016:3:1","nodeType":"YulIdentifier","src":"2016:3:1"},"nativeSrc":"2016:16:1","nodeType":"YulFunctionCall","src":"2016:16:1"},{"arguments":[{"kind":"number","nativeSrc":"2038:2:1","nodeType":"YulLiteral","src":"2038:2:1","type":"","value":"31"}],"functionName":{"name":"not","nativeSrc":"2034:3:1","nodeType":"YulIdentifier","src":"2034:3:1"},"nativeSrc":"2034:7:1","nodeType":"YulFunctionCall","src":"2034:7:1"}],"functionName":{"name":"add","nativeSrc":"2012:3:1","nodeType":"YulIdentifier","src":"2012:3:1"},"nativeSrc":"2012:30:1","nodeType":"YulFunctionCall","src":"2012:30:1"},{"kind":"number","nativeSrc":"2044:4:1","nodeType":"YulLiteral","src":"2044:4:1","type":"","value":"0x40"}],"functionName":{"name":"slt","nativeSrc":"2008:3:1","nodeType":"YulIdentifier","src":"2008:3:1"},"nativeSrc":"2008:41:1","nodeType":"YulFunctionCall","src":"2008:41:1"},"nativeSrc":"2005:61:1","nodeType":"YulIf","src":"2005:61:1"},{"nativeSrc":"2079:35:1","nodeType":"YulVariableDeclaration","src":"2079:35:1","value":{"arguments":[],"functionName":{"name":"allocate_memory_1263","nativeSrc":"2092:20:1","nodeType":"YulIdentifier","src":"2092:20:1"},"nativeSrc":"2092:22:1","nodeType":"YulFunctionCall","src":"2092:22:1"},"variables":[{"name":"value","nativeSrc":"2083:5:1","nodeType":"YulTypedName","src":"2083:5:1","type":""}]},{"nativeSrc":"2127:33:1","nodeType":"YulVariableDeclaration","src":"2127:33:1","value":{"arguments":[{"arguments":[{"name":"_3","nativeSrc":"2152:2:1","nodeType":"YulIdentifier","src":"2152:2:1"},{"kind":"number","nativeSrc":"2156:2:1","nodeType":"YulLiteral","src":"2156:2:1","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"2148:3:1","nodeType":"YulIdentifier","src":"2148:3:1"},"nativeSrc":"2148:11:1","nodeType":"YulFunctionCall","src":"2148:11:1"}],"functionName":{"name":"mload","nativeSrc":"2142:5:1","nodeType":"YulIdentifier","src":"2142:5:1"},"nativeSrc":"2142:18:1","nodeType":"YulFunctionCall","src":"2142:18:1"},"variables":[{"name":"value_1","nativeSrc":"2131:7:1","nodeType":"YulTypedName","src":"2131:7:1","type":""}]},{"body":{"nativeSrc":"2231:16:1","nodeType":"YulBlock","src":"2231:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"2240:1:1","nodeType":"YulLiteral","src":"2240:1:1","type":"","value":"0"},{"kind":"number","nativeSrc":"2243:1:1","nodeType":"YulLiteral","src":"2243:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nativeSrc":"2233:6:1","nodeType":"YulIdentifier","src":"2233:6:1"},"nativeSrc":"2233:12:1","nodeType":"YulFunctionCall","src":"2233:12:1"},"nativeSrc":"2233:12:1","nodeType":"YulExpressionStatement","src":"2233:12:1"}]},"condition":{"arguments":[{"arguments":[{"name":"value_1","nativeSrc":"2186:7:1","nodeType":"YulIdentifier","src":"2186:7:1"},{"arguments":[{"name":"value_1","nativeSrc":"2199:7:1","nodeType":"YulIdentifier","src":"2199:7:1"},{"arguments":[{"arguments":[{"kind":"number","nativeSrc":"2216:1:1","nodeType":"YulLiteral","src":"2216:1:1","type":"","value":"2"},{"kind":"number","nativeSrc":"2219:3:1","nodeType":"YulLiteral","src":"2219:3:1","type":"","value":"160"}],"functionName":{"name":"exp","nativeSrc":"2212:3:1","nodeType":"YulIdentifier","src":"2212:3:1"},"nativeSrc":"2212:11:1","nodeType":"YulFunctionCall","src":"2212:11:1"},{"kind":"number","nativeSrc":"2225:1:1","nodeType":"YulLiteral","src":"2225:1:1","type":"","value":"1"}],"functionName":{"name":"sub","nativeSrc":"2208:3:1","nodeType":"YulIdentifier","src":"2208:3:1"},"nativeSrc":"2208:19:1","nodeType":"YulFunctionCall","src":"2208:19:1"}],"functionName":{"name":"and","nativeSrc":"2195:3:1","nodeType":"YulIdentifier","src":"2195:3:1"},"nativeSrc":"2195:33:1","nodeType":"YulFunctionCall","src":"2195:33:1"}],"functionName":{"name":"eq","nativeSrc":"2183:2:1","nodeType":"YulIdentifier","src":"2183:2:1"},"nativeSrc":"2183:46:1","nodeType":"YulFunctionCall","src":"2183:46:1"}],"functionName":{"name":"iszero","nativeSrc":"2176:6:1","nodeType":"YulIdentifier","src":"2176:6:1"},"nativeSrc":"2176:54:1","nodeType":"YulFunctionCall","src":"2176:54:1"},"nativeSrc":"2173:74:1","nodeType":"YulIf","src":"2173:74:1"},{"expression":{"arguments":[{"name":"value","nativeSrc":"2267:5:1","nodeType":"YulIdentifier","src":"2267:5:1"},{"name":"value_1","nativeSrc":"2274:7:1","nodeType":"YulIdentifier","src":"2274:7:1"}],"functionName":{"name":"mstore","nativeSrc":"2260:6:1","nodeType":"YulIdentifier","src":"2260:6:1"},"nativeSrc":"2260:22:1","nodeType":"YulFunctionCall","src":"2260:22:1"},"nativeSrc":"2260:22:1","nodeType":"YulExpressionStatement","src":"2260:22:1"},{"nativeSrc":"2295:36:1","nodeType":"YulVariableDeclaration","src":"2295:36:1","value":{"arguments":[{"arguments":[{"name":"_3","nativeSrc":"2321:2:1","nodeType":"YulIdentifier","src":"2321:2:1"},{"kind":"number","nativeSrc":"2325:4:1","nodeType":"YulLiteral","src":"2325:4:1","type":"","value":"0x40"}],"functionName":{"name":"add","nativeSrc":"2317:3:1","nodeType":"YulIdentifier","src":"2317:3:1"},"nativeSrc":"2317:13:1","nodeType":"YulFunctionCall","src":"2317:13:1"}],"functionName":{"name":"mload","nativeSrc":"2311:5:1","nodeType":"YulIdentifier","src":"2311:5:1"},"nativeSrc":"2311:20:1","nodeType":"YulFunctionCall","src":"2311:20:1"},"variables":[{"name":"offset_1","nativeSrc":"2299:8:1","nodeType":"YulTypedName","src":"2299:8:1","type":""}]},{"body":{"nativeSrc":"2380:16:1","nodeType":"YulBlock","src":"2380:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"2389:1:1","nodeType":"YulLiteral","src":"2389:1:1","type":"","value":"0"},{"kind":"number","nativeSrc":"2392:1:1","nodeType":"YulLiteral","src":"2392:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nativeSrc":"2382:6:1","nodeType":"YulIdentifier","src":"2382:6:1"},"nativeSrc":"2382:12:1","nodeType":"YulFunctionCall","src":"2382:12:1"},"nativeSrc":"2382:12:1","nodeType":"YulExpressionStatement","src":"2382:12:1"}]},"condition":{"arguments":[{"name":"offset_1","nativeSrc":"2350:8:1","nodeType":"YulIdentifier","src":"2350:8:1"},{"kind":"number","nativeSrc":"2360:18:1","nodeType":"YulLiteral","src":"2360:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nativeSrc":"2347:2:1","nodeType":"YulIdentifier","src":"2347:2:1"},"nativeSrc":"2347:32:1","nodeType":"YulFunctionCall","src":"2347:32:1"},"nativeSrc":"2344:52:1","nodeType":"YulIf","src":"2344:52:1"},{"nativeSrc":"2409:36:1","nodeType":"YulVariableDeclaration","src":"2409:36:1","value":{"arguments":[{"arguments":[{"name":"_3","nativeSrc":"2427:2:1","nodeType":"YulIdentifier","src":"2427:2:1"},{"name":"offset_1","nativeSrc":"2431:8:1","nodeType":"YulIdentifier","src":"2431:8:1"}],"functionName":{"name":"add","nativeSrc":"2423:3:1","nodeType":"YulIdentifier","src":"2423:3:1"},"nativeSrc":"2423:17:1","nodeType":"YulFunctionCall","src":"2423:17:1"},{"kind":"number","nativeSrc":"2442:2:1","nodeType":"YulLiteral","src":"2442:2:1","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"2419:3:1","nodeType":"YulIdentifier","src":"2419:3:1"},"nativeSrc":"2419:26:1","nodeType":"YulFunctionCall","src":"2419:26:1"},"variables":[{"name":"_4","nativeSrc":"2413:2:1","nodeType":"YulTypedName","src":"2413:2:1","type":""}]},{"body":{"nativeSrc":"2497:16:1","nodeType":"YulBlock","src":"2497:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"2506:1:1","nodeType":"YulLiteral","src":"2506:1:1","type":"","value":"0"},{"kind":"number","nativeSrc":"2509:1:1","nodeType":"YulLiteral","src":"2509:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nativeSrc":"2499:6:1","nodeType":"YulIdentifier","src":"2499:6:1"},"nativeSrc":"2499:12:1","nodeType":"YulFunctionCall","src":"2499:12:1"},"nativeSrc":"2499:12:1","nodeType":"YulExpressionStatement","src":"2499:12:1"}]},"condition":{"arguments":[{"arguments":[{"arguments":[{"name":"_4","nativeSrc":"2476:2:1","nodeType":"YulIdentifier","src":"2476:2:1"},{"kind":"number","nativeSrc":"2480:4:1","nodeType":"YulLiteral","src":"2480:4:1","type":"","value":"0x1f"}],"functionName":{"name":"add","nativeSrc":"2472:3:1","nodeType":"YulIdentifier","src":"2472:3:1"},"nativeSrc":"2472:13:1","nodeType":"YulFunctionCall","src":"2472:13:1"},{"name":"dataEnd","nativeSrc":"2487:7:1","nodeType":"YulIdentifier","src":"2487:7:1"}],"functionName":{"name":"slt","nativeSrc":"2468:3:1","nodeType":"YulIdentifier","src":"2468:3:1"},"nativeSrc":"2468:27:1","nodeType":"YulFunctionCall","src":"2468:27:1"}],"functionName":{"name":"iszero","nativeSrc":"2461:6:1","nodeType":"YulIdentifier","src":"2461:6:1"},"nativeSrc":"2461:35:1","nodeType":"YulFunctionCall","src":"2461:35:1"},"nativeSrc":"2458:55:1","nodeType":"YulIf","src":"2458:55:1"},{"nativeSrc":"2526:25:1","nodeType":"YulVariableDeclaration","src":"2526:25:1","value":{"arguments":[{"name":"_4","nativeSrc":"2548:2:1","nodeType":"YulIdentifier","src":"2548:2:1"}],"functionName":{"name":"mload","nativeSrc":"2542:5:1","nodeType":"YulIdentifier","src":"2542:5:1"},"nativeSrc":"2542:9:1","nodeType":"YulFunctionCall","src":"2542:9:1"},"variables":[{"name":"length_1","nativeSrc":"2530:8:1","nodeType":"YulTypedName","src":"2530:8:1","type":""}]},{"body":{"nativeSrc":"2600:22:1","nodeType":"YulBlock","src":"2600:22:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error_0x41","nativeSrc":"2602:16:1","nodeType":"YulIdentifier","src":"2602:16:1"},"nativeSrc":"2602:18:1","nodeType":"YulFunctionCall","src":"2602:18:1"},"nativeSrc":"2602:18:1","nodeType":"YulExpressionStatement","src":"2602:18:1"}]},"condition":{"arguments":[{"name":"length_1","nativeSrc":"2570:8:1","nodeType":"YulIdentifier","src":"2570:8:1"},{"kind":"number","nativeSrc":"2580:18:1","nodeType":"YulLiteral","src":"2580:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nativeSrc":"2567:2:1","nodeType":"YulIdentifier","src":"2567:2:1"},"nativeSrc":"2567:32:1","nodeType":"YulFunctionCall","src":"2567:32:1"},"nativeSrc":"2564:58:1","nodeType":"YulIf","src":"2564:58:1"},{"nativeSrc":"2635:74:1","nodeType":"YulVariableDeclaration","src":"2635:74:1","value":{"arguments":[{"arguments":[{"arguments":[{"arguments":[{"name":"length_1","nativeSrc":"2678:8:1","nodeType":"YulIdentifier","src":"2678:8:1"},{"kind":"number","nativeSrc":"2688:4:1","nodeType":"YulLiteral","src":"2688:4:1","type":"","value":"0x1f"}],"functionName":{"name":"add","nativeSrc":"2674:3:1","nodeType":"YulIdentifier","src":"2674:3:1"},"nativeSrc":"2674:19:1","nodeType":"YulFunctionCall","src":"2674:19:1"},{"arguments":[{"kind":"number","nativeSrc":"2699:2:1","nodeType":"YulLiteral","src":"2699:2:1","type":"","value":"31"}],"functionName":{"name":"not","nativeSrc":"2695:3:1","nodeType":"YulIdentifier","src":"2695:3:1"},"nativeSrc":"2695:7:1","nodeType":"YulFunctionCall","src":"2695:7:1"}],"functionName":{"name":"and","nativeSrc":"2670:3:1","nodeType":"YulIdentifier","src":"2670:3:1"},"nativeSrc":"2670:33:1","nodeType":"YulFunctionCall","src":"2670:33:1"},{"kind":"number","nativeSrc":"2705:2:1","nodeType":"YulLiteral","src":"2705:2:1","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"2666:3:1","nodeType":"YulIdentifier","src":"2666:3:1"},"nativeSrc":"2666:42:1","nodeType":"YulFunctionCall","src":"2666:42:1"}],"functionName":{"name":"allocate_memory","nativeSrc":"2650:15:1","nodeType":"YulIdentifier","src":"2650:15:1"},"nativeSrc":"2650:59:1","nodeType":"YulFunctionCall","src":"2650:59:1"},"variables":[{"name":"array_1","nativeSrc":"2639:7:1","nodeType":"YulTypedName","src":"2639:7:1","type":""}]},{"expression":{"arguments":[{"name":"array_1","nativeSrc":"2729:7:1","nodeType":"YulIdentifier","src":"2729:7:1"},{"name":"length_1","nativeSrc":"2738:8:1","nodeType":"YulIdentifier","src":"2738:8:1"}],"functionName":{"name":"mstore","nativeSrc":"2722:6:1","nodeType":"YulIdentifier","src":"2722:6:1"},"nativeSrc":"2722:25:1","nodeType":"YulFunctionCall","src":"2722:25:1"},"nativeSrc":"2722:25:1","nodeType":"YulExpressionStatement","src":"2722:25:1"},{"body":{"nativeSrc":"2803:16:1","nodeType":"YulBlock","src":"2803:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"2812:1:1","nodeType":"YulLiteral","src":"2812:1:1","type":"","value":"0"},{"kind":"number","nativeSrc":"2815:1:1","nodeType":"YulLiteral","src":"2815:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nativeSrc":"2805:6:1","nodeType":"YulIdentifier","src":"2805:6:1"},"nativeSrc":"2805:12:1","nodeType":"YulFunctionCall","src":"2805:12:1"},"nativeSrc":"2805:12:1","nodeType":"YulExpressionStatement","src":"2805:12:1"}]},"condition":{"arguments":[{"arguments":[{"arguments":[{"name":"_4","nativeSrc":"2774:2:1","nodeType":"YulIdentifier","src":"2774:2:1"},{"name":"length_1","nativeSrc":"2778:8:1","nodeType":"YulIdentifier","src":"2778:8:1"}],"functionName":{"name":"add","nativeSrc":"2770:3:1","nodeType":"YulIdentifier","src":"2770:3:1"},"nativeSrc":"2770:17:1","nodeType":"YulFunctionCall","src":"2770:17:1"},{"kind":"number","nativeSrc":"2789:2:1","nodeType":"YulLiteral","src":"2789:2:1","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"2766:3:1","nodeType":"YulIdentifier","src":"2766:3:1"},"nativeSrc":"2766:26:1","nodeType":"YulFunctionCall","src":"2766:26:1"},{"name":"dataEnd","nativeSrc":"2794:7:1","nodeType":"YulIdentifier","src":"2794:7:1"}],"functionName":{"name":"gt","nativeSrc":"2763:2:1","nodeType":"YulIdentifier","src":"2763:2:1"},"nativeSrc":"2763:39:1","nodeType":"YulFunctionCall","src":"2763:39:1"},"nativeSrc":"2760:59:1","nodeType":"YulIf","src":"2760:59:1"},{"expression":{"arguments":[{"arguments":[{"name":"_4","nativeSrc":"2871:2:1","nodeType":"YulIdentifier","src":"2871:2:1"},{"kind":"number","nativeSrc":"2875:2:1","nodeType":"YulLiteral","src":"2875:2:1","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"2867:3:1","nodeType":"YulIdentifier","src":"2867:3:1"},"nativeSrc":"2867:11:1","nodeType":"YulFunctionCall","src":"2867:11:1"},{"arguments":[{"name":"array_1","nativeSrc":"2884:7:1","nodeType":"YulIdentifier","src":"2884:7:1"},{"kind":"number","nativeSrc":"2893:2:1","nodeType":"YulLiteral","src":"2893:2:1","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"2880:3:1","nodeType":"YulIdentifier","src":"2880:3:1"},"nativeSrc":"2880:16:1","nodeType":"YulFunctionCall","src":"2880:16:1"},{"name":"length_1","nativeSrc":"2898:8:1","nodeType":"YulIdentifier","src":"2898:8:1"}],"functionName":{"name":"copy_memory_to_memory_with_cleanup","nativeSrc":"2832:34:1","nodeType":"YulIdentifier","src":"2832:34:1"},"nativeSrc":"2832:75:1","nodeType":"YulFunctionCall","src":"2832:75:1"},"nativeSrc":"2832:75:1","nodeType":"YulExpressionStatement","src":"2832:75:1"},{"expression":{"arguments":[{"arguments":[{"name":"value","nativeSrc":"2931:5:1","nodeType":"YulIdentifier","src":"2931:5:1"},{"kind":"number","nativeSrc":"2938:2:1","nodeType":"YulLiteral","src":"2938:2:1","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"2927:3:1","nodeType":"YulIdentifier","src":"2927:3:1"},"nativeSrc":"2927:14:1","nodeType":"YulFunctionCall","src":"2927:14:1"},{"name":"array_1","nativeSrc":"2943:7:1","nodeType":"YulIdentifier","src":"2943:7:1"}],"functionName":{"name":"mstore","nativeSrc":"2920:6:1","nodeType":"YulIdentifier","src":"2920:6:1"},"nativeSrc":"2920:31:1","nodeType":"YulFunctionCall","src":"2920:31:1"},"nativeSrc":"2920:31:1","nodeType":"YulExpressionStatement","src":"2920:31:1"},{"expression":{"arguments":[{"name":"dst","nativeSrc":"2971:3:1","nodeType":"YulIdentifier","src":"2971:3:1"},{"name":"value","nativeSrc":"2976:5:1","nodeType":"YulIdentifier","src":"2976:5:1"}],"functionName":{"name":"mstore","nativeSrc":"2964:6:1","nodeType":"YulIdentifier","src":"2964:6:1"},"nativeSrc":"2964:18:1","nodeType":"YulFunctionCall","src":"2964:18:1"},"nativeSrc":"2964:18:1","nodeType":"YulExpressionStatement","src":"2964:18:1"},{"nativeSrc":"2995:19:1","nodeType":"YulAssignment","src":"2995:19:1","value":{"arguments":[{"name":"dst","nativeSrc":"3006:3:1","nodeType":"YulIdentifier","src":"3006:3:1"},{"kind":"number","nativeSrc":"3011:2:1","nodeType":"YulLiteral","src":"3011:2:1","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"3002:3:1","nodeType":"YulIdentifier","src":"3002:3:1"},"nativeSrc":"3002:12:1","nodeType":"YulFunctionCall","src":"3002:12:1"},"variableNames":[{"name":"dst","nativeSrc":"2995:3:1","nodeType":"YulIdentifier","src":"2995:3:1"}]}]},"condition":{"arguments":[{"name":"src","nativeSrc":"1793:3:1","nodeType":"YulIdentifier","src":"1793:3:1"},{"name":"srcEnd","nativeSrc":"1798:6:1","nodeType":"YulIdentifier","src":"1798:6:1"}],"functionName":{"name":"lt","nativeSrc":"1790:2:1","nodeType":"YulIdentifier","src":"1790:2:1"},"nativeSrc":"1790:15:1","nodeType":"YulFunctionCall","src":"1790:15:1"},"nativeSrc":"1782:1242:1","nodeType":"YulForLoop","post":{"nativeSrc":"1806:23:1","nodeType":"YulBlock","src":"1806:23:1","statements":[{"nativeSrc":"1808:19:1","nodeType":"YulAssignment","src":"1808:19:1","value":{"arguments":[{"name":"src","nativeSrc":"1819:3:1","nodeType":"YulIdentifier","src":"1819:3:1"},{"kind":"number","nativeSrc":"1824:2:1","nodeType":"YulLiteral","src":"1824:2:1","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"1815:3:1","nodeType":"YulIdentifier","src":"1815:3:1"},"nativeSrc":"1815:12:1","nodeType":"YulFunctionCall","src":"1815:12:1"},"variableNames":[{"name":"src","nativeSrc":"1808:3:1","nodeType":"YulIdentifier","src":"1808:3:1"}]}]},"pre":{"nativeSrc":"1786:3:1","nodeType":"YulBlock","src":"1786:3:1","statements":[]},"src":"1782:1242:1"},{"nativeSrc":"3033:15:1","nodeType":"YulAssignment","src":"3033:15:1","value":{"name":"array","nativeSrc":"3043:5:1","nodeType":"YulIdentifier","src":"3043:5:1"},"variableNames":[{"name":"value0","nativeSrc":"3033:6:1","nodeType":"YulIdentifier","src":"3033:6:1"}]}]},"name":"abi_decode_tuple_t_array$_t_struct$_Call_$19_memory_ptr_$dyn_memory_ptr_fromMemory","nativeSrc":"1000:2054:1","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"1092:9:1","nodeType":"YulTypedName","src":"1092:9:1","type":""},{"name":"dataEnd","nativeSrc":"1103:7:1","nodeType":"YulTypedName","src":"1103:7:1","type":""}],"returnVariables":[{"name":"value0","nativeSrc":"1115:6:1","nodeType":"YulTypedName","src":"1115:6:1","type":""}],"src":"1000:2054:1"},{"body":{"nativeSrc":"3091:152:1","nodeType":"YulBlock","src":"3091:152:1","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"3108:1:1","nodeType":"YulLiteral","src":"3108:1:1","type":"","value":"0"},{"kind":"number","nativeSrc":"3111:77:1","nodeType":"YulLiteral","src":"3111:77:1","type":"","value":"35408467139433450592217433187231851964531694900788300625387963629091585785856"}],"functionName":{"name":"mstore","nativeSrc":"3101:6:1","nodeType":"YulIdentifier","src":"3101:6:1"},"nativeSrc":"3101:88:1","nodeType":"YulFunctionCall","src":"3101:88:1"},"nativeSrc":"3101:88:1","nodeType":"YulExpressionStatement","src":"3101:88:1"},{"expression":{"arguments":[{"kind":"number","nativeSrc":"3205:1:1","nodeType":"YulLiteral","src":"3205:1:1","type":"","value":"4"},{"kind":"number","nativeSrc":"3208:4:1","nodeType":"YulLiteral","src":"3208:4:1","type":"","value":"0x32"}],"functionName":{"name":"mstore","nativeSrc":"3198:6:1","nodeType":"YulIdentifier","src":"3198:6:1"},"nativeSrc":"3198:15:1","nodeType":"YulFunctionCall","src":"3198:15:1"},"nativeSrc":"3198:15:1","nodeType":"YulExpressionStatement","src":"3198:15:1"},{"expression":{"arguments":[{"kind":"number","nativeSrc":"3229:1:1","nodeType":"YulLiteral","src":"3229:1:1","type":"","value":"0"},{"kind":"number","nativeSrc":"3232:4:1","nodeType":"YulLiteral","src":"3232:4:1","type":"","value":"0x24"}],"functionName":{"name":"revert","nativeSrc":"3222:6:1","nodeType":"YulIdentifier","src":"3222:6:1"},"nativeSrc":"3222:15:1","nodeType":"YulFunctionCall","src":"3222:15:1"},"nativeSrc":"3222:15:1","nodeType":"YulExpressionStatement","src":"3222:15:1"}]},"name":"panic_error_0x32","nativeSrc":"3059:184:1","nodeType":"YulFunctionDefinition","src":"3059:184:1"},{"body":{"nativeSrc":"3471:1040:1","nodeType":"YulBlock","src":"3471:1040:1","statements":[{"nativeSrc":"3481:32:1","nodeType":"YulVariableDeclaration","src":"3481:32:1","value":{"arguments":[{"name":"headStart","nativeSrc":"3499:9:1","nodeType":"YulIdentifier","src":"3499:9:1"},{"kind":"number","nativeSrc":"3510:2:1","nodeType":"YulLiteral","src":"3510:2:1","type":"","value":"64"}],"functionName":{"name":"add","nativeSrc":"3495:3:1","nodeType":"YulIdentifier","src":"3495:3:1"},"nativeSrc":"3495:18:1","nodeType":"YulFunctionCall","src":"3495:18:1"},"variables":[{"name":"tail_1","nativeSrc":"3485:6:1","nodeType":"YulTypedName","src":"3485:6:1","type":""}]},{"expression":{"arguments":[{"name":"headStart","nativeSrc":"3529:9:1","nodeType":"YulIdentifier","src":"3529:9:1"},{"name":"value0","nativeSrc":"3540:6:1","nodeType":"YulIdentifier","src":"3540:6:1"}],"functionName":{"name":"mstore","nativeSrc":"3522:6:1","nodeType":"YulIdentifier","src":"3522:6:1"},"nativeSrc":"3522:25:1","nodeType":"YulFunctionCall","src":"3522:25:1"},"nativeSrc":"3522:25:1","nodeType":"YulExpressionStatement","src":"3522:25:1"},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"3567:9:1","nodeType":"YulIdentifier","src":"3567:9:1"},{"kind":"number","nativeSrc":"3578:2:1","nodeType":"YulLiteral","src":"3578:2:1","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"3563:3:1","nodeType":"YulIdentifier","src":"3563:3:1"},"nativeSrc":"3563:18:1","nodeType":"YulFunctionCall","src":"3563:18:1"},{"kind":"number","nativeSrc":"3583:2:1","nodeType":"YulLiteral","src":"3583:2:1","type":"","value":"64"}],"functionName":{"name":"mstore","nativeSrc":"3556:6:1","nodeType":"YulIdentifier","src":"3556:6:1"},"nativeSrc":"3556:30:1","nodeType":"YulFunctionCall","src":"3556:30:1"},"nativeSrc":"3556:30:1","nodeType":"YulExpressionStatement","src":"3556:30:1"},{"nativeSrc":"3595:17:1","nodeType":"YulVariableDeclaration","src":"3595:17:1","value":{"name":"tail_1","nativeSrc":"3606:6:1","nodeType":"YulIdentifier","src":"3606:6:1"},"variables":[{"name":"pos","nativeSrc":"3599:3:1","nodeType":"YulTypedName","src":"3599:3:1","type":""}]},{"nativeSrc":"3621:27:1","nodeType":"YulVariableDeclaration","src":"3621:27:1","value":{"arguments":[{"name":"value1","nativeSrc":"3641:6:1","nodeType":"YulIdentifier","src":"3641:6:1"}],"functionName":{"name":"mload","nativeSrc":"3635:5:1","nodeType":"YulIdentifier","src":"3635:5:1"},"nativeSrc":"3635:13:1","nodeType":"YulFunctionCall","src":"3635:13:1"},"variables":[{"name":"length","nativeSrc":"3625:6:1","nodeType":"YulTypedName","src":"3625:6:1","type":""}]},{"expression":{"arguments":[{"name":"tail_1","nativeSrc":"3664:6:1","nodeType":"YulIdentifier","src":"3664:6:1"},{"name":"length","nativeSrc":"3672:6:1","nodeType":"YulIdentifier","src":"3672:6:1"}],"functionName":{"name":"mstore","nativeSrc":"3657:6:1","nodeType":"YulIdentifier","src":"3657:6:1"},"nativeSrc":"3657:22:1","nodeType":"YulFunctionCall","src":"3657:22:1"},"nativeSrc":"3657:22:1","nodeType":"YulExpressionStatement","src":"3657:22:1"},{"nativeSrc":"3688:25:1","nodeType":"YulAssignment","src":"3688:25:1","value":{"arguments":[{"name":"headStart","nativeSrc":"3699:9:1","nodeType":"YulIdentifier","src":"3699:9:1"},{"kind":"number","nativeSrc":"3710:2:1","nodeType":"YulLiteral","src":"3710:2:1","type":"","value":"96"}],"functionName":{"name":"add","nativeSrc":"3695:3:1","nodeType":"YulIdentifier","src":"3695:3:1"},"nativeSrc":"3695:18:1","nodeType":"YulFunctionCall","src":"3695:18:1"},"variableNames":[{"name":"pos","nativeSrc":"3688:3:1","nodeType":"YulIdentifier","src":"3688:3:1"}]},{"nativeSrc":"3722:54:1","nodeType":"YulVariableDeclaration","src":"3722:54:1","value":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"3744:9:1","nodeType":"YulIdentifier","src":"3744:9:1"},{"arguments":[{"name":"length","nativeSrc":"3759:6:1","nodeType":"YulIdentifier","src":"3759:6:1"},{"kind":"number","nativeSrc":"3767:2:1","nodeType":"YulLiteral","src":"3767:2:1","type":"","value":"32"}],"functionName":{"name":"mul","nativeSrc":"3755:3:1","nodeType":"YulIdentifier","src":"3755:3:1"},"nativeSrc":"3755:15:1","nodeType":"YulFunctionCall","src":"3755:15:1"}],"functionName":{"name":"add","nativeSrc":"3740:3:1","nodeType":"YulIdentifier","src":"3740:3:1"},"nativeSrc":"3740:31:1","nodeType":"YulFunctionCall","src":"3740:31:1"},{"kind":"number","nativeSrc":"3773:2:1","nodeType":"YulLiteral","src":"3773:2:1","type":"","value":"96"}],"functionName":{"name":"add","nativeSrc":"3736:3:1","nodeType":"YulIdentifier","src":"3736:3:1"},"nativeSrc":"3736:40:1","nodeType":"YulFunctionCall","src":"3736:40:1"},"variables":[{"name":"tail_2","nativeSrc":"3726:6:1","nodeType":"YulTypedName","src":"3726:6:1","type":""}]},{"nativeSrc":"3785:29:1","nodeType":"YulVariableDeclaration","src":"3785:29:1","value":{"arguments":[{"name":"value1","nativeSrc":"3803:6:1","nodeType":"YulIdentifier","src":"3803:6:1"},{"kind":"number","nativeSrc":"3811:2:1","nodeType":"YulLiteral","src":"3811:2:1","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"3799:3:1","nodeType":"YulIdentifier","src":"3799:3:1"},"nativeSrc":"3799:15:1","nodeType":"YulFunctionCall","src":"3799:15:1"},"variables":[{"name":"srcPtr","nativeSrc":"3789:6:1","nodeType":"YulTypedName","src":"3789:6:1","type":""}]},{"nativeSrc":"3823:10:1","nodeType":"YulVariableDeclaration","src":"3823:10:1","value":{"kind":"number","nativeSrc":"3832:1:1","nodeType":"YulLiteral","src":"3832:1:1","type":"","value":"0"},"variables":[{"name":"i","nativeSrc":"3827:1:1","nodeType":"YulTypedName","src":"3827:1:1","type":""}]},{"body":{"nativeSrc":"3891:591:1","nodeType":"YulBlock","src":"3891:591:1","statements":[{"expression":{"arguments":[{"name":"pos","nativeSrc":"3912:3:1","nodeType":"YulIdentifier","src":"3912:3:1"},{"arguments":[{"arguments":[{"name":"tail_2","nativeSrc":"3925:6:1","nodeType":"YulIdentifier","src":"3925:6:1"},{"name":"headStart","nativeSrc":"3933:9:1","nodeType":"YulIdentifier","src":"3933:9:1"}],"functionName":{"name":"sub","nativeSrc":"3921:3:1","nodeType":"YulIdentifier","src":"3921:3:1"},"nativeSrc":"3921:22:1","nodeType":"YulFunctionCall","src":"3921:22:1"},{"arguments":[{"kind":"number","nativeSrc":"3949:2:1","nodeType":"YulLiteral","src":"3949:2:1","type":"","value":"95"}],"functionName":{"name":"not","nativeSrc":"3945:3:1","nodeType":"YulIdentifier","src":"3945:3:1"},"nativeSrc":"3945:7:1","nodeType":"YulFunctionCall","src":"3945:7:1"}],"functionName":{"name":"add","nativeSrc":"3917:3:1","nodeType":"YulIdentifier","src":"3917:3:1"},"nativeSrc":"3917:36:1","nodeType":"YulFunctionCall","src":"3917:36:1"}],"functionName":{"name":"mstore","nativeSrc":"3905:6:1","nodeType":"YulIdentifier","src":"3905:6:1"},"nativeSrc":"3905:49:1","nodeType":"YulFunctionCall","src":"3905:49:1"},"nativeSrc":"3905:49:1","nodeType":"YulExpressionStatement","src":"3905:49:1"},{"nativeSrc":"3967:23:1","nodeType":"YulVariableDeclaration","src":"3967:23:1","value":{"arguments":[{"name":"srcPtr","nativeSrc":"3983:6:1","nodeType":"YulIdentifier","src":"3983:6:1"}],"functionName":{"name":"mload","nativeSrc":"3977:5:1","nodeType":"YulIdentifier","src":"3977:5:1"},"nativeSrc":"3977:13:1","nodeType":"YulFunctionCall","src":"3977:13:1"},"variables":[{"name":"_1","nativeSrc":"3971:2:1","nodeType":"YulTypedName","src":"3971:2:1","type":""}]},{"expression":{"arguments":[{"name":"tail_2","nativeSrc":"4010:6:1","nodeType":"YulIdentifier","src":"4010:6:1"},{"arguments":[{"arguments":[{"arguments":[{"name":"_1","nativeSrc":"4038:2:1","nodeType":"YulIdentifier","src":"4038:2:1"}],"functionName":{"name":"mload","nativeSrc":"4032:5:1","nodeType":"YulIdentifier","src":"4032:5:1"},"nativeSrc":"4032:9:1","nodeType":"YulFunctionCall","src":"4032:9:1"}],"functionName":{"name":"iszero","nativeSrc":"4025:6:1","nodeType":"YulIdentifier","src":"4025:6:1"},"nativeSrc":"4025:17:1","nodeType":"YulFunctionCall","src":"4025:17:1"}],"functionName":{"name":"iszero","nativeSrc":"4018:6:1","nodeType":"YulIdentifier","src":"4018:6:1"},"nativeSrc":"4018:25:1","nodeType":"YulFunctionCall","src":"4018:25:1"}],"functionName":{"name":"mstore","nativeSrc":"4003:6:1","nodeType":"YulIdentifier","src":"4003:6:1"},"nativeSrc":"4003:41:1","nodeType":"YulFunctionCall","src":"4003:41:1"},"nativeSrc":"4003:41:1","nodeType":"YulExpressionStatement","src":"4003:41:1"},{"nativeSrc":"4057:38:1","nodeType":"YulVariableDeclaration","src":"4057:38:1","value":{"arguments":[{"arguments":[{"name":"_1","nativeSrc":"4087:2:1","nodeType":"YulIdentifier","src":"4087:2:1"},{"kind":"number","nativeSrc":"4091:2:1","nodeType":"YulLiteral","src":"4091:2:1","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"4083:3:1","nodeType":"YulIdentifier","src":"4083:3:1"},"nativeSrc":"4083:11:1","nodeType":"YulFunctionCall","src":"4083:11:1"}],"functionName":{"name":"mload","nativeSrc":"4077:5:1","nodeType":"YulIdentifier","src":"4077:5:1"},"nativeSrc":"4077:18:1","nodeType":"YulFunctionCall","src":"4077:18:1"},"variables":[{"name":"memberValue0","nativeSrc":"4061:12:1","nodeType":"YulTypedName","src":"4061:12:1","type":""}]},{"expression":{"arguments":[{"arguments":[{"name":"tail_2","nativeSrc":"4119:6:1","nodeType":"YulIdentifier","src":"4119:6:1"},{"kind":"number","nativeSrc":"4127:2:1","nodeType":"YulLiteral","src":"4127:2:1","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"4115:3:1","nodeType":"YulIdentifier","src":"4115:3:1"},"nativeSrc":"4115:15:1","nodeType":"YulFunctionCall","src":"4115:15:1"},{"kind":"number","nativeSrc":"4132:2:1","nodeType":"YulLiteral","src":"4132:2:1","type":"","value":"64"}],"functionName":{"name":"mstore","nativeSrc":"4108:6:1","nodeType":"YulIdentifier","src":"4108:6:1"},"nativeSrc":"4108:27:1","nodeType":"YulFunctionCall","src":"4108:27:1"},"nativeSrc":"4108:27:1","nodeType":"YulExpressionStatement","src":"4108:27:1"},{"nativeSrc":"4148:35:1","nodeType":"YulVariableDeclaration","src":"4148:35:1","value":{"arguments":[{"name":"memberValue0","nativeSrc":"4170:12:1","nodeType":"YulIdentifier","src":"4170:12:1"}],"functionName":{"name":"mload","nativeSrc":"4164:5:1","nodeType":"YulIdentifier","src":"4164:5:1"},"nativeSrc":"4164:19:1","nodeType":"YulFunctionCall","src":"4164:19:1"},"variables":[{"name":"length_1","nativeSrc":"4152:8:1","nodeType":"YulTypedName","src":"4152:8:1","type":""}]},{"expression":{"arguments":[{"arguments":[{"name":"tail_2","nativeSrc":"4207:6:1","nodeType":"YulIdentifier","src":"4207:6:1"},{"kind":"number","nativeSrc":"4215:2:1","nodeType":"YulLiteral","src":"4215:2:1","type":"","value":"64"}],"functionName":{"name":"add","nativeSrc":"4203:3:1","nodeType":"YulIdentifier","src":"4203:3:1"},"nativeSrc":"4203:15:1","nodeType":"YulFunctionCall","src":"4203:15:1"},{"name":"length_1","nativeSrc":"4220:8:1","nodeType":"YulIdentifier","src":"4220:8:1"}],"functionName":{"name":"mstore","nativeSrc":"4196:6:1","nodeType":"YulIdentifier","src":"4196:6:1"},"nativeSrc":"4196:33:1","nodeType":"YulFunctionCall","src":"4196:33:1"},"nativeSrc":"4196:33:1","nodeType":"YulExpressionStatement","src":"4196:33:1"},{"expression":{"arguments":[{"arguments":[{"name":"memberValue0","nativeSrc":"4281:12:1","nodeType":"YulIdentifier","src":"4281:12:1"},{"kind":"number","nativeSrc":"4295:2:1","nodeType":"YulLiteral","src":"4295:2:1","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"4277:3:1","nodeType":"YulIdentifier","src":"4277:3:1"},"nativeSrc":"4277:21:1","nodeType":"YulFunctionCall","src":"4277:21:1"},{"arguments":[{"name":"tail_2","nativeSrc":"4304:6:1","nodeType":"YulIdentifier","src":"4304:6:1"},{"kind":"number","nativeSrc":"4312:2:1","nodeType":"YulLiteral","src":"4312:2:1","type":"","value":"96"}],"functionName":{"name":"add","nativeSrc":"4300:3:1","nodeType":"YulIdentifier","src":"4300:3:1"},"nativeSrc":"4300:15:1","nodeType":"YulFunctionCall","src":"4300:15:1"},{"name":"length_1","nativeSrc":"4317:8:1","nodeType":"YulIdentifier","src":"4317:8:1"}],"functionName":{"name":"copy_memory_to_memory_with_cleanup","nativeSrc":"4242:34:1","nodeType":"YulIdentifier","src":"4242:34:1"},"nativeSrc":"4242:84:1","nodeType":"YulFunctionCall","src":"4242:84:1"},"nativeSrc":"4242:84:1","nodeType":"YulExpressionStatement","src":"4242:84:1"},{"nativeSrc":"4339:63:1","nodeType":"YulAssignment","src":"4339:63:1","value":{"arguments":[{"arguments":[{"name":"tail_2","nativeSrc":"4357:6:1","nodeType":"YulIdentifier","src":"4357:6:1"},{"arguments":[{"arguments":[{"name":"length_1","nativeSrc":"4373:8:1","nodeType":"YulIdentifier","src":"4373:8:1"},{"kind":"number","nativeSrc":"4383:2:1","nodeType":"YulLiteral","src":"4383:2:1","type":"","value":"31"}],"functionName":{"name":"add","nativeSrc":"4369:3:1","nodeType":"YulIdentifier","src":"4369:3:1"},"nativeSrc":"4369:17:1","nodeType":"YulFunctionCall","src":"4369:17:1"},{"arguments":[{"kind":"number","nativeSrc":"4392:2:1","nodeType":"YulLiteral","src":"4392:2:1","type":"","value":"31"}],"functionName":{"name":"not","nativeSrc":"4388:3:1","nodeType":"YulIdentifier","src":"4388:3:1"},"nativeSrc":"4388:7:1","nodeType":"YulFunctionCall","src":"4388:7:1"}],"functionName":{"name":"and","nativeSrc":"4365:3:1","nodeType":"YulIdentifier","src":"4365:3:1"},"nativeSrc":"4365:31:1","nodeType":"YulFunctionCall","src":"4365:31:1"}],"functionName":{"name":"add","nativeSrc":"4353:3:1","nodeType":"YulIdentifier","src":"4353:3:1"},"nativeSrc":"4353:44:1","nodeType":"YulFunctionCall","src":"4353:44:1"},{"kind":"number","nativeSrc":"4399:2:1","nodeType":"YulLiteral","src":"4399:2:1","type":"","value":"96"}],"functionName":{"name":"add","nativeSrc":"4349:3:1","nodeType":"YulIdentifier","src":"4349:3:1"},"nativeSrc":"4349:53:1","nodeType":"YulFunctionCall","src":"4349:53:1"},"variableNames":[{"name":"tail_2","nativeSrc":"4339:6:1","nodeType":"YulIdentifier","src":"4339:6:1"}]},{"nativeSrc":"4415:25:1","nodeType":"YulAssignment","src":"4415:25:1","value":{"arguments":[{"name":"srcPtr","nativeSrc":"4429:6:1","nodeType":"YulIdentifier","src":"4429:6:1"},{"kind":"number","nativeSrc":"4437:2:1","nodeType":"YulLiteral","src":"4437:2:1","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"4425:3:1","nodeType":"YulIdentifier","src":"4425:3:1"},"nativeSrc":"4425:15:1","nodeType":"YulFunctionCall","src":"4425:15:1"},"variableNames":[{"name":"srcPtr","nativeSrc":"4415:6:1","nodeType":"YulIdentifier","src":"4415:6:1"}]},{"nativeSrc":"4453:19:1","nodeType":"YulAssignment","src":"4453:19:1","value":{"arguments":[{"name":"pos","nativeSrc":"4464:3:1","nodeType":"YulIdentifier","src":"4464:3:1"},{"kind":"number","nativeSrc":"4469:2:1","nodeType":"YulLiteral","src":"4469:2:1","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"4460:3:1","nodeType":"YulIdentifier","src":"4460:3:1"},"nativeSrc":"4460:12:1","nodeType":"YulFunctionCall","src":"4460:12:1"},"variableNames":[{"name":"pos","nativeSrc":"4453:3:1","nodeType":"YulIdentifier","src":"4453:3:1"}]}]},"condition":{"arguments":[{"name":"i","nativeSrc":"3853:1:1","nodeType":"YulIdentifier","src":"3853:1:1"},{"name":"length","nativeSrc":"3856:6:1","nodeType":"YulIdentifier","src":"3856:6:1"}],"functionName":{"name":"lt","nativeSrc":"3850:2:1","nodeType":"YulIdentifier","src":"3850:2:1"},"nativeSrc":"3850:13:1","nodeType":"YulFunctionCall","src":"3850:13:1"},"nativeSrc":"3842:640:1","nodeType":"YulForLoop","post":{"nativeSrc":"3864:18:1","nodeType":"YulBlock","src":"3864:18:1","statements":[{"nativeSrc":"3866:14:1","nodeType":"YulAssignment","src":"3866:14:1","value":{"arguments":[{"name":"i","nativeSrc":"3875:1:1","nodeType":"YulIdentifier","src":"3875:1:1"},{"kind":"number","nativeSrc":"3878:1:1","nodeType":"YulLiteral","src":"3878:1:1","type":"","value":"1"}],"functionName":{"name":"add","nativeSrc":"3871:3:1","nodeType":"YulIdentifier","src":"3871:3:1"},"nativeSrc":"3871:9:1","nodeType":"YulFunctionCall","src":"3871:9:1"},"variableNames":[{"name":"i","nativeSrc":"3866:1:1","nodeType":"YulIdentifier","src":"3866:1:1"}]}]},"pre":{"nativeSrc":"3846:3:1","nodeType":"YulBlock","src":"3846:3:1","statements":[]},"src":"3842:640:1"},{"nativeSrc":"4491:14:1","nodeType":"YulAssignment","src":"4491:14:1","value":{"name":"tail_2","nativeSrc":"4499:6:1","nodeType":"YulIdentifier","src":"4499:6:1"},"variableNames":[{"name":"tail","nativeSrc":"4491:4:1","nodeType":"YulIdentifier","src":"4491:4:1"}]}]},"name":"abi_encode_tuple_t_uint256_t_array$_t_struct$_Result_$24_memory_ptr_$dyn_memory_ptr__to_t_uint256_t_array$_t_struct$_Result_$24_memory_ptr_$dyn_memory_ptr__fromStack_reversed","nativeSrc":"3248:1263:1","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"3432:9:1","nodeType":"YulTypedName","src":"3432:9:1","type":""},{"name":"value1","nativeSrc":"3443:6:1","nodeType":"YulTypedName","src":"3443:6:1","type":""},{"name":"value0","nativeSrc":"3451:6:1","nodeType":"YulTypedName","src":"3451:6:1","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"3462:4:1","nodeType":"YulTypedName","src":"3462:4:1","type":""}],"src":"3248:1263:1"}]},"contents":"{\n { }\n function panic_error_0x41()\n {\n mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)\n mstore(4, 0x41)\n revert(0, 0x24)\n }\n function allocate_memory_1263() -> memPtr\n {\n memPtr := mload(0x40)\n let newFreePtr := add(memPtr, 0x40)\n if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error_0x41() }\n mstore(0x40, newFreePtr)\n }\n function allocate_memory(size) -> memPtr\n {\n memPtr := mload(64)\n let newFreePtr := add(memPtr, and(add(size, 31), not(31)))\n if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error_0x41() }\n mstore(64, newFreePtr)\n }\n function copy_memory_to_memory_with_cleanup(src, dst, length)\n {\n let i := 0\n for { } lt(i, length) { i := add(i, 32) }\n {\n mstore(add(dst, i), mload(add(src, i)))\n }\n mstore(add(dst, length), 0)\n }\n function abi_decode_tuple_t_array$_t_struct$_Call_$19_memory_ptr_$dyn_memory_ptr_fromMemory(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n let offset := mload(headStart)\n if gt(offset, 0xffffffffffffffff) { revert(0, 0) }\n let _1 := add(headStart, offset)\n if iszero(slt(add(_1, 0x1f), dataEnd)) { revert(0, 0) }\n let length := mload(_1)\n if gt(length, 0xffffffffffffffff) { panic_error_0x41() }\n let _2 := mul(length, 32)\n let dst := allocate_memory(add(_2, 32))\n let array := dst\n mstore(dst, length)\n dst := add(dst, 32)\n let srcEnd := add(add(_1, _2), 32)\n if gt(srcEnd, dataEnd) { revert(0, 0) }\n let src := add(_1, 32)\n for { } lt(src, srcEnd) { src := add(src, 32) }\n {\n let innerOffset := mload(src)\n if gt(innerOffset, 0xffffffffffffffff) { revert(0, 0) }\n let _3 := add(_1, innerOffset)\n if slt(add(sub(dataEnd, _3), not(31)), 0x40) { revert(0, 0) }\n let value := allocate_memory_1263()\n let value_1 := mload(add(_3, 32))\n if iszero(eq(value_1, and(value_1, sub(exp(2, 160), 1)))) { revert(0, 0) }\n mstore(value, value_1)\n let offset_1 := mload(add(_3, 0x40))\n if gt(offset_1, 0xffffffffffffffff) { revert(0, 0) }\n let _4 := add(add(_3, offset_1), 32)\n if iszero(slt(add(_4, 0x1f), dataEnd)) { revert(0, 0) }\n let length_1 := mload(_4)\n if gt(length_1, 0xffffffffffffffff) { panic_error_0x41() }\n let array_1 := allocate_memory(add(and(add(length_1, 0x1f), not(31)), 32))\n mstore(array_1, length_1)\n if gt(add(add(_4, length_1), 32), dataEnd) { revert(0, 0) }\n copy_memory_to_memory_with_cleanup(add(_4, 32), add(array_1, 32), length_1)\n mstore(add(value, 32), array_1)\n mstore(dst, value)\n dst := add(dst, 32)\n }\n value0 := array\n }\n function panic_error_0x32()\n {\n mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)\n mstore(4, 0x32)\n revert(0, 0x24)\n }\n function abi_encode_tuple_t_uint256_t_array$_t_struct$_Result_$24_memory_ptr_$dyn_memory_ptr__to_t_uint256_t_array$_t_struct$_Result_$24_memory_ptr_$dyn_memory_ptr__fromStack_reversed(headStart, value1, value0) -> tail\n {\n let tail_1 := add(headStart, 64)\n mstore(headStart, value0)\n mstore(add(headStart, 32), 64)\n let pos := tail_1\n let length := mload(value1)\n mstore(tail_1, length)\n pos := add(headStart, 96)\n let tail_2 := add(add(headStart, mul(length, 32)), 96)\n let srcPtr := add(value1, 32)\n let i := 0\n for { } lt(i, length) { i := add(i, 1) }\n {\n mstore(pos, add(sub(tail_2, headStart), not(95)))\n let _1 := mload(srcPtr)\n mstore(tail_2, iszero(iszero(mload(_1))))\n let memberValue0 := mload(add(_1, 32))\n mstore(add(tail_2, 32), 64)\n let length_1 := mload(memberValue0)\n mstore(add(tail_2, 64), length_1)\n copy_memory_to_memory_with_cleanup(add(memberValue0, 32), add(tail_2, 96), length_1)\n tail_2 := add(add(tail_2, and(add(length_1, 31), not(31))), 96)\n srcPtr := add(srcPtr, 32)\n pos := add(pos, 32)\n }\n tail := tail_2\n }\n}","id":1,"language":"Yul","name":"#utility.yul"}],"linkReferences":{},"object":"608060405234801561001057600080fd5b506040516104b13803806104b183398101604081905261002f9161025a565b600081516001604060020a0381111561004a5761004a6101af565b60405190808252806020026020018201604052801561009057816020015b6040805180820190915260008152606060208201528152602001906001900390816100685790505b50905060005b825181101561013f576100f28382815181106100b4576100b46103e3565b6020026020010151600001518483815181106100d2576100d26103e3565b60200260200101516020015161016e640100000000026401000000009004565b838381518110610104576101046103e3565b6020026020010151600001848481518110610121576101216103e3565b60209081029190910181015101919091529015159052600101610096565b5060004382604051602001610155929190610412565b6040516020818303038152906040529050805160208201f35b6000606060405190506000815260208101604052600080845160208601875afa603f3d01601f191682016040523d825291503d6000602083013e9250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604080519081016001604060020a0381118282101715610200576102006101af565b60405290565b604051601f8201601f191681016001604060020a038111828210171561022e5761022e6101af565b604052919050565b60005b83811015610251578181015183820152602001610239565b50506000910152565b60006020828403121561026c57600080fd5b81516001604060020a0381111561028257600080fd5b8201601f8101841361029357600080fd5b80516001604060020a038111156102ac576102ac6101af565b602081026102bc60208201610206565b918252602081840181019290810190878411156102d857600080fd5b6020850192505b838310156103d85782516001604060020a038111156102fd57600080fd5b85016040818a03601f1901121561031357600080fd5b61031b6101de565b6020820151600160a060020a038116811461033557600080fd5b815260408201516001604060020a0381111561035057600080fd5b60208184010192505089601f83011261036857600080fd5b81516001604060020a03811115610381576103816101af565b610394601f8201601f1916602001610206565b8181528b60208386010111156103a957600080fd5b6103ba826020830160208701610236565b806020840152505080845250506020820191506020830192506102df565b979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000604082018483526040602084015280845180835260608501915060606020820286010192506020860160005b828110156104a357605f19878603018452815180511515865260208101519050604060208701528051806040880152610480816060890160208501610236565b601f01601f19169590950160600194506020938401939190910190600101610440565b509297965050505050505056fe","opcodes":"PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH2 0x4B1 CODESIZE SUB DUP1 PUSH2 0x4B1 DUP4 CODECOPY DUP2 ADD PUSH1 0x40 DUP2 SWAP1 MSTORE PUSH2 0x2F SWAP2 PUSH2 0x25A JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP2 GT ISZERO PUSH2 0x4A JUMPI PUSH2 0x4A PUSH2 0x1AF JUMP JUMPDEST PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x90 JUMPI DUP2 PUSH1 0x20 ADD JUMPDEST PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD SWAP1 SWAP2 MSTORE PUSH1 0x0 DUP2 MSTORE PUSH1 0x60 PUSH1 0x20 DUP3 ADD MSTORE DUP2 MSTORE PUSH1 0x20 ADD SWAP1 PUSH1 0x1 SWAP1 SUB SWAP1 DUP2 PUSH2 0x68 JUMPI SWAP1 POP JUMPDEST POP SWAP1 POP PUSH1 0x0 JUMPDEST DUP3 MLOAD DUP2 LT ISZERO PUSH2 0x13F JUMPI PUSH2 0xF2 DUP4 DUP3 DUP2 MLOAD DUP2 LT PUSH2 0xB4 JUMPI PUSH2 0xB4 PUSH2 0x3E3 JUMP JUMPDEST PUSH1 0x20 MUL PUSH1 0x20 ADD ADD MLOAD PUSH1 0x0 ADD MLOAD DUP5 DUP4 DUP2 MLOAD DUP2 LT PUSH2 0xD2 JUMPI PUSH2 0xD2 PUSH2 0x3E3 JUMP JUMPDEST PUSH1 0x20 MUL PUSH1 0x20 ADD ADD MLOAD PUSH1 0x20 ADD MLOAD PUSH2 0x16E PUSH5 0x100000000 MUL PUSH5 0x100000000 SWAP1 DIV JUMP JUMPDEST DUP4 DUP4 DUP2 MLOAD DUP2 LT PUSH2 0x104 JUMPI PUSH2 0x104 PUSH2 0x3E3 JUMP JUMPDEST PUSH1 0x20 MUL PUSH1 0x20 ADD ADD MLOAD PUSH1 0x0 ADD DUP5 DUP5 DUP2 MLOAD DUP2 LT PUSH2 0x121 JUMPI PUSH2 0x121 PUSH2 0x3E3 JUMP JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP2 SWAP1 SWAP2 ADD DUP2 ADD MLOAD ADD SWAP2 SWAP1 SWAP2 MSTORE SWAP1 ISZERO ISZERO SWAP1 MSTORE PUSH1 0x1 ADD PUSH2 0x96 JUMP JUMPDEST POP PUSH1 0x0 NUMBER DUP3 PUSH1 0x40 MLOAD PUSH1 0x20 ADD PUSH2 0x155 SWAP3 SWAP2 SWAP1 PUSH2 0x412 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 DUP4 SUB SUB DUP2 MSTORE SWAP1 PUSH1 0x40 MSTORE SWAP1 POP DUP1 MLOAD PUSH1 0x20 DUP3 ADD RETURN JUMPDEST PUSH1 0x0 PUSH1 0x60 PUSH1 0x40 MLOAD SWAP1 POP PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 DUP2 ADD PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 DUP5 MLOAD PUSH1 0x20 DUP7 ADD DUP8 GAS STATICCALL PUSH1 0x3F RETURNDATASIZE ADD PUSH1 0x1F NOT AND DUP3 ADD PUSH1 0x40 MSTORE RETURNDATASIZE DUP3 MSTORE SWAP2 POP RETURNDATASIZE PUSH1 0x0 PUSH1 0x20 DUP4 ADD RETURNDATACOPY SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x41 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP1 DUP2 ADD PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0x200 JUMPI PUSH2 0x200 PUSH2 0x1AF JUMP JUMPDEST PUSH1 0x40 MSTORE SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x1F DUP3 ADD PUSH1 0x1F NOT AND DUP2 ADD PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0x22E JUMPI PUSH2 0x22E PUSH2 0x1AF JUMP JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x251 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x239 JUMP JUMPDEST POP POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x26C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 MLOAD PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP2 GT ISZERO PUSH2 0x282 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 ADD PUSH1 0x1F DUP2 ADD DUP5 SGT PUSH2 0x293 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP1 MLOAD PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP2 GT ISZERO PUSH2 0x2AC JUMPI PUSH2 0x2AC PUSH2 0x1AF JUMP JUMPDEST PUSH1 0x20 DUP2 MUL PUSH2 0x2BC PUSH1 0x20 DUP3 ADD PUSH2 0x206 JUMP JUMPDEST SWAP2 DUP3 MSTORE PUSH1 0x20 DUP2 DUP5 ADD DUP2 ADD SWAP3 SWAP1 DUP2 ADD SWAP1 DUP8 DUP5 GT ISZERO PUSH2 0x2D8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x20 DUP6 ADD SWAP3 POP JUMPDEST DUP4 DUP4 LT ISZERO PUSH2 0x3D8 JUMPI DUP3 MLOAD PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP2 GT ISZERO PUSH2 0x2FD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP6 ADD PUSH1 0x40 DUP2 DUP11 SUB PUSH1 0x1F NOT ADD SLT ISZERO PUSH2 0x313 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x31B PUSH2 0x1DE JUMP JUMPDEST PUSH1 0x20 DUP3 ADD MLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP2 AND DUP2 EQ PUSH2 0x335 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 MSTORE PUSH1 0x40 DUP3 ADD MLOAD PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP2 GT ISZERO PUSH2 0x350 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x20 DUP2 DUP5 ADD ADD SWAP3 POP POP DUP10 PUSH1 0x1F DUP4 ADD SLT PUSH2 0x368 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 MLOAD PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP2 GT ISZERO PUSH2 0x381 JUMPI PUSH2 0x381 PUSH2 0x1AF JUMP JUMPDEST PUSH2 0x394 PUSH1 0x1F DUP3 ADD PUSH1 0x1F NOT AND PUSH1 0x20 ADD PUSH2 0x206 JUMP JUMPDEST DUP2 DUP2 MSTORE DUP12 PUSH1 0x20 DUP4 DUP7 ADD ADD GT ISZERO PUSH2 0x3A9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x3BA DUP3 PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP8 ADD PUSH2 0x236 JUMP JUMPDEST DUP1 PUSH1 0x20 DUP5 ADD MSTORE POP POP DUP1 DUP5 MSTORE POP POP PUSH1 0x20 DUP3 ADD SWAP2 POP PUSH1 0x20 DUP4 ADD SWAP3 POP PUSH2 0x2DF JUMP JUMPDEST SWAP8 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x32 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x40 DUP3 ADD DUP5 DUP4 MSTORE PUSH1 0x40 PUSH1 0x20 DUP5 ADD MSTORE DUP1 DUP5 MLOAD DUP1 DUP4 MSTORE PUSH1 0x60 DUP6 ADD SWAP2 POP PUSH1 0x60 PUSH1 0x20 DUP3 MUL DUP7 ADD ADD SWAP3 POP PUSH1 0x20 DUP7 ADD PUSH1 0x0 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x4A3 JUMPI PUSH1 0x5F NOT DUP8 DUP7 SUB ADD DUP5 MSTORE DUP2 MLOAD DUP1 MLOAD ISZERO ISZERO DUP7 MSTORE PUSH1 0x20 DUP2 ADD MLOAD SWAP1 POP PUSH1 0x40 PUSH1 0x20 DUP8 ADD MSTORE DUP1 MLOAD DUP1 PUSH1 0x40 DUP9 ADD MSTORE PUSH2 0x480 DUP2 PUSH1 0x60 DUP10 ADD PUSH1 0x20 DUP6 ADD PUSH2 0x236 JUMP JUMPDEST PUSH1 0x1F ADD PUSH1 0x1F NOT AND SWAP6 SWAP1 SWAP6 ADD PUSH1 0x60 ADD SWAP5 POP PUSH1 0x20 SWAP4 DUP5 ADD SWAP4 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0x440 JUMP JUMPDEST POP SWAP3 SWAP8 SWAP7 POP POP POP POP POP POP POP JUMP INVALID ","sourceMap":"929:643:0:-:0;;;1092:478;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;1135:22;1173:5;:12;-1:-1:-1;;;;;1160:26:0;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;929:643;;;;;;;;;-1:-1:-1;929:643:0;;;;;;;1160:26;;;;;;;;;;;;;;;;1135:51;;1228:9;1223:145;1247:5;:12;1243:1;:16;1223:145;;;1317:40;1326:5;1332:1;1326:8;;;;;;;;:::i;:::-;;;;;;;:15;;;1343:5;1349:1;1343:8;;;;;;;;:::i;:::-;;;;;;;:13;;;1317:8;;;:40;;;:::i;:::-;1281:6;1288:1;1281:9;;;;;;;;:::i;:::-;;;;;;;:16;;1299:6;1306:1;1299:9;;;;;;;;:::i;:::-;;;;;;;;;;;;:14;1280:77;;;;;;;;;1261:3;;1223:145;;;;1427:19;1460:12;1474:6;1449:32;;;;;;;;;:::i;:::-;;;;;;;;;;;;;1427:54;;1546:6;1540:13;1533:4;1525:6;1521:17;1514:40;59:868;124:11;137:19;245:4;239:11;229:21;;346:1;338:6;331:17;382:2;374:6;370:15;364:4;357:29;530:1;527;520:4;514:11;509:2;503:4;499:13;493:4;486:5;475:57;650:38;658:16;650:38;-1:-1:-1;;646:54:0;634:67;;628:4;621:81;791:16;776:32;;465:67;-1:-1:-1;902:16:0;899:1;676:4;882:15;;867:52;59:868;;;;;:::o;14:184:1:-;66:77;63:1;56:88;163:4;160:1;153:15;187:4;184:1;177:15;203:257;275:4;269:11;;;307:17;;-1:-1:-1;;;;;339:34:1;;375:22;;;336:62;333:88;;;401:18;;:::i;:::-;437:4;430:24;203:257;:::o;465:275::-;536:2;530:9;601:2;582:13;;-1:-1:-1;;578:27:1;566:40;;-1:-1:-1;;;;;621:34:1;;657:22;;;618:62;615:88;;;683:18;;:::i;:::-;719:2;712:22;465:275;;-1:-1:-1;465:275:1:o;745:250::-;830:1;840:113;854:6;851:1;848:13;840:113;;;930:11;;;924:18;911:11;;;904:39;876:2;869:10;840:113;;;-1:-1:-1;;987:1:1;969:16;;962:27;745:250::o;1000:2054::-;1115:6;1168:2;1156:9;1147:7;1143:23;1139:32;1136:52;;;1184:1;1181;1174:12;1136:52;1217:9;1211:16;-1:-1:-1;;;;;1242:6:1;1239:30;1236:50;;;1282:1;1279;1272:12;1236:50;1305:22;;1358:4;1350:13;;1346:27;-1:-1:-1;1336:55:1;;1387:1;1384;1377:12;1336:55;1420:2;1414:9;-1:-1:-1;;;;;1438:6:1;1435:30;1432:56;;;1468:18;;:::i;:::-;1519:2;1511:6;1507:15;1542:28;1566:2;1562;1558:11;1542:28;:::i;:::-;1604:19;;;1648:2;1678:11;;;1674:20;;;1639:12;;;;1706:19;;;1703:39;;;1738:1;1735;1728:12;1703:39;1770:2;1766;1762:11;1751:22;;1782:1242;1798:6;1793:3;1790:15;1782:1242;;;1877:3;1871:10;-1:-1:-1;;;;;1900:11:1;1897:35;1894:55;;;1945:1;1942;1935:12;1894:55;1972:20;;2044:4;2016:16;;;-1:-1:-1;;2012:30:1;2008:41;2005:61;;;2062:1;2059;2052:12;2005:61;2092:22;;:::i;:::-;2156:2;2148:11;;2142:18;-1:-1:-1;;;;;2195:33:1;;2183:46;;2173:74;;2243:1;2240;2233:12;2173:74;2260:22;;2325:4;2317:13;;2311:20;-1:-1:-1;;;;;2347:32:1;;2344:52;;;2392:1;2389;2382:12;2344:52;2442:2;2431:8;2427:2;2423:17;2419:26;2409:36;;;2487:7;2480:4;2476:2;2472:13;2468:27;2458:55;;2509:1;2506;2499:12;2458:55;2548:2;2542:9;-1:-1:-1;;;;;2570:8:1;2567:32;2564:58;;;2602:18;;:::i;:::-;2650:59;2699:2;2674:19;;-1:-1:-1;;2670:33:1;2705:2;2666:42;2650:59;:::i;:::-;2738:8;2729:7;2722:25;2794:7;2789:2;2778:8;2774:2;2770:17;2766:26;2763:39;2760:59;;;2815:1;2812;2805:12;2760:59;2832:75;2898:8;2893:2;2884:7;2880:16;2875:2;2871;2867:11;2832:75;:::i;:::-;2943:7;2938:2;2931:5;2927:14;2920:31;;;2976:5;2971:3;2964:18;;;3011:2;3006:3;3002:12;2995:19;;1824:2;1819:3;1815:12;1808:19;;1782:1242;;;3043:5;1000:2054;-1:-1:-1;;;;;;;1000:2054:1:o;3059:184::-;3111:77;3108:1;3101:88;3208:4;3205:1;3198:15;3232:4;3229:1;3222:15;3248:1263;3462:4;3510:2;3499:9;3495:18;3540:6;3529:9;3522:25;3583:2;3578;3567:9;3563:18;3556:30;3606:6;3641;3635:13;3672:6;3664;3657:22;3710:2;3699:9;3695:18;3688:25;;3773:2;3767;3759:6;3755:15;3744:9;3740:31;3736:40;3722:54;;3811:2;3803:6;3799:15;3832:1;3842:640;3856:6;3853:1;3850:13;3842:640;;;3949:2;3945:7;3933:9;3925:6;3921:22;3917:36;3912:3;3905:49;3983:6;3977:13;4038:2;4032:9;4025:17;4018:25;4010:6;4003:41;4091:2;4087;4083:11;4077:18;4057:38;;4132:2;4127;4119:6;4115:15;4108:27;4170:12;4164:19;4220:8;4215:2;4207:6;4203:15;4196:33;4242:84;4317:8;4312:2;4304:6;4300:15;4295:2;4281:12;4277:21;4242:84;:::i;:::-;4392:2;4369:17;-1:-1:-1;;4365:31:1;4353:44;;;;4399:2;4349:53;;-1:-1:-1;4437:2:1;4460:12;;;;4425:15;;;;;3878:1;3871:9;3842:640;;;-1:-1:-1;4499:6:1;;3248:1263;-1:-1:-1;;;;;;;3248:1263:1:o"}}}}},"errors":[{"component":"general","formattedMessage":"Support for EVM versions older than constantinople is deprecated and will be removed in the future.","message":"Support for EVM versions older than constantinople is deprecated and will be removed in the future.","severity":"warning","type":"Warning"}],"sources":{"multicall.sol":{"id":0}}} 3 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@ethers-ext/provider-multicall", 3 | "version": "6.0.0-beta.2", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "@ethers-ext/provider-multicall", 9 | "version": "6.0.0-beta.2", 10 | "funding": [ 11 | { 12 | "type": "individual", 13 | "url": "https://github.com/sponsors/ethers-io" 14 | } 15 | ], 16 | "license": "MIT", 17 | "dependencies": { 18 | "ethers": "^6.13.4" 19 | }, 20 | "devDependencies": { 21 | "solc": "0.8.28", 22 | "typescript": "^5.0.0" 23 | } 24 | }, 25 | "node_modules/@adraffy/ens-normalize": { 26 | "version": "1.10.1", 27 | "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz", 28 | "integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==", 29 | "license": "MIT" 30 | }, 31 | "node_modules/@noble/curves": { 32 | "version": "1.2.0", 33 | "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", 34 | "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", 35 | "license": "MIT", 36 | "dependencies": { 37 | "@noble/hashes": "1.3.2" 38 | }, 39 | "funding": { 40 | "url": "https://paulmillr.com/funding/" 41 | } 42 | }, 43 | "node_modules/@noble/hashes": { 44 | "version": "1.3.2", 45 | "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", 46 | "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", 47 | "license": "MIT", 48 | "engines": { 49 | "node": ">= 16" 50 | }, 51 | "funding": { 52 | "url": "https://paulmillr.com/funding/" 53 | } 54 | }, 55 | "node_modules/@types/node": { 56 | "version": "22.7.5", 57 | "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.5.tgz", 58 | "integrity": "sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==", 59 | "license": "MIT", 60 | "dependencies": { 61 | "undici-types": "~6.19.2" 62 | } 63 | }, 64 | "node_modules/aes-js": { 65 | "version": "4.0.0-beta.5", 66 | "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", 67 | "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==", 68 | "license": "MIT" 69 | }, 70 | "node_modules/command-exists": { 71 | "version": "1.2.9", 72 | "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz", 73 | "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==", 74 | "dev": true, 75 | "license": "MIT" 76 | }, 77 | "node_modules/commander": { 78 | "version": "8.3.0", 79 | "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", 80 | "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", 81 | "dev": true, 82 | "license": "MIT", 83 | "engines": { 84 | "node": ">= 12" 85 | } 86 | }, 87 | "node_modules/ethers": { 88 | "version": "6.13.4", 89 | "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.13.4.tgz", 90 | "integrity": "sha512-21YtnZVg4/zKkCQPjrDj38B1r4nQvTZLopUGMLQ1ePU2zV/joCfDC3t3iKQjWRzjjjbzR+mdAIoikeBRNkdllA==", 91 | "funding": [ 92 | { 93 | "type": "individual", 94 | "url": "https://github.com/sponsors/ethers-io/" 95 | }, 96 | { 97 | "type": "individual", 98 | "url": "https://www.buymeacoffee.com/ricmoo" 99 | } 100 | ], 101 | "license": "MIT", 102 | "dependencies": { 103 | "@adraffy/ens-normalize": "1.10.1", 104 | "@noble/curves": "1.2.0", 105 | "@noble/hashes": "1.3.2", 106 | "@types/node": "22.7.5", 107 | "aes-js": "4.0.0-beta.5", 108 | "tslib": "2.7.0", 109 | "ws": "8.17.1" 110 | }, 111 | "engines": { 112 | "node": ">=14.0.0" 113 | } 114 | }, 115 | "node_modules/follow-redirects": { 116 | "version": "1.15.9", 117 | "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", 118 | "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", 119 | "dev": true, 120 | "funding": [ 121 | { 122 | "type": "individual", 123 | "url": "https://github.com/sponsors/RubenVerborgh" 124 | } 125 | ], 126 | "license": "MIT", 127 | "engines": { 128 | "node": ">=4.0" 129 | }, 130 | "peerDependenciesMeta": { 131 | "debug": { 132 | "optional": true 133 | } 134 | } 135 | }, 136 | "node_modules/js-sha3": { 137 | "version": "0.8.0", 138 | "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", 139 | "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==", 140 | "dev": true, 141 | "license": "MIT" 142 | }, 143 | "node_modules/memorystream": { 144 | "version": "0.3.1", 145 | "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", 146 | "integrity": "sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==", 147 | "dev": true, 148 | "engines": { 149 | "node": ">= 0.10.0" 150 | } 151 | }, 152 | "node_modules/os-tmpdir": { 153 | "version": "1.0.2", 154 | "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", 155 | "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", 156 | "dev": true, 157 | "license": "MIT", 158 | "engines": { 159 | "node": ">=0.10.0" 160 | } 161 | }, 162 | "node_modules/semver": { 163 | "version": "5.7.2", 164 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", 165 | "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", 166 | "dev": true, 167 | "license": "ISC", 168 | "bin": { 169 | "semver": "bin/semver" 170 | } 171 | }, 172 | "node_modules/solc": { 173 | "version": "0.8.28", 174 | "resolved": "https://registry.npmjs.org/solc/-/solc-0.8.28.tgz", 175 | "integrity": "sha512-AFCiJ+b4RosyyNhnfdVH4ZR1+TxiL91iluPjw0EJslIu4LXGM9NYqi2z5y8TqochC4tcH9QsHfwWhOIC9jPDKA==", 176 | "dev": true, 177 | "license": "MIT", 178 | "dependencies": { 179 | "command-exists": "^1.2.8", 180 | "commander": "^8.1.0", 181 | "follow-redirects": "^1.12.1", 182 | "js-sha3": "0.8.0", 183 | "memorystream": "^0.3.1", 184 | "semver": "^5.5.0", 185 | "tmp": "0.0.33" 186 | }, 187 | "bin": { 188 | "solcjs": "solc.js" 189 | }, 190 | "engines": { 191 | "node": ">=10.0.0" 192 | } 193 | }, 194 | "node_modules/tmp": { 195 | "version": "0.0.33", 196 | "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", 197 | "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", 198 | "dev": true, 199 | "license": "MIT", 200 | "dependencies": { 201 | "os-tmpdir": "~1.0.2" 202 | }, 203 | "engines": { 204 | "node": ">=0.6.0" 205 | } 206 | }, 207 | "node_modules/tslib": { 208 | "version": "2.7.0", 209 | "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", 210 | "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==", 211 | "license": "0BSD" 212 | }, 213 | "node_modules/typescript": { 214 | "version": "5.7.2", 215 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", 216 | "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", 217 | "dev": true, 218 | "license": "Apache-2.0", 219 | "bin": { 220 | "tsc": "bin/tsc", 221 | "tsserver": "bin/tsserver" 222 | }, 223 | "engines": { 224 | "node": ">=14.17" 225 | } 226 | }, 227 | "node_modules/undici-types": { 228 | "version": "6.19.8", 229 | "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", 230 | "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", 231 | "license": "MIT" 232 | }, 233 | "node_modules/ws": { 234 | "version": "8.17.1", 235 | "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", 236 | "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", 237 | "license": "MIT", 238 | "engines": { 239 | "node": ">=10.0.0" 240 | }, 241 | "peerDependencies": { 242 | "bufferutil": "^4.0.1", 243 | "utf-8-validate": ">=5.0.2" 244 | }, 245 | "peerDependenciesMeta": { 246 | "bufferutil": { 247 | "optional": true 248 | }, 249 | "utf-8-validate": { 250 | "optional": true 251 | } 252 | } 253 | } 254 | } 255 | } 256 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@ethers-ext/provider-multicall", 3 | "version": "6.0.0-beta.3", 4 | "description": "Ethers extension for a simple multicall-based Provider to batch calls.", 5 | "dependencies": { 6 | "ethers": "^6.13.4" 7 | }, 8 | "devDependencies": { 9 | "solc": "0.8.28", 10 | "typescript": "^5.0.0" 11 | }, 12 | "exports": { 13 | ".": { 14 | "import": "./lib.esm/index.js", 15 | "default": "./lib.commonjs/index.js" 16 | } 17 | }, 18 | "ethereum": "donations.ethers.eth", 19 | "funding": [ 20 | { 21 | "type": "individual", 22 | "url": "https://github.com/sponsors/ethers-io" 23 | } 24 | ], 25 | "scripts": { 26 | "auto-build": "npm run build -- -w", 27 | "build-solc": "solcjs --standard-json --base-path . < solc-config.json > misc/output/result.json && node lib.esm/_build.js", 28 | "build": "tsc --build ./tsconfig.esm.json", 29 | "build-all": "npm run build && npm run build-commonjs", 30 | "build-clean": "npm run clean && npm run build-all", 31 | "build-commonjs": "tsc --build ./tsconfig.commonjs.json", 32 | "clean": "rm -rf lib.commonjs lib.esm && cp -r misc/basedirs/* .", 33 | "test": "echo \"Error: no test specified\" && exit 1" 34 | }, 35 | "main": "./lib.commonjs/index.js", 36 | "module": "./lib.esm/index.js", 37 | "publishConfig": { 38 | "access": "public" 39 | }, 40 | "sideEffects": false, 41 | "keywords": [], 42 | "repository": { 43 | "type": "git", 44 | "url": "git://github.com/ethers-io/ext-provider-multicall.git" 45 | }, 46 | "bugs": { 47 | "url": "http://github.com/ethers-io/ext-provider-multicall/issues", 48 | "email": "github@ricmoo.com" 49 | }, 50 | "author": "Richard Moore ", 51 | "license": "MIT" 52 | } 53 | -------------------------------------------------------------------------------- /solc-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "Solidity", 3 | "sources": { 4 | "multicall.sol": { 5 | "urls": ["contracts/multicall.sol"] 6 | } 7 | }, 8 | "settings": { 9 | "optimizer": { 10 | "enabled": true, 11 | "runs": 1 12 | }, 13 | "evmVersion": "byzantium", 14 | "outputSelection": { 15 | "*": { 16 | "*": ["abi", "evm.bytecode"] 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src.ts/_build.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This creates an importable version of the multicall bytecode and 3 | * ABI for use in otther parts of the library. 4 | * 5 | * Build command: npm run build-solc 6 | * Output: src.ts/_contract.ts 7 | */ 8 | 9 | import fs from "fs"; 10 | 11 | import { encodeBase64, getBytes, Interface } from "ethers"; 12 | 13 | function stripErrors(lines: string) { 14 | const output: Array = [ ]; 15 | for (const line of lines.split(/\n/g)) { 16 | if (line.startsWith(">>>")) { continue; } 17 | output.push(line); 18 | } 19 | return output.join("\n"); 20 | } 21 | 22 | const _result = fs.readFileSync("./misc/output/result.json").toString(); 23 | const result = JSON.parse(stripErrors(_result)); 24 | const abi = result.contracts["multicall.sol"].Multicall.abi; 25 | const iface = new Interface(abi); 26 | const bin = getBytes("0x" + result.contracts["multicall.sol"].Multicall.evm.bytecode.object); 27 | 28 | const output = [ ]; 29 | output.push(`/* Do NOT modify this file; it is generated by _build.ts. */`); 30 | output.push(`/* Any changes will be clobbered on the next build. */`); 31 | output.push(`import { decodeBase64, hexlify } from "ethers";`); 32 | output.push(`export const bin = hexlify(decodeBase64("${ encodeBase64(bin) }"));`); 33 | output.push(`export const abi = [`); 34 | for (let fragment of iface.format()) { 35 | if (fragment.match(/constructor/)) { 36 | fragment = fragment.replace(/ nonpayable/, ""); 37 | } 38 | output.push(` ${ JSON.stringify(fragment) },`); 39 | } 40 | output.push(`];`); 41 | 42 | 43 | fs.writeFileSync("./src.ts/_contract.ts", output.join("\n")); 44 | -------------------------------------------------------------------------------- /src.ts/_contract.ts: -------------------------------------------------------------------------------- 1 | /* Do NOT modify this file; it is generated by _build.ts. */ 2 | /* Any changes will be clobbered on the next build. */ 3 | import { decodeBase64, hexlify } from "ethers"; 4 | export const bin = hexlify(decodeBase64("YIBgQFI0gBVhABBXYACA/VtQYEBRYQSxOAOAYQSxgzmBAWBAgZBSYQAvkWECWlZbYACBUWABYEBgAgoDgREVYQBKV2EASmEBr1ZbYEBRkICCUoBgIAJgIAGCAWBAUoAVYQCQV4FgIAFbYECAUYCCAZCRUmAAgVJgYGAgggFSgVJgIAGQYAGQA5CBYQBoV5BQW1CQUGAAW4JRgRAVYQE/V2EA8oOCgVGBEGEAtFdhALRhA+NWW2AgAmAgAQFRYAABUYSDgVGBEGEA0ldhANJhA+NWW2AgAmAgAQFRYCABUWEBbmQBAAAAAAJkAQAAAACQBFZbg4OBUYEQYQEEV2EBBGED41ZbYCACYCABAVFgAAGEhIFRgRBhASFXYQEhYQPjVltgIJCBApGQkQGBAVEBkZCRUpAVFZBSYAEBYQCWVltQYABDgmBAUWAgAWEBVZKRkGEEElZbYEBRYCCBgwMDgVKQYEBSkFCAUWAgggHzW2AAYGBgQFGQUGAAgVJgIIEBYEBSYACAhFFgIIYBh1r6YD89AWAfGRaCAWBAUj2CUpFQPWAAYCCDAT6SUJKQUFZbf05Ie3EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYABSYEFgBFJgJGAA/VtgQIBRkIEBYAFgQGACCgOBEYKCEBcVYQIAV2ECAGEBr1ZbYEBSkFZbYEBRYB+CAWAfGRaBAWABYEBgAgoDgRGCghAXFWECLldhAi5hAa9WW2BAUpGQUFZbYABbg4EQFWECUVeBgQFRg4IBUmAgAWECOVZbUFBgAJEBUlZbYABgIIKEAxIVYQJsV2AAgP1bgVFgAWBAYAIKA4ERFWECgldgAID9W4IBYB+BAYQTYQKTV2AAgP1bgFFgAWBAYAIKA4ERFWECrFdhAqxhAa9WW2AggQJhArxgIIIBYQIGVluRglJgIIGEAYEBkpCBAZCHhBEVYQLYV2AAgP1bYCCFAZJQW4ODEBVhA9hXglFgAWBAYAIKA4ERFWEC/VdgAID9W4UBYECBigNgHxkBEhVhAxNXYACA/VthAxthAd5WW2AgggFRYAFgoGACCgOBFoEUYQM1V2AAgP1bgVJgQIIBUWABYEBgAgoDgREVYQNQV2AAgP1bYCCBhAEBklBQiWAfgwESYQNoV2AAgP1bgVFgAWBAYAIKA4ERFWEDgVdhA4FhAa9WW2EDlGAfggFgHxkWYCABYQIGVluBgVKLYCCDhgEBERVhA6lXYACA/VthA7qCYCCDAWAghwFhAjZWW4BgIIQBUlBQgIRSUFBgIIIBkVBgIIMBklBhAt9WW5eWUFBQUFBQUFZbf05Ie3EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYABSYDJgBFJgJGAA/VtgAGBAggGEg1JgQGAghAFSgIRRgINSYGCFAZFQYGBgIIIChgEBklBgIIYBYABbgoEQFWEEo1dgXxmHhgMBhFKBUYBRFRWGUmAggQFRkFBgQGAghwFSgFGAYECIAVJhBICBYGCJAWAghQFhAjZWW2AfAWAfGRaVkJUBYGABlFBgIJOEAZORkJEBkGABAWEEQFZbUJKXllBQUFBQUFBW/g==")); 5 | export const abi = [ 6 | "constructor((address target, bytes data)[] calls)", 7 | ]; -------------------------------------------------------------------------------- /src.ts/index.ts: -------------------------------------------------------------------------------- 1 | 2 | export { MulticallProvider } from "./provider-multicall.js"; 3 | 4 | export type { CallResult } from "./provider-multicall.js"; 5 | -------------------------------------------------------------------------------- /src.ts/multicall.ts: -------------------------------------------------------------------------------- 1 | // @TODO: expose a nice API for the encode/decode directly 2 | 3 | import { AbiCoder, concat } from "ethers"; 4 | 5 | import { bin } from "./_contract.js"; 6 | 7 | import type { Result } from "ethers"; 8 | 9 | export function encodeCall(calls: Array<{ to: string, data: string }>): string { 10 | return concat([ bin, AbiCoder.defaultAbiCoder().encode([ 11 | "tuple(address to, bytes data)[]" 12 | ], [ calls ])]); 13 | } 14 | 15 | export function decodeResult(data: string): Result { 16 | throw new Error("not implemented"); 17 | } 18 | -------------------------------------------------------------------------------- /src.ts/multicaller.ts: -------------------------------------------------------------------------------- 1 | import { AbiCoder, concat, Result } from "ethers"; 2 | 3 | import { bin } from "./_contract.js"; 4 | 5 | import type { Provider } from "ethers"; 6 | 7 | 8 | export interface Call { 9 | target: string; 10 | data: string; 11 | } 12 | 13 | export interface CallResult { 14 | status: boolean; 15 | data: string; 16 | } 17 | 18 | 19 | // DeferredCall? 20 | export interface PreparedCall { 21 | resolve: () => Promise; 22 | decode: (status: boolean, data: string) => Result; 23 | } 24 | 25 | 26 | export class Multicaller { 27 | readonly provider: Provider; 28 | 29 | constructor(provider: Provider) { 30 | this.provider = provider; 31 | } 32 | 33 | async _multicall(calls: Array): Promise> { 34 | const data = concat([ bin, AbiCoder.defaultAbiCoder().encode([ 35 | "tuple(address target, bytes data)[]" 36 | ], [ calls ])]); 37 | 38 | const resultData = await this.provider.call({ data }); 39 | 40 | const [ blockNumber, results ] = AbiCoder.defaultAbiCoder().decode([ 41 | "uint blockNumber", "tuple(bool status, bytes data)[] results" 42 | ], resultData); 43 | 44 | if (blockNumber) { } // @TODO: check block number 45 | 46 | return results.map((result: any) => ({ status: result[0], data: result[1] })); 47 | } 48 | 49 | async multicall(_calls: Array): Promise> { 50 | const calls = await Promise.all(_calls.map((call) => call.resolve())); 51 | 52 | const results = await this._multicall(calls); 53 | 54 | return Result.fromItems(results.map(({ status, data }, index) => { 55 | try { 56 | return _calls[index].decode(status, data); 57 | } catch (error) { 58 | return error; 59 | } 60 | })); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src.ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /src.ts/provider-multicall.ts: -------------------------------------------------------------------------------- 1 | import { 2 | AbiCoder, AbstractProvider, toQuantity, 3 | assertArgument, concat, makeError 4 | } from "ethers"; 5 | 6 | import type { 7 | PerformActionRequest, 8 | // PerformActionTransaction, 9 | BlockTag 10 | } from "ethers"; 11 | 12 | import { bin } from "./_contract.js"; 13 | 14 | export type DebugEventMulticallProvider = { 15 | action: "sendMulticall", 16 | calls: Array<{ to: string, data: string }>; 17 | data: string; 18 | } | { 19 | action: "receiveMulticallResult", 20 | calls: Array<{ to: string, data: string }>; 21 | data: string; 22 | status: boolean; 23 | result: string; 24 | }; 25 | 26 | export type CallResult = { status: boolean, data: string }; 27 | 28 | interface CallHandle { 29 | request: { to: string, data: string, blockTag?: BlockTag }; 30 | resolve: (result: any) => void; 31 | reject: (error: any) => void; 32 | } 33 | 34 | export class MulticallProvider extends AbstractProvider { 35 | readonly subprovider: AbstractProvider; 36 | 37 | #callQueue: Array; 38 | #drainInterval: number; 39 | #drainTimer: null | ReturnType; 40 | 41 | constructor(provider: AbstractProvider) { 42 | super(); 43 | this.subprovider = provider; 44 | 45 | this.#callQueue = [ ]; 46 | this.#drainInterval = 10; 47 | this.#drainTimer = null; 48 | } 49 | 50 | get drainInterval(): number { return this.#drainInterval; } 51 | set drainInterval(value: number) { 52 | if (value < 0) { value = -1; } 53 | if (value === this.#drainInterval) { return; } 54 | 55 | this.#drainInterval = value; 56 | 57 | if (this.#drainInterval >= 0) { 58 | // Clear any existing timer 59 | if (this.#drainTimer) { 60 | clearTimeout(this.#drainTimer); 61 | this.#drainTimer = null; 62 | } 63 | 64 | // Start a new one with the updated interval 65 | if (this.#callQueue.length) { 66 | this.#drainTimer = setTimeout(() => { 67 | this.drainCallQueue() 68 | }, this.#drainInterval); 69 | } 70 | 71 | } else if (this.#drainTimer) { 72 | // Disable any existing timer; switching to manual mode 73 | clearTimeout(this.#drainTimer); 74 | this.#drainTimer = null; 75 | } 76 | }; 77 | 78 | queueCall(to: string, data: string, blockTag?: BlockTag): Promise { 79 | if (this.#drainTimer == null && this.#drainInterval >= 0) { 80 | this.#drainTimer = setTimeout(() => { 81 | this.drainCallQueue(); 82 | }, this.#drainInterval); 83 | } 84 | 85 | return new Promise((resolve, reject) => { 86 | this.#callQueue.push({ request: { to, data, blockTag }, resolve, reject }); 87 | }); 88 | } 89 | 90 | async drainCallQueue(): Promise { 91 | this.#drainTimer = null; 92 | 93 | const _callQueue = this.#callQueue; 94 | this.#callQueue = [ ]; 95 | 96 | const blockTags = _callQueue.reduce((accum, { request }) => { 97 | const blockTag = request.blockTag; 98 | if (blockTag != null && accum.indexOf(blockTag) === -1) { 99 | accum.push(blockTag); 100 | } 101 | return accum; 102 | }, >[ ]); 103 | 104 | const runners: Array> = [ ]; 105 | 106 | for (const blockTag of blockTags) { 107 | const callQueue = _callQueue.filter(({ request }) => request.blockTag === blockTag); 108 | 109 | const data = concat([ bin, AbiCoder.defaultAbiCoder().encode([ 110 | "tuple(address, bytes)[]" 111 | ], [ 112 | callQueue.map(({ request }) => { 113 | return [ request.to, request.data ]; 114 | }) 115 | ])]); 116 | 117 | this.emit("debug", { 118 | action: "sendMulticall", data, 119 | call: callQueue.map(({ request }) => { 120 | return { to: request.to, data: request.data }; 121 | }) 122 | }); 123 | 124 | runners.push((async () => { 125 | 126 | const _data = await this.subprovider.call({ data, blockTag }); 127 | 128 | const [ _blockNumber, results ] = AbiCoder.defaultAbiCoder().decode([ "uint", "tuple(bool, bytes)[]"], _data); 129 | const blockNumber = toQuantity(_blockNumber); 130 | 131 | if (blockTag !== "latest" && blockTag !== "pending" && blockNumber !== blockTag) { 132 | callQueue.forEach(({ reject }) => { 133 | reject(makeError("backend does not support archive access", "UNSUPPORTED_OPERATION", { 134 | operation: "call(blockTag)", 135 | info: { expectedBlockTag: blockTag, blockNumber } 136 | })); 137 | }); 138 | } 139 | 140 | this.emit("debug", { 141 | action: "receiveMulticallResult", data, 142 | call: callQueue.map(({ request }, i) => { 143 | return { 144 | to: request.to, data: request.data, 145 | status: results[i][0], result: results[i][1] 146 | }; 147 | }) 148 | }); 149 | 150 | const output: Array = [ ]; 151 | for (let i = 0; i < callQueue.length; i++) { 152 | const result = results[i]; 153 | const { resolve } = callQueue[i]; 154 | resolve({ status: result[0], data: result[1] }); 155 | output.push({ status: result[0], data: result[1] }); 156 | } 157 | })()); 158 | } 159 | 160 | await Promise.all(runners); 161 | } 162 | 163 | _detectNetwork() { 164 | return this.subprovider._detectNetwork(); 165 | } 166 | 167 | async _perform(req: PerformActionRequest): Promise { 168 | if (req.method === "call") { 169 | const tx = req.transaction; 170 | const to = (tx.to || null), data = (tx.data || "0x"); 171 | assertArgument(typeof(to) === "string", "deployment transactions unsupported", "tx.to", tx.to); 172 | 173 | const result = await this.queueCall(to, data, req.blockTag); 174 | if (result.status) { return result.data; } 175 | 176 | // Throw a CallException 177 | throw AbiCoder.getBuiltinCallException("call", { to, data }, result.data); 178 | } 179 | 180 | return await this.subprovider._perform(req); 181 | } 182 | 183 | } 184 | 185 | -------------------------------------------------------------------------------- /src.ts/test.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from "ethers"; 2 | 3 | import { MulticallProvider } from "./provider-multicall.js"; 4 | /* 5 | import { bin, abi } from "./_contract.js"; 6 | (async function() { 7 | const provider = new ethers.InfuraProvider(); 8 | 9 | const contract = new ethers.Contract("dai.tokens.ethers.eth", [ 10 | "function name() view returns (string)", 11 | "function symbol() view returns (string)", 12 | ], provider); 13 | 14 | const calls = await Promise.all([ 15 | contract.name.populateTransaction(), 16 | contract.symbol.populateTransaction(), 17 | ]); 18 | console.log("CALLS", calls); 19 | 20 | const iface = new ethers.Interface(abi); 21 | console.log(iface.deploy); 22 | const args = calls.map((c) => { 23 | //(address, bool, bytes) 24 | return [ c.to, false, c.data ]; 25 | }); 26 | console.log("ARGS", args); 27 | const data = ethers.concat([ 28 | bin, 29 | iface.encodeDeploy([ args ]) 30 | ]); 31 | console.log("DATA", data); 32 | 33 | let result = await provider.call({ data }); 34 | // result = ethers.concat([ 35 | // "0x0000000000000000000000000000000000000000000000000000000000000020", 36 | // result 37 | // ]); 38 | 39 | console.log("RESULT", result); 40 | console.log(iface.getFunction("aggregate3Value")); 41 | console.log(iface.decodeFunctionResult("aggregate3Value", result)); 42 | })(); 43 | */ 44 | 45 | (async function() { 46 | const subprovider = new ethers.InfuraProvider(); 47 | //const subprovider = new ethers.ChainstackProvider(); 48 | //const subprovider = new ethers.QuickNodeProvider(); 49 | /* 50 | subprovider.on("debug", (req) => { 51 | console.log("SUB"); 52 | console.dir(req, { depth: null }); 53 | }); 54 | */ 55 | 56 | const provider = new MulticallProvider(subprovider); 57 | 58 | const contract = new ethers.Contract("dai.tokens.ethers.eth", [ 59 | "function name() view returns (string)", 60 | "function symbol() view returns (string)", 61 | "function balanceOf(address) view returns (uint256)", 62 | "function balanceOf(address) view returns (uint256)", 63 | ], provider); 64 | /* 65 | provider.on("debug", (req) => { 66 | console.log("MULTI"); 67 | console.dir(req, { depth: null }); 68 | }); 69 | */ 70 | const blockNumber = await provider.getBlockNumber(); 71 | const ricmooEth = "0x5555763613a12d8f3e73be831dff8598089d3dca"; 72 | 73 | const [ name, sym, balance, balance_1 ] = await Promise.all([ 74 | contract.name({ blockTag: "latest" }), 75 | contract.symbol({ blockTag: "latest" }), 76 | contract.balanceOf(ricmooEth, { blockTag: "latest" }), 77 | contract.balanceOf(ricmooEth, { blockTag: blockNumber - 1 }), 78 | ]); 79 | 80 | console.log({ name, sym, balance, balance_1 }); 81 | })(); 82 | -------------------------------------------------------------------------------- /tsconfig.base.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "declarationMap": true, 5 | "esModuleInterop": true, 6 | "forceConsistentCasingInFileNames": true, 7 | "lib": [ 8 | "es2015", 9 | "es5", 10 | "dom" 11 | ], 12 | "module": "es6", 13 | "noEmitOnError": true, 14 | "noFallthroughCasesInSwitch": true, 15 | "noImplicitAny": true, 16 | "noImplicitReturns": true, 17 | "noUnusedLocals": true, 18 | "preserveSymlinks": true, 19 | "preserveWatchOutput": true, 20 | "pretty": false, 21 | "rootDir": "./src.ts", 22 | "sourceMap": true, 23 | "strict": true, 24 | "target": "es2016" 25 | }, 26 | "include": [ 27 | "./src.ts/**/*.ts" 28 | ], 29 | "exclude": [ ] 30 | } 31 | -------------------------------------------------------------------------------- /tsconfig.commonjs.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.base.json", 3 | "compilerOptions": { 4 | "module": "commonjs", 5 | "outDir": "./lib.commonjs" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tsconfig.esm.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.base.json", 3 | "compilerOptions": { 4 | "moduleResolution": "node16", 5 | "module": "node16", 6 | "outDir": "./lib.esm" 7 | } 8 | } 9 | --------------------------------------------------------------------------------