message ABI {
message Entry {
enum EntryType {
UnknownEntryType = 0;
Constructor = 1;
Function = 2;
Event = 3;
// Fallback functions are executed whenever a particular contract receives
// plain Ether without any other data associated with the transaction.
Fallback = 4;
}
message Param {
// This will cause the respective arguments to be searched for.
// If arrays (including string and bytes) are used as indexed arguments,
// the Keccak-256 hash of it is stored as topic instead.
bool indexed = 1;
string name = 2;
string type = 3;
// SolidityType type = 3;
}
enum StateMutabilityType {
UnknownStateMutabilityType = 0;
// With pure you cannot access the contract storage.
// e.g. utility libraries.
Pure = 1;
// With view you cannot modify the contract storage, but you can access the storage.
// e.g. contract getters.
View = 2;
Nonpayable = 3;
Payable = 4;
}
// The event was declared as `anonymous`
bool anonymous = 1;
// Replaced by view and pure.
bool constant = 2;
string name = 3;
repeated Param inputs = 4;
repeated Param outputs = 5;
EntryType type = 6;
bool payable = 7;
StateMutabilityType state_mutability = 8;
}
// renamed: entrys
repeated Entry entries = 1;
}
如上定义。
合约调用 ABI
合约调用传参,采用 byte4(keccak256(函数签名)) + 函数参数列表 ABI encode.