1.0.1 • Published 29 days ago

@chainlink/evm-gauntlet-abstract v1.0.1

Weekly downloads
-
License
-
Repository
-
Last release
29 days ago

Abstract Command EVM Gauntlet Package

This package will allow you to execute arbitrary contract functions with any inputs and list all the existing contract functions in Gauntlet EVM and any JSON ABI format files.

Execute arbitraty contract functions

Example using an existing contract in Gauntlet EVM

$ yarn gauntlet abstract:exec --contract=Storage --function=store --network=local --contractInput='{"num": "10"}' 0x5FbDB2315678afecb367f032d93F642f64180aa3
yarn run v1.22.19
$ yarn build && node ./packages/evm-gauntlet-cli/dist/index.js abstract:exec --contract=Storage --function=store --network=local '--contractInput={"num": "10"}' 0x5FbDB2315678afecb367f032d93F642f64180aa3
$ yarn clean && tsc -b ./tsconfig.json
$ tsc -b --clean ./tsconfig.json
🧤  gauntlet 0.3.1
ℹ️   About to execute abstract(0x5FbDB2315678afecb367f032d93F642f64180aa3).store({"num":"10"})
user input {
  contract: 'Storage',
  function: 'store',
  sourceAbiPath: undefined,
  contractInput: [ [ 'num', '10' ] ]
}
contract input [ '10' ]
ℹ️   Operator address: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
ℹ️   Contract address: 0x5FbDB2315678afecb367f032d93F642f64180aa3
⏳  Simulating transactions...
🤔  Continue? (Y / N)y
⏳  Sending transaction...
⏳  Waiting for tx confirmation at 0x95ea2d67f0a8ec6d0bef20d5c7b8fbc29105730d2459143abaeaf5fa17b86f19...
✅  Execution finished at transaction: 0x95ea2d67f0a8ec6d0bef20d5c7b8fbc29105730d2459143abaeaf5fa17b86f19
✨  Done in 12.34s.

Example using a contract in a JSON ABI format file

$ yarn gauntlet abstract:exec --sourceAbi=packages/evm-gauntlet-example/artifacts/evm/Storage.json --function=store --network=local --contractInput='{"num": "10"}' 0x5FbDB2315678afecb367f032d93F642f64180aa3
yarn run v1.22.19
$ yarn build && node ./packages/evm-gauntlet-cli/dist/index.js abstract:exec --sourceAbi=packages/evm-gauntlet-example/artifacts/evm/Storage.json --function=store --network=local '--contractInput={"num": "10"}' 0x5FbDB2315678afecb367f032d93F642f64180aa3
$ yarn clean && tsc -b ./tsconfig.json
$ tsc -b --clean ./tsconfig.json
🧤  gauntlet 0.3.1
input.contractInput:  [ [ 'num', '10' ] ]
ℹ️   About to execute abstract(0x5FbDB2315678afecb367f032d93F642f64180aa3).store({"num":"10"})
user input {
  contract: undefined,
  function: 'store',
  sourceAbiPath: 'packages/evm-gauntlet-example/artifacts/evm/Storage.json',
  contractInput: [ [ 'num', '10' ] ]
}
contract input [ '10' ]
ℹ️   Operator address: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
ℹ️   Contract address: 0x5FbDB2315678afecb367f032d93F642f64180aa3
⏳  Simulating transactions...
🤔  Continue? (Y / N)y
⏳  Sending transaction...
⏳  Waiting for tx confirmation at 0x9f29afbe4b76a03f4f9eb9d3e34b00253c39e1bd01f730144cfaef094a4ac0f6...
✅  Execution finished at transaction: 0x9f29afbe4b76a03f4f9eb9d3e34b00253c39e1bd01f730144cfaef094a4ac0f6
✨  Done in 28.35s.

List contracts and functions

Listing contracts and functions existing in Gauntlet EVM

