Skip to content

Latest commit

 

History

History
71 lines (53 loc) · 20.1 KB

contractcalllocal.md

File metadata and controls

71 lines (53 loc) · 20.1 KB

ContractCallLocal

ContractCallLocalQuery

Call a function of the given smart contract instance, giving it functionParameters as its inputs. It will consume the entire given amount of gas.

Field Type Description
header QueryHeader Standard info sent from client to node, including the signed payment, and what kind of response is requested (cost, state proof, both, or neither). The payment must cover the fees and all of the gas offered.
contractID ContractID The contract to make a static call against
gas int64 The amount of gas to use for the call. All of the gas offered will be charged for.
functionParameters bytes Which function to call, and the parameters to pass to the function
maxResultSize int64 Max number of bytes that the result might include. The run will fail if it would have returned more than this number of bytes. [deprecated 0.20.0]

ContractCallLocalResponse

Response when the client sends the node ContractCallLocalQuery

Field Type Description
header ResponseHeader standard response from node to client, including the requested fields: cost, or state proof, or both, or neither
functionResult ContractFunctionResult the value returned by the function (if it completed and didn't fail)

ContractFunctionResult

The result returned by a call to a smart contract function. This is part of the response to a ContractCallLocal query, and is in the record for a ContractCall or ContractCreateInstance transaction. The ContractCreateInstance transaction record has the results of the call to the constructor.

Field Type Description
contractID ContractID The smart contract instance whose function was called
contractCallResult bytes The result returned by the function
errorMessage string The message in case there was an error during smart contract execution
bloom bytes Bloom filter for record
gasUsed uint64 Units of gas used to execute contract
logInfo ContractLoginfo The log info for events returned by the function
createdContractIDs repeated ContractID The list of smart contracts that were created by the function call [deprecated]
stateChanges repeated ContractStateChange The list of state reads and changes caused by this function call
evm_address bytes

The 20-byte EVM address of the contract to call. Only populated after release 0.23, where each created contract will have its own record. There will be seperate chld record for each created contract.

Every contract has an EVM address determined by its shard.realm.num id. This address is as follows:

The first 4 bytes are the big-endian representation of the shard.

The next 8 bytes are the big-endian representation of the realm.

The final 8 bytes are the big-endian representation of the number.

Contracts created via CREATE2 have an additional, primary address that is derived from the EIP-1014 specification, and does not have a simple relation to a shard.realm.num id.

(Please do note that CREATE2 contracts can also be referenced by the three-part EVM address described above.)

gas int64 The amount of gas available for the call, aka the gasLimit. This field should only be populated when the paired TransactionBody in the record stream is not a ContractCreateTransactionBody or a ContractCallTransactionBody.
amount int64 Number of tinybars sent (the function must be payable if this is nonzero). This field should only be populated when the paired TransactionBody in the record stream is not a ContractCreateTransactionBody or a ContractCallTransactionBody.
functionParameters bytes The parameters passed into the contract call. This field should only be populated when the paired TransactionBody in the record stream is not a ContractCreateTransactionBody or a ContractCallTransactionBody.

ContractLoginfo

The log information for an event returned by a smart contract function call. One function call may return several such events.

Field Type Description
contractID ContractID Address of a contract that emitted the event
bloom bytes Bloom filter for a particular log
topic repeated bytes Topics of a particular event
data bytes Event data

ContractStateChange

The storage changes to a smart contract's storage as a side effect of the function call.

Field Type Description
contractID ContractID The contract to which the storage changes apply to
storageChanges repeated StorageChange The list of storage changes

StorageChange

A storage slot change description.

Field Type Description
slot bytes The storage slot changed. Up to 32 bytes, big-endian, zero bytes left trimmed
valueRead bytes The value read from the storage slot. Up to 32 bytes, big-endian, zero bytes left trimmed. Because of the way SSTORE operations are charged the slot is always read before being written to
valueWritten google.protobuf.BytesValue The new value written to the slot. Up to 32 bytes, big-endian, zero bytes left trimmed. If a value of zero is written the valueWritten will be present but the inner value will be absent. If a value was read and not written this value will not be present.