@1inch/solidity-utils 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -208
- package/contracts/interfaces/ICreate3Deployer.sol +16 -0
- package/contracts/interfaces/IDaiLikePermit.sol +13 -0
- package/contracts/interfaces/IERC20MetadataUppercase.sol +12 -0
- package/contracts/interfaces/IPermit2.sol +45 -12
- package/contracts/interfaces/IWETH.sol +17 -0
- package/contracts/libraries/AddressArray.sol +73 -25
- package/contracts/libraries/AddressLib.sol +2 -1
- package/contracts/libraries/AddressSet.sol +52 -14
- package/contracts/libraries/BytesMemory.sol +2 -1
- package/contracts/libraries/BytesStorage.sol +2 -1
- package/contracts/libraries/ECDSA.sol +111 -0
- package/contracts/libraries/RevertReasonForwarder.sol +13 -3
- package/contracts/libraries/RevertReasonParser.sol +11 -2
- package/contracts/libraries/StringUtil.sol +21 -3
- package/contracts/libraries/UniERC20.sol +57 -12
- package/contracts/mocks/ERC20PermitMock.sol +12 -0
- package/contracts/mocks/SelfdestructEthSenderMock.sol +17 -0
- package/contracts/mocks/TokenCustomDecimalsMock.sol +25 -4
- package/contracts/mocks/TokenMock.sol +19 -0
- package/dist/hardhat-setup/networks.d.ts +23 -0
- package/dist/hardhat-setup/networks.js +22 -0
- package/dist/hardhat-setup/networks.js.map +1 -1
- package/dist/src/expect.d.ts +12 -0
- package/dist/src/expect.js +12 -0
- package/dist/src/expect.js.map +1 -1
- package/dist/src/permit.d.ts +117 -0
- package/dist/src/permit.js +112 -7
- package/dist/src/permit.js.map +1 -1
- package/dist/src/prelude.d.ts +6 -0
- package/dist/src/prelude.js +6 -0
- package/dist/src/prelude.js.map +1 -1
- package/dist/src/profileEVM.d.ts +26 -0
- package/dist/src/profileEVM.js +30 -3
- package/dist/src/profileEVM.js.map +1 -1
- package/dist/src/utils.d.ts +79 -0
- package/dist/src/utils.js +92 -1
- package/dist/src/utils.js.map +1 -1
- package/dist/typechain-types/contracts/mixins/SelfdestructEthSender.d.ts +29 -0
- package/dist/typechain-types/contracts/mixins/SelfdestructEthSender.js +3 -0
- package/dist/typechain-types/contracts/mixins/SelfdestructEthSender.js.map +1 -0
- package/dist/typechain-types/contracts/mixins/index.d.ts +1 -0
- package/dist/typechain-types/contracts/mocks/SelfdestructEthSenderMock.d.ts +37 -0
- package/dist/typechain-types/contracts/mocks/SelfdestructEthSenderMock.js +3 -0
- package/dist/typechain-types/contracts/mocks/SelfdestructEthSenderMock.js.map +1 -0
- package/dist/typechain-types/contracts/mocks/TokenCustomDecimalsMock.d.ts +1 -5
- package/dist/typechain-types/contracts/mocks/index.d.ts +1 -0
- package/dist/typechain-types/factories/@openzeppelin/contracts/utils/Address__factory.d.ts +1 -1
- package/dist/typechain-types/factories/@openzeppelin/contracts/utils/Address__factory.js +1 -1
- package/dist/typechain-types/factories/@openzeppelin/contracts/utils/ShortStrings__factory.d.ts +1 -1
- package/dist/typechain-types/factories/@openzeppelin/contracts/utils/ShortStrings__factory.js +1 -1
- package/dist/typechain-types/factories/@openzeppelin/contracts/utils/Strings__factory.d.ts +1 -1
- package/dist/typechain-types/factories/@openzeppelin/contracts/utils/Strings__factory.js +1 -1
- package/dist/typechain-types/factories/@openzeppelin/contracts/utils/cryptography/ECDSA__factory.d.ts +1 -1
- package/dist/typechain-types/factories/@openzeppelin/contracts/utils/cryptography/ECDSA__factory.js +1 -1
- package/dist/typechain-types/factories/@openzeppelin/contracts/utils/math/Math__factory.d.ts +1 -1
- package/dist/typechain-types/factories/@openzeppelin/contracts/utils/math/Math__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/libraries/AddressArray__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/libraries/AddressArray__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/libraries/BySigTraits__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/libraries/BySigTraits__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/libraries/BytesMemory__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/libraries/BytesMemory__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/libraries/BytesStorage__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/libraries/BytesStorage__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/libraries/RevertReasonParser__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/libraries/RevertReasonParser__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/libraries/SafeERC20__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/libraries/SafeERC20__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/libraries/UniERC20__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/libraries/UniERC20__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/mixins/SelfdestructEthSender__factory.d.ts +17 -0
- package/dist/typechain-types/factories/contracts/mixins/SelfdestructEthSender__factory.js +33 -0
- package/dist/typechain-types/factories/contracts/mixins/SelfdestructEthSender__factory.js.map +1 -0
- package/dist/typechain-types/factories/contracts/mixins/index.d.ts +1 -0
- package/dist/typechain-types/factories/contracts/mixins/index.js +3 -1
- package/dist/typechain-types/factories/contracts/mixins/index.js.map +1 -1
- package/dist/typechain-types/factories/contracts/mocks/ERC20PermitMock__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/mocks/ERC20PermitMock__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/mocks/ERC20PermitMock__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/mocks/SelfdestructEthSenderMock__factory.d.ts +49 -0
- package/dist/typechain-types/factories/contracts/mocks/SelfdestructEthSenderMock__factory.js +75 -0
- package/dist/typechain-types/factories/contracts/mocks/SelfdestructEthSenderMock__factory.js.map +1 -0
- package/dist/typechain-types/factories/contracts/mocks/TokenCustomDecimalsMock__factory.d.ts +1 -11
- package/dist/typechain-types/factories/contracts/mocks/TokenCustomDecimalsMock__factory.js +1 -14
- package/dist/typechain-types/factories/contracts/mocks/TokenCustomDecimalsMock__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/mocks/TokenMock__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/mocks/TokenMock__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/mocks/TokenMock__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/mocks/index.d.ts +1 -0
- package/dist/typechain-types/factories/contracts/mocks/index.js +3 -1
- package/dist/typechain-types/factories/contracts/mocks/index.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/ECDSATest__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/ECDSATest__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/ECDSATest__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/RevertReasonParserTest__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/RevertReasonParserTest__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/RevertReasonParserTest__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/StringUtilTest__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/StringUtilTest__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/StringUtilTest__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/AddressArrayMock__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/AddressArrayMock__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/AddressArrayMock__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/AddressLibMock__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/AddressLibMock__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/AddressLibMock__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/AddressSetMock__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/AddressSetMock__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/AddressSetMock__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/BySigTraitsMock__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/BySigTraitsMock__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/BySigTraitsMock__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/BytesMemoryMock__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/BytesMemoryMock__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/BytesMemoryMock__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/BytesStorageMock__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/BytesStorageMock__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/BytesStorageMock__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/DaiLikePermitMock__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/DaiLikePermitMock__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/DaiLikePermitMock__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/ERC1271WalletMock__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/ERC1271WalletMock__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/ERC1271WalletMock__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/EthReceiverMock__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/EthReceiverMock__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/EthSenderMock__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/EthSenderMock__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/EthSenderMock__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/PermitAndCallMock__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/PermitAndCallMock__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/PermitAndCallMock__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/PermitableMock__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/PermitableMock__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/PermitableMock__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20NoReturnMock__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20NoReturnMock__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20NoReturnMock__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20PermitNoRevertMock__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20PermitNoRevertMock__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20PermitNoRevertMock__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20ReturnFalseMock__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20ReturnFalseMock__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20ReturnFalseMock__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20ReturnTrueMock__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20ReturnTrueMock__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20ReturnTrueMock__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20ThroughZeroApprove__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20ThroughZeroApprove__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20ThroughZeroApprove__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20WithSafeBalance__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20WithSafeBalance__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20WithSafeBalance__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/Permit2ReturnTrueMock__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/Permit2ReturnTrueMock__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/Permit2ReturnTrueMock__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/SafeERC20Wrapper__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/SafeERC20Wrapper__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/SafeERC20Wrapper__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/SafeWETHWrapper__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/SafeWETHWrapper__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/SafeWETHWrapper__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/TokenWithBySig__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/TokenWithBySig__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/TokenWithBySig__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/USDCLikePermitMock__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/USDCLikePermitMock__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/USDCLikePermitMock__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/ERC20Capitals__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/ERC20Capitals__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/ERC20Capitals__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/ERC20bytes32Capitals__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/ERC20bytes32Capitals__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/ERC20bytes32Capitals__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/ERC20bytes32__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/ERC20bytes32__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/ERC20bytes32__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/ETHBadReceiver__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/ETHBadReceiver__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/ETHBadReceiver__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/UniERC20Wrapper__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/UniERC20Wrapper__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/UniERC20Wrapper__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/WETH__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/WETH__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/WETH__factory.js.map +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/WethReceiverMock__factory.d.ts +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/WethReceiverMock__factory.js +1 -1
- package/dist/typechain-types/factories/contracts/tests/mocks/WethReceiverMock__factory.js.map +1 -1
- package/dist/typechain-types/index.d.ts +4 -0
- package/dist/typechain-types/index.js +6 -2
- package/dist/typechain-types/index.js.map +1 -1
- package/package.json +23 -18
- package/utils/README.md +180 -0
- package/utils/docify.utils.js +3 -3
- package/utils/file-dependencies.js +0 -0
- package/utils/test-docgen.js +0 -0
package/dist/src/profileEVM.d.ts
CHANGED
|
@@ -2,14 +2,40 @@
|
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import { PathLike, promises as fs } from 'fs';
|
|
4
4
|
import { JsonRpcProvider } from 'ethers';
|
|
5
|
+
/**
|
|
6
|
+
* @category profileEVM
|
|
7
|
+
* @dev Default configuration options for the `gasspectEVM` function to analyze gas usage in EVM transactions.
|
|
8
|
+
* @property minOpGasCost The minimal gas cost of operations to be returned in the analysis. Defaults to 300, filtering out less costly operations for clarity.
|
|
9
|
+
* @property args Boolean indicating whether to return the arguments of each operation in the analysis. Defaults to `false`, omitting arguments for simplicity.
|
|
10
|
+
* @property res Boolean indicating whether to return the results of each operation in the analysis. Defaults to `false`, omitting results to focus on gas usage.
|
|
11
|
+
*/
|
|
5
12
|
export declare const gasspectOptionsDefault: {
|
|
6
13
|
minOpGasCost: number;
|
|
7
14
|
args: boolean;
|
|
8
15
|
res: boolean;
|
|
9
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* @category profileEVM
|
|
19
|
+
* @notice Profiles EVM execution by counting occurrences of specified instructions in a transaction's execution trace.
|
|
20
|
+
* @param provider An Ethereum provider capable of sending custom RPC requests.
|
|
21
|
+
* @param txHash The hash of the transaction to profile.
|
|
22
|
+
* @param instruction An array of EVM instructions (opcodes) to count within the transaction's execution trace.
|
|
23
|
+
* @param optionalTraceFile An optional file path or handle where the full transaction trace will be saved.
|
|
24
|
+
* @return An array of numbers representing the counts of each instruction specified, in the order they were provided.
|
|
25
|
+
*/
|
|
10
26
|
export declare function profileEVM(provider: JsonRpcProvider | {
|
|
11
27
|
send: (method: string, params: unknown[]) => Promise<any>;
|
|
12
28
|
}, txHash: string, instruction: string[], optionalTraceFile?: PathLike | fs.FileHandle): Promise<number[]>;
|
|
29
|
+
/**
|
|
30
|
+
* @category profileEVM
|
|
31
|
+
* @notice Performs gas analysis on EVM transactions, highlighting operations that exceed a specified gas cost.
|
|
32
|
+
* Analyzes gas usage by operations within a transaction, applying filters and formatting based on options.
|
|
33
|
+
* @param provider The Ethereum JSON RPC provider or any custom provider with a `send` method.
|
|
34
|
+
* @param txHash Transaction hash to analyze.
|
|
35
|
+
* @param gasspectOptions Analysis configuration, specifying filters and formatting for gas analysis. See `gasspectOptionsDefault` for default values.
|
|
36
|
+
* @param optionalTraceFile Optional path or handle to save the detailed transaction trace.
|
|
37
|
+
* @return A detailed string array of operations meeting the criteria set in `gasspectOptions`.
|
|
38
|
+
*/
|
|
13
39
|
export declare function gasspectEVM(provider: JsonRpcProvider | {
|
|
14
40
|
send: (method: string, params: unknown[]) => Promise<any>;
|
|
15
41
|
}, txHash: string, gasspectOptions?: Record<string, unknown>, optionalTraceFile?: PathLike | fs.FileHandle): Promise<string[]>;
|
package/dist/src/profileEVM.js
CHANGED
|
@@ -2,11 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.gasspectEVM = exports.profileEVM = exports.gasspectOptionsDefault = void 0;
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
|
+
/**
|
|
6
|
+
* @category profileEVM
|
|
7
|
+
* @dev Default configuration options for the `gasspectEVM` function to analyze gas usage in EVM transactions.
|
|
8
|
+
* @property minOpGasCost The minimal gas cost of operations to be returned in the analysis. Defaults to 300, filtering out less costly operations for clarity.
|
|
9
|
+
* @property args Boolean indicating whether to return the arguments of each operation in the analysis. Defaults to `false`, omitting arguments for simplicity.
|
|
10
|
+
* @property res Boolean indicating whether to return the results of each operation in the analysis. Defaults to `false`, omitting results to focus on gas usage.
|
|
11
|
+
*/
|
|
5
12
|
exports.gasspectOptionsDefault = {
|
|
6
|
-
minOpGasCost: 300,
|
|
7
|
-
args: false,
|
|
8
|
-
res: false,
|
|
13
|
+
minOpGasCost: 300,
|
|
14
|
+
args: false,
|
|
15
|
+
res: false,
|
|
9
16
|
};
|
|
17
|
+
/** @internal */
|
|
10
18
|
function _normalizeOp(ops, i) {
|
|
11
19
|
if (ops[i].op === 'STATICCALL') {
|
|
12
20
|
ops[i].gasCost = ops[i].gasCost - ops[i + 1].gas;
|
|
@@ -68,6 +76,15 @@ function _normalizeOp(ops, i) {
|
|
|
68
76
|
ops[i].res = ops[i + 1].stack[ops[i + 1].stack.length - 1];
|
|
69
77
|
}
|
|
70
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* @category profileEVM
|
|
81
|
+
* @notice Profiles EVM execution by counting occurrences of specified instructions in a transaction's execution trace.
|
|
82
|
+
* @param provider An Ethereum provider capable of sending custom RPC requests.
|
|
83
|
+
* @param txHash The hash of the transaction to profile.
|
|
84
|
+
* @param instruction An array of EVM instructions (opcodes) to count within the transaction's execution trace.
|
|
85
|
+
* @param optionalTraceFile An optional file path or handle where the full transaction trace will be saved.
|
|
86
|
+
* @return An array of numbers representing the counts of each instruction specified, in the order they were provided.
|
|
87
|
+
*/
|
|
71
88
|
async function profileEVM(
|
|
72
89
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
73
90
|
provider, txHash, instruction, optionalTraceFile) {
|
|
@@ -81,6 +98,16 @@ provider, txHash, instruction, optionalTraceFile) {
|
|
|
81
98
|
});
|
|
82
99
|
}
|
|
83
100
|
exports.profileEVM = profileEVM;
|
|
101
|
+
/**
|
|
102
|
+
* @category profileEVM
|
|
103
|
+
* @notice Performs gas analysis on EVM transactions, highlighting operations that exceed a specified gas cost.
|
|
104
|
+
* Analyzes gas usage by operations within a transaction, applying filters and formatting based on options.
|
|
105
|
+
* @param provider The Ethereum JSON RPC provider or any custom provider with a `send` method.
|
|
106
|
+
* @param txHash Transaction hash to analyze.
|
|
107
|
+
* @param gasspectOptions Analysis configuration, specifying filters and formatting for gas analysis. See `gasspectOptionsDefault` for default values.
|
|
108
|
+
* @param optionalTraceFile Optional path or handle to save the detailed transaction trace.
|
|
109
|
+
* @return A detailed string array of operations meeting the criteria set in `gasspectOptions`.
|
|
110
|
+
*/
|
|
84
111
|
async function gasspectEVM(
|
|
85
112
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
86
113
|
provider, txHash, gasspectOptions = {}, optionalTraceFile) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileEVM.js","sourceRoot":"","sources":["../../src/profileEVM.ts"],"names":[],"mappings":";;;AAAA,2BAA8C;
|
|
1
|
+
{"version":3,"file":"profileEVM.js","sourceRoot":"","sources":["../../src/profileEVM.ts"],"names":[],"mappings":";;;AAAA,2BAA8C;AAG9C;;;;;;GAMG;AACU,QAAA,sBAAsB,GAAG;IAClC,YAAY,EAAE,GAAG;IACjB,IAAI,EAAE,KAAK;IACX,GAAG,EAAE,KAAK;CACb,CAAC;AAcF,gBAAgB;AAChB,SAAS,YAAY,CAAC,GAAS,EAAE,CAAS;IACtC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,YAAY,EAAE,CAAC;QAC7B,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC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YAC3C,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1B,CAAC;QAED,IAAI,EAAE,CAAC,KAAK,GAAG,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC;YACrC,YAAY,CAAC,GAAG,EAAE,CAAC;QACvB,CAAC;IACL,CAAC;IAED,MAAM,MAAM,GAAG,GAAG;SACb,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC;SACjD,GAAG,CACA,CAAC,EAAE,EAAE,EAAE,CACH,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC;QACzB,GAAG;QACH,EAAE,CAAC,EAAE;QACL,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3D,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACnD,KAAK;QACL,EAAE,CAAC,OAAO,CACjB,CAAC;IAEN,IAAI,iBAAiB,EAAE,CAAC;QACpB,MAAM,aAAE,CAAC,SAAS,CAAC,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IACjE,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AA9CD,kCA8CC"}
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -18,15 +18,62 @@ interface DeployContractOptions {
|
|
|
18
18
|
log?: boolean;
|
|
19
19
|
waitConfirmations?: number;
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* @category utils
|
|
23
|
+
* @notice Deploys a contract with optional Etherscan verification.
|
|
24
|
+
* @param contractName Name of the contract to deploy.
|
|
25
|
+
* @param constructorArgs Arguments for the contract's constructor.
|
|
26
|
+
* @param deployments Deployment facilitator object from Hardhat.
|
|
27
|
+
* @param deployer Address deploying the contract.
|
|
28
|
+
* @param deploymentName Optional custom name for deployment; defaults to contract name.
|
|
29
|
+
* @param skipVerify Skips Etherscan verification if true.
|
|
30
|
+
* @param skipIfAlreadyDeployed Avoids redeployment if contract already deployed.
|
|
31
|
+
* @param gasPrice, maxPriorityFeePerGas, maxFeePerGas Gas strategy options.
|
|
32
|
+
* @param log Toggles deployment logging.
|
|
33
|
+
* @param waitConfirmations Number of confirmations to wait based on network. Ussually it's need for waiting before Etherscan verification.
|
|
34
|
+
* @returns The deployed contract instance.
|
|
35
|
+
*/
|
|
21
36
|
export declare function deployAndGetContract({ contractName, constructorArgs, deployments, deployer, deploymentName, skipVerify, skipIfAlreadyDeployed, gasPrice, maxPriorityFeePerGas, maxFeePerGas, log, waitConfirmations, }: DeployContractOptions): Promise<Contract>;
|
|
37
|
+
/**
|
|
38
|
+
* @category utils
|
|
39
|
+
* @notice Advances the blockchain time to a specific timestamp for testing purposes.
|
|
40
|
+
* @param seconds Target time in seconds or string format to increase to.
|
|
41
|
+
*/
|
|
22
42
|
export declare function timeIncreaseTo(seconds: number | string): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* @category utils
|
|
45
|
+
* @notice Deploys a contract given a name and optional constructor parameters.
|
|
46
|
+
* @param name The contract name.
|
|
47
|
+
* @param parameters Constructor parameters for the contract.
|
|
48
|
+
* @returns The deployed contract instance.
|
|
49
|
+
*/
|
|
23
50
|
export declare function deployContract(name: string, parameters?: Array<BigNumberish>): Promise<BaseContract>;
|
|
51
|
+
/**
|
|
52
|
+
* @category utils
|
|
53
|
+
* @notice Deploys a contract from bytecode, useful for testing and deployment of minimal proxies.
|
|
54
|
+
* @param abi Contract ABI.
|
|
55
|
+
* @param bytecode Contract bytecode.
|
|
56
|
+
* @param parameters Constructor parameters.
|
|
57
|
+
* @param signer Optional signer object.
|
|
58
|
+
* @returns The deployed contract instance.
|
|
59
|
+
*/
|
|
24
60
|
export declare function deployContractFromBytecode(abi: any[], bytecode: BytesLike, parameters?: Array<BigNumberish>, signer?: Signer): Promise<BaseContract>;
|
|
25
61
|
type Token = {
|
|
26
62
|
balanceOf: (address: string) => Promise<bigint>;
|
|
27
63
|
getAddress: () => Promise<string>;
|
|
28
64
|
};
|
|
29
65
|
type TrackReceivedTokenAndTxResult = [bigint, ContractTransactionReceipt | TrackReceivedTokenAndTxResult];
|
|
66
|
+
/**
|
|
67
|
+
* @category utils
|
|
68
|
+
* @notice Tracks token balance changes and transaction receipts for specified wallet addresses during test scenarios.
|
|
69
|
+
* It could be used recursively for multiple tokens via specific `txPromise` function.
|
|
70
|
+
* @param provider JSON RPC provider or custom provider object.
|
|
71
|
+
* @param token Token contract instance or ETH address constants.
|
|
72
|
+
* @param wallet Wallet address to track.
|
|
73
|
+
* @param txPromise Function returning a transaction promise.
|
|
74
|
+
* @param args Arguments for the transaction promise function.
|
|
75
|
+
* @returns Tuple of balance change and transaction receipt.
|
|
76
|
+
*/
|
|
30
77
|
export declare function trackReceivedTokenAndTx<T extends unknown[]>(provider: JsonRpcProvider | {
|
|
31
78
|
getBalance: (address: string) => Promise<bigint>;
|
|
32
79
|
}, token: Token | {
|
|
@@ -34,11 +81,43 @@ export declare function trackReceivedTokenAndTx<T extends unknown[]>(provider: J
|
|
|
34
81
|
} | {
|
|
35
82
|
address: typeof constants.EEE_ADDRESS;
|
|
36
83
|
}, wallet: string, txPromise: (...args: T) => Promise<ContractTransactionResponse | TrackReceivedTokenAndTxResult>, ...args: T): Promise<TrackReceivedTokenAndTxResult>;
|
|
84
|
+
/**
|
|
85
|
+
* @category utils
|
|
86
|
+
* @notice Corrects the ECDSA signature 'v' value according to Ethereum's standard.
|
|
87
|
+
* @param signature The original signature string.
|
|
88
|
+
* @returns The corrected signature string.
|
|
89
|
+
*/
|
|
37
90
|
export declare function fixSignature(signature: string): string;
|
|
91
|
+
/**
|
|
92
|
+
* @category utils
|
|
93
|
+
* @notice Signs a message with a given signer and fixes the signature format.
|
|
94
|
+
* @param signer Signer object or wallet instance.
|
|
95
|
+
* @param messageHex The message to sign, in hex format.
|
|
96
|
+
* @returns The signed message string.
|
|
97
|
+
*/
|
|
38
98
|
export declare function signMessage(signer: Wallet | {
|
|
39
99
|
signMessage: (messageHex: string | Uint8Array) => Promise<string>;
|
|
40
100
|
}, messageHex?: string | Uint8Array): Promise<string>;
|
|
101
|
+
/**
|
|
102
|
+
* @category utils
|
|
103
|
+
* @notice Counts the occurrences of specified EVM instructions in a transaction's execution trace.
|
|
104
|
+
* @param provider JSON RPC provider or custom provider object.
|
|
105
|
+
* @param txHash Transaction hash to analyze.
|
|
106
|
+
* @param instructions Array of EVM instructions (opcodes) to count.
|
|
107
|
+
* @returns Array of instruction counts.
|
|
108
|
+
*/
|
|
41
109
|
export declare function countInstructions(provider: JsonRpcProvider | {
|
|
42
110
|
send: (method: string, params: unknown[]) => Promise<any>;
|
|
43
111
|
}, txHash: string, instructions: string[]): Promise<number[]>;
|
|
112
|
+
/**
|
|
113
|
+
* @category utils
|
|
114
|
+
* @notice Retrieves the current USD price of ETH or another specified native token.
|
|
115
|
+
* This helper function is designed for use in test environments to maintain stability against market fluctuations.
|
|
116
|
+
* It fetches the current price of ETH (or a specified native token for side chains) in USD from the Coinbase API to
|
|
117
|
+
* ensure that tests remain stable and unaffected by significant market price fluctuations when token price is
|
|
118
|
+
* important part of test.
|
|
119
|
+
* @param nativeTokenSymbol The symbol of the native token for which the price is being fetched, defaults to 'ETH'.
|
|
120
|
+
* @return The price of the specified native token in USD, scaled by 1e18 to preserve precision.
|
|
121
|
+
*/
|
|
122
|
+
export declare function getEthPrice(nativeTokenSymbol?: string): Promise<bigint>;
|
|
44
123
|
export {};
|
package/dist/src/utils.js
CHANGED
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.countInstructions = exports.signMessage = exports.fixSignature = exports.trackReceivedTokenAndTx = exports.deployContractFromBytecode = exports.deployContract = exports.timeIncreaseTo = exports.deployAndGetContract = void 0;
|
|
3
|
+
exports.getEthPrice = exports.countInstructions = exports.signMessage = exports.fixSignature = exports.trackReceivedTokenAndTx = exports.deployContractFromBytecode = exports.deployContract = exports.timeIncreaseTo = exports.deployAndGetContract = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
require("@nomicfoundation/hardhat-ethers"); // required to populate the HardhatRuntimeEnvironment with ethers
|
|
6
6
|
const hardhat_1 = tslib_1.__importStar(require("hardhat"));
|
|
7
7
|
const hardhat_network_helpers_1 = require("@nomicfoundation/hardhat-network-helpers");
|
|
8
|
+
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
8
9
|
const prelude_1 = require("./prelude");
|
|
10
|
+
/**
|
|
11
|
+
* @category utils
|
|
12
|
+
* @notice Deploys a contract with optional Etherscan verification.
|
|
13
|
+
* @param contractName Name of the contract to deploy.
|
|
14
|
+
* @param constructorArgs Arguments for the contract's constructor.
|
|
15
|
+
* @param deployments Deployment facilitator object from Hardhat.
|
|
16
|
+
* @param deployer Address deploying the contract.
|
|
17
|
+
* @param deploymentName Optional custom name for deployment; defaults to contract name.
|
|
18
|
+
* @param skipVerify Skips Etherscan verification if true.
|
|
19
|
+
* @param skipIfAlreadyDeployed Avoids redeployment if contract already deployed.
|
|
20
|
+
* @param gasPrice, maxPriorityFeePerGas, maxFeePerGas Gas strategy options.
|
|
21
|
+
* @param log Toggles deployment logging.
|
|
22
|
+
* @param waitConfirmations Number of confirmations to wait based on network. Ussually it's need for waiting before Etherscan verification.
|
|
23
|
+
* @returns The deployed contract instance.
|
|
24
|
+
*/
|
|
9
25
|
async function deployAndGetContract({ contractName, constructorArgs, deployments, deployer, deploymentName = contractName, skipVerify = false, skipIfAlreadyDeployed = true, gasPrice, maxPriorityFeePerGas, maxFeePerGas, log = true, waitConfirmations = prelude_1.constants.DEV_CHAINS.includes(hardhat_1.default.network.name) ? 1 : 6, }) {
|
|
10
26
|
/**
|
|
11
27
|
* Deploys contract and tries to verify it on Etherscan if requested.
|
|
@@ -38,12 +54,24 @@ async function deployAndGetContract({ contractName, constructorArgs, deployments
|
|
|
38
54
|
return await hardhat_1.ethers.getContractAt(contractName, deployResult.address);
|
|
39
55
|
}
|
|
40
56
|
exports.deployAndGetContract = deployAndGetContract;
|
|
57
|
+
/**
|
|
58
|
+
* @category utils
|
|
59
|
+
* @notice Advances the blockchain time to a specific timestamp for testing purposes.
|
|
60
|
+
* @param seconds Target time in seconds or string format to increase to.
|
|
61
|
+
*/
|
|
41
62
|
async function timeIncreaseTo(seconds) {
|
|
42
63
|
const delay = 1000 - new Date().getMilliseconds();
|
|
43
64
|
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
44
65
|
await hardhat_network_helpers_1.time.increaseTo(seconds);
|
|
45
66
|
}
|
|
46
67
|
exports.timeIncreaseTo = timeIncreaseTo;
|
|
68
|
+
/**
|
|
69
|
+
* @category utils
|
|
70
|
+
* @notice Deploys a contract given a name and optional constructor parameters.
|
|
71
|
+
* @param name The contract name.
|
|
72
|
+
* @param parameters Constructor parameters for the contract.
|
|
73
|
+
* @returns The deployed contract instance.
|
|
74
|
+
*/
|
|
47
75
|
async function deployContract(name, parameters = []) {
|
|
48
76
|
const ContractFactory = await hardhat_1.ethers.getContractFactory(name);
|
|
49
77
|
const instance = await ContractFactory.deploy(...parameters);
|
|
@@ -51,6 +79,15 @@ async function deployContract(name, parameters = []) {
|
|
|
51
79
|
return instance;
|
|
52
80
|
}
|
|
53
81
|
exports.deployContract = deployContract;
|
|
82
|
+
/**
|
|
83
|
+
* @category utils
|
|
84
|
+
* @notice Deploys a contract from bytecode, useful for testing and deployment of minimal proxies.
|
|
85
|
+
* @param abi Contract ABI.
|
|
86
|
+
* @param bytecode Contract bytecode.
|
|
87
|
+
* @param parameters Constructor parameters.
|
|
88
|
+
* @param signer Optional signer object.
|
|
89
|
+
* @returns The deployed contract instance.
|
|
90
|
+
*/
|
|
54
91
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
55
92
|
async function deployContractFromBytecode(abi, bytecode, parameters = [], signer) {
|
|
56
93
|
const ContractFactory = await hardhat_1.ethers.getContractFactory(abi, bytecode, signer);
|
|
@@ -59,6 +96,17 @@ async function deployContractFromBytecode(abi, bytecode, parameters = [], signer
|
|
|
59
96
|
return instance;
|
|
60
97
|
}
|
|
61
98
|
exports.deployContractFromBytecode = deployContractFromBytecode;
|
|
99
|
+
/**
|
|
100
|
+
* @category utils
|
|
101
|
+
* @notice Tracks token balance changes and transaction receipts for specified wallet addresses during test scenarios.
|
|
102
|
+
* It could be used recursively for multiple tokens via specific `txPromise` function.
|
|
103
|
+
* @param provider JSON RPC provider or custom provider object.
|
|
104
|
+
* @param token Token contract instance or ETH address constants.
|
|
105
|
+
* @param wallet Wallet address to track.
|
|
106
|
+
* @param txPromise Function returning a transaction promise.
|
|
107
|
+
* @param args Arguments for the transaction promise function.
|
|
108
|
+
* @returns Tuple of balance change and transaction receipt.
|
|
109
|
+
*/
|
|
62
110
|
async function trackReceivedTokenAndTx(provider, token, wallet, txPromise, ...args) {
|
|
63
111
|
const tokenAddress = 'address' in token ? token.address : await token.getAddress();
|
|
64
112
|
const isETH = tokenAddress === prelude_1.constants.ZERO_ADDRESS || tokenAddress === prelude_1.constants.EEE_ADDRESS;
|
|
@@ -73,6 +121,12 @@ async function trackReceivedTokenAndTx(provider, token, wallet, txPromise, ...ar
|
|
|
73
121
|
return [postBalance - preBalance + txFees, 'wait' in txResponse ? txReceipt : txResponse];
|
|
74
122
|
}
|
|
75
123
|
exports.trackReceivedTokenAndTx = trackReceivedTokenAndTx;
|
|
124
|
+
/**
|
|
125
|
+
* @category utils
|
|
126
|
+
* @notice Corrects the ECDSA signature 'v' value according to Ethereum's standard.
|
|
127
|
+
* @param signature The original signature string.
|
|
128
|
+
* @returns The corrected signature string.
|
|
129
|
+
*/
|
|
76
130
|
function fixSignature(signature) {
|
|
77
131
|
// in geth its always 27/28, in ganache its 0/1. Change to 27/28 to prevent
|
|
78
132
|
// signature malleability if version is 0/1
|
|
@@ -85,10 +139,25 @@ function fixSignature(signature) {
|
|
|
85
139
|
return signature.slice(0, 130) + vHex;
|
|
86
140
|
}
|
|
87
141
|
exports.fixSignature = fixSignature;
|
|
142
|
+
/**
|
|
143
|
+
* @category utils
|
|
144
|
+
* @notice Signs a message with a given signer and fixes the signature format.
|
|
145
|
+
* @param signer Signer object or wallet instance.
|
|
146
|
+
* @param messageHex The message to sign, in hex format.
|
|
147
|
+
* @returns The signed message string.
|
|
148
|
+
*/
|
|
88
149
|
async function signMessage(signer, messageHex = '0x') {
|
|
89
150
|
return fixSignature(await signer.signMessage(messageHex));
|
|
90
151
|
}
|
|
91
152
|
exports.signMessage = signMessage;
|
|
153
|
+
/**
|
|
154
|
+
* @category utils
|
|
155
|
+
* @notice Counts the occurrences of specified EVM instructions in a transaction's execution trace.
|
|
156
|
+
* @param provider JSON RPC provider or custom provider object.
|
|
157
|
+
* @param txHash Transaction hash to analyze.
|
|
158
|
+
* @param instructions Array of EVM instructions (opcodes) to count.
|
|
159
|
+
* @returns Array of instruction counts.
|
|
160
|
+
*/
|
|
92
161
|
async function countInstructions(
|
|
93
162
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
94
163
|
provider, txHash, instructions) {
|
|
@@ -99,4 +168,26 @@ provider, txHash, instructions) {
|
|
|
99
168
|
});
|
|
100
169
|
}
|
|
101
170
|
exports.countInstructions = countInstructions;
|
|
171
|
+
/**
|
|
172
|
+
* @category utils
|
|
173
|
+
* @notice Retrieves the current USD price of ETH or another specified native token.
|
|
174
|
+
* This helper function is designed for use in test environments to maintain stability against market fluctuations.
|
|
175
|
+
* It fetches the current price of ETH (or a specified native token for side chains) in USD from the Coinbase API to
|
|
176
|
+
* ensure that tests remain stable and unaffected by significant market price fluctuations when token price is
|
|
177
|
+
* important part of test.
|
|
178
|
+
* @param nativeTokenSymbol The symbol of the native token for which the price is being fetched, defaults to 'ETH'.
|
|
179
|
+
* @return The price of the specified native token in USD, scaled by 1e18 to preserve precision.
|
|
180
|
+
*/
|
|
181
|
+
async function getEthPrice(nativeTokenSymbol = 'ETH') {
|
|
182
|
+
const response = await (0, node_fetch_1.default)(`https://api.coinbase.com/v2/prices/${nativeTokenSymbol}-USD/spot`);
|
|
183
|
+
let amount = 0n;
|
|
184
|
+
try {
|
|
185
|
+
amount = BigInt(parseFloat((await response.json()).data.amount) * 1e18);
|
|
186
|
+
}
|
|
187
|
+
catch {
|
|
188
|
+
throw new Error('Failed to parse price from Coinbase API');
|
|
189
|
+
}
|
|
190
|
+
return amount;
|
|
191
|
+
}
|
|
192
|
+
exports.getEthPrice = getEthPrice;
|
|
102
193
|
//# sourceMappingURL=utils.js.map
|
package/dist/src/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";;;;AAAA,2CAAyC,CAAE,iEAAiE;AAC5G,2DAAsC;AACtC,sFAAgE;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";;;;AAAA,2CAAyC,CAAE,iEAAiE;AAC5G,2DAAsC;AACtC,sFAAgE;AAChE,oEAA+B;AAI/B,uCAAsC;AAkBtC;;;;;;;;;;;;;;GAcG;AACI,KAAK,UAAU,oBAAoB,CAAC,EACvC,YAAY,EACZ,eAAe,EACf,WAAW,EACX,QAAQ,EACR,cAAc,GAAG,YAAY,EAC7B,UAAU,GAAG,KAAK,EAClB,qBAAqB,GAAG,IAAI,EAC5B,QAAQ,EACR,oBAAoB,EACpB,YAAY,EACZ,GAAG,GAAG,IAAI,EACV,iBAAiB,GAAG,mBAAS,CAAC,UAAU,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ionFragment, Result, Interface, AddressLike, ContractRunner, ContractMethod, Listener } from "ethers";
|
|
2
|
+
import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedListener, TypedContractMethod } from "../../common";
|
|
3
|
+
export interface SelfdestructEthSenderInterface extends Interface {
|
|
4
|
+
getFunction(nameOrSignature: "stopAndTransferBalance"): FunctionFragment;
|
|
5
|
+
encodeFunctionData(functionFragment: "stopAndTransferBalance", values: [AddressLike]): string;
|
|
6
|
+
decodeFunctionResult(functionFragment: "stopAndTransferBalance", data: BytesLike): Result;
|
|
7
|
+
}
|
|
8
|
+
export interface SelfdestructEthSender extends BaseContract {
|
|
9
|
+
connect(runner?: ContractRunner | null): SelfdestructEthSender;
|
|
10
|
+
waitForDeployment(): Promise<this>;
|
|
11
|
+
interface: SelfdestructEthSenderInterface;
|
|
12
|
+
queryFilter<TCEvent extends TypedContractEvent>(event: TCEvent, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise<Array<TypedEventLog<TCEvent>>>;
|
|
13
|
+
queryFilter<TCEvent extends TypedContractEvent>(filter: TypedDeferredTopicFilter<TCEvent>, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise<Array<TypedEventLog<TCEvent>>>;
|
|
14
|
+
on<TCEvent extends TypedContractEvent>(event: TCEvent, listener: TypedListener<TCEvent>): Promise<this>;
|
|
15
|
+
on<TCEvent extends TypedContractEvent>(filter: TypedDeferredTopicFilter<TCEvent>, listener: TypedListener<TCEvent>): Promise<this>;
|
|
16
|
+
once<TCEvent extends TypedContractEvent>(event: TCEvent, listener: TypedListener<TCEvent>): Promise<this>;
|
|
17
|
+
once<TCEvent extends TypedContractEvent>(filter: TypedDeferredTopicFilter<TCEvent>, listener: TypedListener<TCEvent>): Promise<this>;
|
|
18
|
+
listeners<TCEvent extends TypedContractEvent>(event: TCEvent): Promise<Array<TypedListener<TCEvent>>>;
|
|
19
|
+
listeners(eventName?: string): Promise<Array<Listener>>;
|
|
20
|
+
removeAllListeners<TCEvent extends TypedContractEvent>(event?: TCEvent): Promise<this>;
|
|
21
|
+
stopAndTransferBalance: TypedContractMethod<[
|
|
22
|
+
receiver: AddressLike
|
|
23
|
+
], [
|
|
24
|
+
void
|
|
25
|
+
], "nonpayable">;
|
|
26
|
+
getFunction<T extends ContractMethod = ContractMethod>(key: string | FunctionFragment): T;
|
|
27
|
+
getFunction(nameOrSignature: "stopAndTransferBalance"): TypedContractMethod<[receiver: AddressLike], [void], "nonpayable">;
|
|
28
|
+
filters: {};
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelfdestructEthSender.js","sourceRoot":"","sources":["../../../../typechain-types/contracts/mixins/SelfdestructEthSender.ts"],"names":[],"mappings":""}
|
|
@@ -2,3 +2,4 @@ export type { BySig } from "./BySig";
|
|
|
2
2
|
export type { EthReceiver } from "./EthReceiver";
|
|
3
3
|
export type { OnlyWethReceiver } from "./OnlyWethReceiver";
|
|
4
4
|
export type { PermitAndCall } from "./PermitAndCall";
|
|
5
|
+
export type { SelfdestructEthSender } from "./SelfdestructEthSender";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { BaseContract, BytesLike, FunctionFragment, Result, Interface, AddressLike, ContractRunner, ContractMethod, Listener } from "ethers";
|
|
2
|
+
import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedListener, TypedContractMethod } from "../../common";
|
|
3
|
+
export interface SelfdestructEthSenderMockInterface extends Interface {
|
|
4
|
+
getFunction(nameOrSignature: "stopAndTransferBalance" | "transferBalance"): FunctionFragment;
|
|
5
|
+
encodeFunctionData(functionFragment: "stopAndTransferBalance", values: [AddressLike]): string;
|
|
6
|
+
encodeFunctionData(functionFragment: "transferBalance", values: [AddressLike]): string;
|
|
7
|
+
decodeFunctionResult(functionFragment: "stopAndTransferBalance", data: BytesLike): Result;
|
|
8
|
+
decodeFunctionResult(functionFragment: "transferBalance", data: BytesLike): Result;
|
|
9
|
+
}
|
|
10
|
+
export interface SelfdestructEthSenderMock extends BaseContract {
|
|
11
|
+
connect(runner?: ContractRunner | null): SelfdestructEthSenderMock;
|
|
12
|
+
waitForDeployment(): Promise<this>;
|
|
13
|
+
interface: SelfdestructEthSenderMockInterface;
|
|
14
|
+
queryFilter<TCEvent extends TypedContractEvent>(event: TCEvent, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise<Array<TypedEventLog<TCEvent>>>;
|
|
15
|
+
queryFilter<TCEvent extends TypedContractEvent>(filter: TypedDeferredTopicFilter<TCEvent>, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise<Array<TypedEventLog<TCEvent>>>;
|
|
16
|
+
on<TCEvent extends TypedContractEvent>(event: TCEvent, listener: TypedListener<TCEvent>): Promise<this>;
|
|
17
|
+
on<TCEvent extends TypedContractEvent>(filter: TypedDeferredTopicFilter<TCEvent>, listener: TypedListener<TCEvent>): Promise<this>;
|
|
18
|
+
once<TCEvent extends TypedContractEvent>(event: TCEvent, listener: TypedListener<TCEvent>): Promise<this>;
|
|
19
|
+
once<TCEvent extends TypedContractEvent>(filter: TypedDeferredTopicFilter<TCEvent>, listener: TypedListener<TCEvent>): Promise<this>;
|
|
20
|
+
listeners<TCEvent extends TypedContractEvent>(event: TCEvent): Promise<Array<TypedListener<TCEvent>>>;
|
|
21
|
+
listeners(eventName?: string): Promise<Array<Listener>>;
|
|
22
|
+
removeAllListeners<TCEvent extends TypedContractEvent>(event?: TCEvent): Promise<this>;
|
|
23
|
+
stopAndTransferBalance: TypedContractMethod<[
|
|
24
|
+
receiver: AddressLike
|
|
25
|
+
], [
|
|
26
|
+
void
|
|
27
|
+
], "nonpayable">;
|
|
28
|
+
transferBalance: TypedContractMethod<[
|
|
29
|
+
receiver: AddressLike
|
|
30
|
+
], [
|
|
31
|
+
void
|
|
32
|
+
], "payable">;
|
|
33
|
+
getFunction<T extends ContractMethod = ContractMethod>(key: string | FunctionFragment): T;
|
|
34
|
+
getFunction(nameOrSignature: "stopAndTransferBalance"): TypedContractMethod<[receiver: AddressLike], [void], "nonpayable">;
|
|
35
|
+
getFunction(nameOrSignature: "transferBalance"): TypedContractMethod<[receiver: AddressLike], [void], "payable">;
|
|
36
|
+
filters: {};
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelfdestructEthSenderMock.js","sourceRoot":"","sources":["../../../../typechain-types/contracts/mocks/SelfdestructEthSenderMock.ts"],"names":[],"mappings":""}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, EventFragment, AddressLike, ContractRunner, ContractMethod, Listener } from "ethers";
|
|
2
2
|
import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedLogDescription, TypedListener, TypedContractMethod } from "../../common";
|
|
3
3
|
export interface TokenCustomDecimalsMockInterface extends Interface {
|
|
4
|
-
getFunction(nameOrSignature: "DOMAIN_SEPARATOR" | "allowance" | "approve" | "balanceOf" | "burn" | "decimals" | "eip712Domain" | "
|
|
4
|
+
getFunction(nameOrSignature: "DOMAIN_SEPARATOR" | "allowance" | "approve" | "balanceOf" | "burn" | "decimals" | "eip712Domain" | "mint" | "name" | "nonces" | "owner" | "permit" | "renounceOwnership" | "symbol" | "totalSupply" | "transfer" | "transferFrom" | "transferOwnership"): FunctionFragment;
|
|
5
5
|
getEvent(nameOrSignatureOrTopic: "Approval" | "EIP712DomainChanged" | "OwnershipTransferred" | "Transfer"): EventFragment;
|
|
6
6
|
encodeFunctionData(functionFragment: "DOMAIN_SEPARATOR", values?: undefined): string;
|
|
7
7
|
encodeFunctionData(functionFragment: "allowance", values: [AddressLike, AddressLike]): string;
|
|
@@ -10,7 +10,6 @@ export interface TokenCustomDecimalsMockInterface extends Interface {
|
|
|
10
10
|
encodeFunctionData(functionFragment: "burn", values: [AddressLike, BigNumberish]): string;
|
|
11
11
|
encodeFunctionData(functionFragment: "decimals", values?: undefined): string;
|
|
12
12
|
encodeFunctionData(functionFragment: "eip712Domain", values?: undefined): string;
|
|
13
|
-
encodeFunctionData(functionFragment: "getChainId", values?: undefined): string;
|
|
14
13
|
encodeFunctionData(functionFragment: "mint", values: [AddressLike, BigNumberish]): string;
|
|
15
14
|
encodeFunctionData(functionFragment: "name", values?: undefined): string;
|
|
16
15
|
encodeFunctionData(functionFragment: "nonces", values: [AddressLike]): string;
|
|
@@ -37,7 +36,6 @@ export interface TokenCustomDecimalsMockInterface extends Interface {
|
|
|
37
36
|
decodeFunctionResult(functionFragment: "burn", data: BytesLike): Result;
|
|
38
37
|
decodeFunctionResult(functionFragment: "decimals", data: BytesLike): Result;
|
|
39
38
|
decodeFunctionResult(functionFragment: "eip712Domain", data: BytesLike): Result;
|
|
40
|
-
decodeFunctionResult(functionFragment: "getChainId", data: BytesLike): Result;
|
|
41
39
|
decodeFunctionResult(functionFragment: "mint", data: BytesLike): Result;
|
|
42
40
|
decodeFunctionResult(functionFragment: "name", data: BytesLike): Result;
|
|
43
41
|
decodeFunctionResult(functionFragment: "nonces", data: BytesLike): Result;
|
|
@@ -160,7 +158,6 @@ export interface TokenCustomDecimalsMock extends BaseContract {
|
|
|
160
158
|
extensions: bigint[];
|
|
161
159
|
}
|
|
162
160
|
], "view">;
|
|
163
|
-
getChainId: TypedContractMethod<[], [bigint], "view">;
|
|
164
161
|
mint: TypedContractMethod<[
|
|
165
162
|
account: AddressLike,
|
|
166
163
|
amount: BigNumberish
|
|
@@ -244,7 +241,6 @@ export interface TokenCustomDecimalsMock extends BaseContract {
|
|
|
244
241
|
extensions: bigint[];
|
|
245
242
|
}
|
|
246
243
|
], "view">;
|
|
247
|
-
getFunction(nameOrSignature: "getChainId"): TypedContractMethod<[], [bigint], "view">;
|
|
248
244
|
getFunction(nameOrSignature: "mint"): TypedContractMethod<[
|
|
249
245
|
account: AddressLike,
|
|
250
246
|
amount: BigNumberish
|
|
@@ -14,7 +14,7 @@ export declare class Address__factory extends ContractFactory {
|
|
|
14
14
|
deploymentTransaction(): ContractTransactionResponse;
|
|
15
15
|
}>;
|
|
16
16
|
connect(runner: ContractRunner | null): Address__factory;
|
|
17
|
-
static readonly bytecode = "
|
|
17
|
+
static readonly bytecode = "0x6080806040523460175760399081601c823930815050f35b5f80fdfe5f80fdfea26469706673582212208e7307ba8afd20d5d71304f49c621d138e49636a467449c5fbe6e494e0a86f9a64736f6c63430008190033";
|
|
18
18
|
static readonly abi: readonly [{
|
|
19
19
|
readonly inputs: readonly [{
|
|
20
20
|
readonly internalType: "address";
|
|
@@ -34,7 +34,7 @@ const _abi = [
|
|
|
34
34
|
type: "error",
|
|
35
35
|
},
|
|
36
36
|
];
|
|
37
|
-
const _bytecode = "
|
|
37
|
+
const _bytecode = "0x6080806040523460175760399081601c823930815050f35b5f80fdfe5f80fdfea26469706673582212208e7307ba8afd20d5d71304f49c621d138e49636a467449c5fbe6e494e0a86f9a64736f6c63430008190033";
|
|
38
38
|
const isSuperArgs = (xs) => xs.length > 1;
|
|
39
39
|
class Address__factory extends ethers_1.ContractFactory {
|
|
40
40
|
constructor(...args) {
|
package/dist/typechain-types/factories/@openzeppelin/contracts/utils/ShortStrings__factory.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare class ShortStrings__factory extends ContractFactory {
|
|
|
14
14
|
deploymentTransaction(): ContractTransactionResponse;
|
|
15
15
|
}>;
|
|
16
16
|
connect(runner: ContractRunner | null): ShortStrings__factory;
|
|
17
|
-
static readonly bytecode = "
|
|
17
|
+
static readonly bytecode = "0x6080806040523460175760399081601c823930815050f35b5f80fdfe5f80fdfea2646970667358221220edc9c8ade387899184a347cb5d95804053c11d77c8c4af806f33d996796ad0c364736f6c63430008190033";
|
|
18
18
|
static readonly abi: readonly [{
|
|
19
19
|
readonly inputs: readonly [];
|
|
20
20
|
readonly name: "InvalidShortString";
|
package/dist/typechain-types/factories/@openzeppelin/contracts/utils/ShortStrings__factory.js
CHANGED
|
@@ -23,7 +23,7 @@ const _abi = [
|
|
|
23
23
|
type: "error",
|
|
24
24
|
},
|
|
25
25
|
];
|
|
26
|
-
const _bytecode = "
|
|
26
|
+
const _bytecode = "0x6080806040523460175760399081601c823930815050f35b5f80fdfe5f80fdfea2646970667358221220edc9c8ade387899184a347cb5d95804053c11d77c8c4af806f33d996796ad0c364736f6c63430008190033";
|
|
27
27
|
const isSuperArgs = (xs) => xs.length > 1;
|
|
28
28
|
class ShortStrings__factory extends ethers_1.ContractFactory {
|
|
29
29
|
constructor(...args) {
|
|
@@ -14,7 +14,7 @@ export declare class Strings__factory extends ContractFactory {
|
|
|
14
14
|
deploymentTransaction(): ContractTransactionResponse;
|
|
15
15
|
}>;
|
|
16
16
|
connect(runner: ContractRunner | null): Strings__factory;
|
|
17
|
-
static readonly bytecode = "
|
|
17
|
+
static readonly bytecode = "0x6080806040523460175760399081601c823930815050f35b5f80fdfe5f80fdfea26469706673582212208a4888671b973c8e7f68b4156e53a550899403092d55adcf9c7a9644aaf02f5a64736f6c63430008190033";
|
|
18
18
|
static readonly abi: readonly [{
|
|
19
19
|
readonly inputs: readonly [{
|
|
20
20
|
readonly internalType: "uint256";
|
|
@@ -23,7 +23,7 @@ const _abi = [
|
|
|
23
23
|
type: "error",
|
|
24
24
|
},
|
|
25
25
|
];
|
|
26
|
-
const _bytecode = "
|
|
26
|
+
const _bytecode = "0x6080806040523460175760399081601c823930815050f35b5f80fdfe5f80fdfea26469706673582212208a4888671b973c8e7f68b4156e53a550899403092d55adcf9c7a9644aaf02f5a64736f6c63430008190033";
|
|
27
27
|
const isSuperArgs = (xs) => xs.length > 1;
|
|
28
28
|
class Strings__factory extends ethers_1.ContractFactory {
|
|
29
29
|
constructor(...args) {
|
|
@@ -14,7 +14,7 @@ export declare class ECDSA__factory extends ContractFactory {
|
|
|
14
14
|
deploymentTransaction(): ContractTransactionResponse;
|
|
15
15
|
}>;
|
|
16
16
|
connect(runner: ContractRunner | null): ECDSA__factory;
|
|
17
|
-
static readonly bytecode = "
|
|
17
|
+
static readonly bytecode = "0x6080806040523460175760399081601c823930815050f35b5f80fdfe5f80fdfea264697066735822122037b0b9583aebde19d8cdbcb64a7c90da36adfdb28a42301e3fbb7fdbc0d18afe64736f6c63430008190033";
|
|
18
18
|
static readonly abi: readonly [{
|
|
19
19
|
readonly inputs: readonly [];
|
|
20
20
|
readonly name: "ECDSAInvalidSignature";
|