@1inch/solidity-utils 中文文档教程

发布于 3年前 浏览 24 项目主页 更新于 3年前

1inch network

Utils library for contracts and tests

构建状态覆盖状态NPM Package

About

这个存储库包含常用的智能合约、库和接口。 它还包含在测试中使用的实用程序。

Solidity

directory.soldescription
contractsEthReceiver
contractsPermitable
contractsGasChecker
contracts/interfacesIDaiLikePermitInterface of token which has permit method like DAI token
contracts/interfacesIWETHWETH token interface
contracts/librariesAddressArraylibrary for work with array of addresses
contracts/librariesAddressSetlibrary for work with set of addresses
contracts/librariesRevertReasonParserlibrary parse the message from reverted method to readble format
contracts/librariesStringUtiloptimized methods to convert data to hex
contracts/librariesUniERC20

JS

modulefunctiondescrption
assertsassertThrowsAsync(action, msg)checks the async function action() thrown with message msg
assertsassertRoughlyEqualValues(expected, actual, relativeDiff)checks the expected value is equal to actual value with relativeDiff precision
utilstimeIncreaseTo(seconds)increases blockchain time to seconds sec
utilstrackReceivedToken(token, wallet, txPromise, ...args)returns amount of token which recieved the wallet in async method txPromise with arguments args
utilstrackReceivedTokenAndTx(token, wallet, txPromise, ...args)returns transaction info and amount of token which recieved the wallet in async method txPromise with arguments args
utilsfixSignature(signature)patchs ganache's signature to geth's version
utilssignMessage(signer, messageHex)signs messageHex with signer and patchs ganache's signature to geth's version
utilscountInstructions(txHash, instruction)counts amount of instruction in transaction with txHash hash
profileEVMprofileEVM(txHash, instruction, optionalTraceFile)the same as the countInstructions() with option of writing all trace to optionalTraceFile
profileEVMgasspectEVM(txHash, options, optionalTraceFile)returns all used operations in txHash transaction with options and their costs with option of writing all trace to optionalTraceFile

UTILS

……

1inch network

Utils library for contracts and tests

Build StatusCoverage StatusNPM Package

About

This repository contains frequently used smart contracts, libraries and interfaces. Also it contains utils which are used in tests.

Solidity

directory.soldescription
contractsEthReceiver
contractsPermitable
contractsGasChecker
contracts/interfacesIDaiLikePermitInterface of token which has permit method like DAI token
contracts/interfacesIWETHWETH token interface
contracts/librariesAddressArraylibrary for work with array of addresses
contracts/librariesAddressSetlibrary for work with set of addresses
contracts/librariesRevertReasonParserlibrary parse the message from reverted method to readble format
contracts/librariesStringUtiloptimized methods to convert data to hex
contracts/librariesUniERC20

JS

modulefunctiondescrption
assertsassertThrowsAsync(action, msg)checks the async function action() thrown with message msg
assertsassertRoughlyEqualValues(expected, actual, relativeDiff)checks the expected value is equal to actual value with relativeDiff precision
utilstimeIncreaseTo(seconds)increases blockchain time to seconds sec
utilstrackReceivedToken(token, wallet, txPromise, ...args)returns amount of token which recieved the wallet in async method txPromise with arguments args
utilstrackReceivedTokenAndTx(token, wallet, txPromise, ...args)returns transaction info and amount of token which recieved the wallet in async method txPromise with arguments args
utilsfixSignature(signature)patchs ganache's signature to geth's version
utilssignMessage(signer, messageHex)signs messageHex with signer and patchs ganache's signature to geth's version
utilscountInstructions(txHash, instruction)counts amount of instruction in transaction with txHash hash
profileEVMprofileEVM(txHash, instruction, optionalTraceFile)the same as the countInstructions() with option of writing all trace to optionalTraceFile
profileEVMgasspectEVM(txHash, options, optionalTraceFile)returns all used operations in txHash transaction with options and their costs with option of writing all trace to optionalTraceFile

UTILS

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文