# list contracts
$ yarn gauntlet abstract:list
yarn run v1.22.19
$ yarn build && node ./packages/evm-gauntlet-cli/dist/index.js abstract:list
$ yarn clean && tsc -b ./tsconfig.json
$ tsc -b --clean ./tsconfig.json
🧤  gauntlet 0.3.1
Contract                            # of functions
ARM                                 18          
PriceRegistry                       18          
Router                              14          
LockReleaseTokenPool                15          
EVM2EVMOnRamp                       35          
EVM2EVMOffRamp                      33          
CommitStore                         23          
AggregateRateLimiter                9           
OCR2Base                            9           
AccessControlledOffchainAggregator  46          
SimpleWriteAccessController         9           
Flags                               20          
Owned                               3           
EACAggregatorProxy                  23          
OpCodes                             4           
Storage                             2           
VerifierProxy                       11          
Verifier                            11          
GnosisSafe                          31          
GnosisSafeProxyFactory              6           
MultiSend                           1           
ConfirmedTransactionModule          12          
LinkToken                           15         
# list functions inside a contract
$ yarn gauntlet abstract:list --contract=AccessControlledOffchainAggregator
yarn run v1.22.19
$ yarn build && node ./packages/evm-gauntlet-cli/dist/index.js abstract:list --contract=AccessControlledOffchainAggregator
$ yarn clean && tsc -b ./tsconfig.json
$ tsc -b --clean ./tsconfig.json
🧤  gauntlet 0.3.1
Contract                            function                                                                                    
AccessControlledOffchainAggregator  function acceptOwnership()                                                                
AccessControlledOffchainAggregator  function addAccess()                                                             
AccessControlledOffchainAggregator  function enableAccessCheck()                                                              
AccessControlledOffchainAggregator  function getAnswer(uint256) view returns (int256)                                         
AccessControlledOffchainAggregator  function getBilling() view returns (uint32, uint32, uint32, uint32, uint32)               
AccessControlledOffchainAggregator  function getLinkToken() view returns (address)                                            
AccessControlledOffchainAggregator  function getRoundData(uint80) view returns (uint80, int256, uint256, uint256, uint80)     
AccessControlledOffchainAggregator  function getTimestamp(uint256) view returns (uint256)                                     
AccessControlledOffchainAggregator  function hasAccess(address,bytes) view returns (bool)                                     
AccessControlledOffchainAggregator  function latestAnswer() view returns (int256)                                             
AccessControlledOffchainAggregator  function latestConfigDetails() view returns (uint32, uint32, bytes16)                     
# ...
✨  Done in 5.54s.
# list a specific function in detail
$ yarn gauntlet abstract:list --contract=AccessControlledOffchainAggregator --function=latestTransmissionDetails
yarn run v1.22.19
$ yarn build && node ./packages/evm-gauntlet-cli/dist/index.js abstract:list --contract=AccessControlledOffchainAggregator --function=latestTransmissionDetails
$ yarn clean && tsc -b ./tsconfig.json
$ tsc -b --clean ./tsconfig.json
🧤  gauntlet 0.3.1
function                                                                                                                                          
function latestTransmissionDetails() view returns (bytes16 configDigest, uint32 epoch, uint8 round, int192 latestAnswer, uint64 latestTimestamp)
✨  Done in 5.47s.

Listing contracts and functions in a JSON ABI format file

yarn gauntlet abstract:list --sourceAbi=packages/evm-gauntlet-example/artifacts/evm/Storage.json
yarn run v1.22.19
$ yarn build && node ./packages/evm-gauntlet-cli/dist/index.js abstract:list --sourceAbi=packages/evm-gauntlet-example/artifacts/evm/Storage.json
$ yarn clean && tsc -b ./tsconfig.json
$ tsc -b --clean ./tsconfig.json
🧤  gauntlet 0.3.1
function                                    
function retrieve() view returns (uint256)
function store(uint256)                   
✨  Done in 5.45s.