编译器
0.8.20+commit.a1b79de6
文件 1 的 43:Channel.sol
pragma solidity ^0.8.20;
import "./ProtoBufRuntime.sol";
import "./GoogleProtobufAny.sol";
import "./Client.sol";
library Channel {
enum State {
STATE_UNINITIALIZED_UNSPECIFIED,
STATE_INIT,
STATE_TRYOPEN,
STATE_OPEN,
STATE_CLOSED,
STATE_FLUSHING,
STATE_FLUSHCOMPLETE
}
function encode_State(State x) internal pure returns (int32) {
if (x == State.STATE_UNINITIALIZED_UNSPECIFIED) {
return 0;
}
if (x == State.STATE_INIT) {
return 1;
}
if (x == State.STATE_TRYOPEN) {
return 2;
}
if (x == State.STATE_OPEN) {
return 3;
}
if (x == State.STATE_CLOSED) {
return 4;
}
if (x == State.STATE_FLUSHING) {
return 5;
}
if (x == State.STATE_FLUSHCOMPLETE) {
return 6;
}
revert();
}
function decode_State(int64 x) internal pure returns (State) {
if (x == 0) {
return State.STATE_UNINITIALIZED_UNSPECIFIED;
}
if (x == 1) {
return State.STATE_INIT;
}
if (x == 2) {
return State.STATE_TRYOPEN;
}
if (x == 3) {
return State.STATE_OPEN;
}
if (x == 4) {
return State.STATE_CLOSED;
}
if (x == 5) {
return State.STATE_FLUSHING;
}
if (x == 6) {
return State.STATE_FLUSHCOMPLETE;
}
revert();
}
function estimate_packed_repeated_State(
State[] memory a
) internal pure returns (uint256) {
uint256 e = 0;
for (uint i = 0; i < a.length; i++) {
e += ProtoBufRuntime._sz_enum(encode_State(a[i]));
}
return e;
}
enum Order {
ORDER_NONE_UNSPECIFIED,
ORDER_UNORDERED,
ORDER_ORDERED
}
function encode_Order(Order x) internal pure returns (int32) {
if (x == Order.ORDER_NONE_UNSPECIFIED) {
return 0;
}
if (x == Order.ORDER_UNORDERED) {
return 1;
}
if (x == Order.ORDER_ORDERED) {
return 2;
}
revert();
}
function decode_Order(int64 x) internal pure returns (Order) {
if (x == 0) {
return Order.ORDER_NONE_UNSPECIFIED;
}
if (x == 1) {
return Order.ORDER_UNORDERED;
}
if (x == 2) {
return Order.ORDER_ORDERED;
}
revert();
}
function estimate_packed_repeated_Order(
Order[] memory a
) internal pure returns (uint256) {
uint256 e = 0;
for (uint i = 0; i < a.length; i++) {
e += ProtoBufRuntime._sz_enum(encode_Order(a[i]));
}
return e;
}
struct Data {
Channel.State state;
Channel.Order ordering;
ChannelCounterparty.Data counterparty;
string[] connection_hops;
string version;
uint64 upgrade_sequence;
}
function decode(bytes memory bs) internal pure returns (Data memory) {
(Data memory x, ) = _decode(32, bs, bs.length);
return x;
}
function decode(Data storage self, bytes memory bs) internal {
(Data memory x, ) = _decode(32, bs, bs.length);
store(x, self);
}
function _decode(uint256 p, bytes memory bs, uint256 sz)
internal
pure
returns (Data memory, uint)
{
Data memory r;
uint[7] memory counters;
uint256 fieldId;
ProtoBufRuntime.WireType wireType;
uint256 bytesRead;
uint256 offset = p;
uint256 pointer = p;
while (pointer < offset + sz) {
(fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs);
pointer += bytesRead;
if (fieldId == 1) {
pointer += _read_state(pointer, bs, r);
} else
if (fieldId == 2) {
pointer += _read_ordering(pointer, bs, r);
} else
if (fieldId == 3) {
pointer += _read_counterparty(pointer, bs, r);
} else
if (fieldId == 4) {
pointer += _read_unpacked_repeated_connection_hops(pointer, bs, nil(), counters);
} else
if (fieldId == 5) {
pointer += _read_version(pointer, bs, r);
} else
if (fieldId == 6) {
pointer += _read_upgrade_sequence(pointer, bs, r);
} else
{
pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs);
}
}
pointer = offset;
if (counters[4] > 0) {
require(r.connection_hops.length == 0);
r.connection_hops = new string[](counters[4]);
}
while (pointer < offset + sz) {
(fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs);
pointer += bytesRead;
if (fieldId == 4) {
pointer += _read_unpacked_repeated_connection_hops(pointer, bs, r, counters);
} else
{
pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs);
}
}
return (r, sz);
}
function _read_state(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(int64 tmp, uint256 sz) = ProtoBufRuntime._decode_enum(p, bs);
Channel.State x = decode_State(tmp);
r.state = x;
return sz;
}
function _read_ordering(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(int64 tmp, uint256 sz) = ProtoBufRuntime._decode_enum(p, bs);
Channel.Order x = decode_Order(tmp);
r.ordering = x;
return sz;
}
function _read_counterparty(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(ChannelCounterparty.Data memory x, uint256 sz) = _decode_ChannelCounterparty(p, bs);
r.counterparty = x;
return sz;
}
function _read_unpacked_repeated_connection_hops(
uint256 p,
bytes memory bs,
Data memory r,
uint[7] memory counters
) internal pure returns (uint) {
(string memory x, uint256 sz) = ProtoBufRuntime._decode_string(p, bs);
if (isNil(r)) {
counters[4] += 1;
} else {
r.connection_hops[r.connection_hops.length - counters[4]] = x;
counters[4] -= 1;
}
return sz;
}
function _read_version(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(string memory x, uint256 sz) = ProtoBufRuntime._decode_string(p, bs);
r.version = x;
return sz;
}
function _read_upgrade_sequence(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(uint64 x, uint256 sz) = ProtoBufRuntime._decode_uint64(p, bs);
r.upgrade_sequence = x;
return sz;
}
function _decode_ChannelCounterparty(uint256 p, bytes memory bs)
internal
pure
returns (ChannelCounterparty.Data memory, uint)
{
uint256 pointer = p;
(uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs);
pointer += bytesRead;
(ChannelCounterparty.Data memory r, ) = ChannelCounterparty._decode(pointer, bs, sz);
return (r, sz + bytesRead);
}
function encode(Data memory r) internal pure returns (bytes memory) {
bytes memory bs = new bytes(_estimate(r));
uint256 sz = _encode(r, 32, bs);
assembly {
mstore(bs, sz)
}
return bs;
}
function _encode(Data memory r, uint256 p, bytes memory bs)
internal
pure
returns (uint)
{
uint256 offset = p;
uint256 pointer = p;
uint256 i;
if (uint(r.state) != 0) {
pointer += ProtoBufRuntime._encode_key(
1,
ProtoBufRuntime.WireType.Varint,
pointer,
bs
);
int32 _enum_state = encode_State(r.state);
pointer += ProtoBufRuntime._encode_enum(_enum_state, pointer, bs);
}
if (uint(r.ordering) != 0) {
pointer += ProtoBufRuntime._encode_key(
2,
ProtoBufRuntime.WireType.Varint,
pointer,
bs
);
int32 _enum_ordering = encode_Order(r.ordering);
pointer += ProtoBufRuntime._encode_enum(_enum_ordering, pointer, bs);
}
pointer += ProtoBufRuntime._encode_key(
3,
ProtoBufRuntime.WireType.LengthDelim,
pointer,
bs
);
pointer += ChannelCounterparty._encode_nested(r.counterparty, pointer, bs);
if (r.connection_hops.length != 0) {
for(i = 0; i < r.connection_hops.length; i++) {
pointer += ProtoBufRuntime._encode_key(
4,
ProtoBufRuntime.WireType.LengthDelim,
pointer,
bs)
;
pointer += ProtoBufRuntime._encode_string(r.connection_hops[i], pointer, bs);
}
}
if (bytes(r.version).length != 0) {
pointer += ProtoBufRuntime._encode_key(
5,
ProtoBufRuntime.WireType.LengthDelim,
pointer,
bs
);
pointer += ProtoBufRuntime._encode_string(r.version, pointer, bs);
}
if (r.upgrade_sequence != 0) {
pointer += ProtoBufRuntime._encode_key(
6,
ProtoBufRuntime.WireType.Varint,
pointer,
bs
);
pointer += ProtoBufRuntime._encode_uint64(r.upgrade_sequence, pointer, bs);
}
return pointer - offset;
}
function _encode_nested(Data memory r, uint256 p, bytes memory bs)
internal
pure
returns (uint)
{
uint256 offset = p;
uint256 pointer = p;
bytes memory tmp = new bytes(_estimate(r));
uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp);
uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs);
uint256 size = _encode(r, 32, tmp);
pointer += ProtoBufRuntime._encode_varint(size, pointer, bs);
ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size);
pointer += size;
delete tmp;
return pointer - offset;
}
function _estimate(
Data memory r
) internal pure returns (uint) {
uint256 e;uint256 i;
e += 1 + ProtoBufRuntime._sz_enum(encode_State(r.state));
e += 1 + ProtoBufRuntime._sz_enum(encode_Order(r.ordering));
e += 1 + ProtoBufRuntime._sz_lendelim(ChannelCounterparty._estimate(r.counterparty));
for(i = 0; i < r.connection_hops.length; i++) {
e += 1 + ProtoBufRuntime._sz_lendelim(bytes(r.connection_hops[i]).length);
}
e += 1 + ProtoBufRuntime._sz_lendelim(bytes(r.version).length);
e += 1 + ProtoBufRuntime._sz_uint64(r.upgrade_sequence);
return e;
}
function _empty(
Data memory r
) internal pure returns (bool) {
if (uint(r.state) != 0) {
return false;
}
if (uint(r.ordering) != 0) {
return false;
}
if (r.connection_hops.length != 0) {
return false;
}
if (bytes(r.version).length != 0) {
return false;
}
if (r.upgrade_sequence != 0) {
return false;
}
return true;
}
function store(Data memory input, Data storage output) internal {
output.state = input.state;
output.ordering = input.ordering;
ChannelCounterparty.store(input.counterparty, output.counterparty);
output.connection_hops = input.connection_hops;
output.version = input.version;
output.upgrade_sequence = input.upgrade_sequence;
}
function addConnectionHops(Data memory self, string memory value) internal pure {
string[] memory tmp = new string[](self.connection_hops.length + 1);
for (uint256 i = 0; i < self.connection_hops.length; i++) {
tmp[i] = self.connection_hops[i];
}
tmp[self.connection_hops.length] = value;
self.connection_hops = tmp;
}
function nil() internal pure returns (Data memory r) {
assembly {
r := 0
}
}
function isNil(Data memory x) internal pure returns (bool r) {
assembly {
r := iszero(x)
}
}
}
library ChannelCounterparty {
struct Data {
string port_id;
string channel_id;
}
function decode(bytes memory bs) internal pure returns (Data memory) {
(Data memory x, ) = _decode(32, bs, bs.length);
return x;
}
function decode(Data storage self, bytes memory bs) internal {
(Data memory x, ) = _decode(32, bs, bs.length);
store(x, self);
}
function _decode(uint256 p, bytes memory bs, uint256 sz)
internal
pure
returns (Data memory, uint)
{
Data memory r;
uint256 fieldId;
ProtoBufRuntime.WireType wireType;
uint256 bytesRead;
uint256 offset = p;
uint256 pointer = p;
while (pointer < offset + sz) {
(fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs);
pointer += bytesRead;
if (fieldId == 1) {
pointer += _read_port_id(pointer, bs, r);
} else
if (fieldId == 2) {
pointer += _read_channel_id(pointer, bs, r);
} else
{
pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs);
}
}
return (r, sz);
}
function _read_port_id(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(string memory x, uint256 sz) = ProtoBufRuntime._decode_string(p, bs);
r.port_id = x;
return sz;
}
function _read_channel_id(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(string memory x, uint256 sz) = ProtoBufRuntime._decode_string(p, bs);
r.channel_id = x;
return sz;
}
function encode(Data memory r) internal pure returns (bytes memory) {
bytes memory bs = new bytes(_estimate(r));
uint256 sz = _encode(r, 32, bs);
assembly {
mstore(bs, sz)
}
return bs;
}
function _encode(Data memory r, uint256 p, bytes memory bs)
internal
pure
returns (uint)
{
uint256 offset = p;
uint256 pointer = p;
if (bytes(r.port_id).length != 0) {
pointer += ProtoBufRuntime._encode_key(
1,
ProtoBufRuntime.WireType.LengthDelim,
pointer,
bs
);
pointer += ProtoBufRuntime._encode_string(r.port_id, pointer, bs);
}
if (bytes(r.channel_id).length != 0) {
pointer += ProtoBufRuntime._encode_key(
2,
ProtoBufRuntime.WireType.LengthDelim,
pointer,
bs
);
pointer += ProtoBufRuntime._encode_string(r.channel_id, pointer, bs);
}
return pointer - offset;
}
function _encode_nested(Data memory r, uint256 p, bytes memory bs)
internal
pure
returns (uint)
{
uint256 offset = p;
uint256 pointer = p;
bytes memory tmp = new bytes(_estimate(r));
uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp);
uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs);
uint256 size = _encode(r, 32, tmp);
pointer += ProtoBufRuntime._encode_varint(size, pointer, bs);
ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size);
pointer += size;
delete tmp;
return pointer - offset;
}
function _estimate(
Data memory r
) internal pure returns (uint) {
uint256 e;
e += 1 + ProtoBufRuntime._sz_lendelim(bytes(r.port_id).length);
e += 1 + ProtoBufRuntime._sz_lendelim(bytes(r.channel_id).length);
return e;
}
function _empty(
Data memory r
) internal pure returns (bool) {
if (bytes(r.port_id).length != 0) {
return false;
}
if (bytes(r.channel_id).length != 0) {
return false;
}
return true;
}
function store(Data memory input, Data storage output) internal {
output.port_id = input.port_id;
output.channel_id = input.channel_id;
}
function nil() internal pure returns (Data memory r) {
assembly {
r := 0
}
}
function isNil(Data memory x) internal pure returns (bool r) {
assembly {
r := iszero(x)
}
}
}
library Timeout {
struct Data {
Height.Data height;
uint64 timestamp;
}
function decode(bytes memory bs) internal pure returns (Data memory) {
(Data memory x, ) = _decode(32, bs, bs.length);
return x;
}
function decode(Data storage self, bytes memory bs) internal {
(Data memory x, ) = _decode(32, bs, bs.length);
store(x, self);
}
function _decode(uint256 p, bytes memory bs, uint256 sz)
internal
pure
returns (Data memory, uint)
{
Data memory r;
uint256 fieldId;
ProtoBufRuntime.WireType wireType;
uint256 bytesRead;
uint256 offset = p;
uint256 pointer = p;
while (pointer < offset + sz) {
(fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs);
pointer += bytesRead;
if (fieldId == 1) {
pointer += _read_height(pointer, bs, r);
} else
if (fieldId == 2) {
pointer += _read_timestamp(pointer, bs, r);
} else
{
pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs);
}
}
return (r, sz);
}
function _read_height(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(Height.Data memory x, uint256 sz) = _decode_Height(p, bs);
r.height = x;
return sz;
}
function _read_timestamp(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(uint64 x, uint256 sz) = ProtoBufRuntime._decode_uint64(p, bs);
r.timestamp = x;
return sz;
}
function _decode_Height(uint256 p, bytes memory bs)
internal
pure
returns (Height.Data memory, uint)
{
uint256 pointer = p;
(uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs);
pointer += bytesRead;
(Height.Data memory r, ) = Height._decode(pointer, bs, sz);
return (r, sz + bytesRead);
}
function encode(Data memory r) internal pure returns (bytes memory) {
bytes memory bs = new bytes(_estimate(r));
uint256 sz = _encode(r, 32, bs);
assembly {
mstore(bs, sz)
}
return bs;
}
function _encode(Data memory r, uint256 p, bytes memory bs)
internal
pure
returns (uint)
{
uint256 offset = p;
uint256 pointer = p;
pointer += ProtoBufRuntime._encode_key(
1,
ProtoBufRuntime.WireType.LengthDelim,
pointer,
bs
);
pointer += Height._encode_nested(r.height, pointer, bs);
if (r.timestamp != 0) {
pointer += ProtoBufRuntime._encode_key(
2,
ProtoBufRuntime.WireType.Varint,
pointer,
bs
);
pointer += ProtoBufRuntime._encode_uint64(r.timestamp, pointer, bs);
}
return pointer - offset;
}
function _encode_nested(Data memory r, uint256 p, bytes memory bs)
internal
pure
returns (uint)
{
uint256 offset = p;
uint256 pointer = p;
bytes memory tmp = new bytes(_estimate(r));
uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp);
uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs);
uint256 size = _encode(r, 32, tmp);
pointer += ProtoBufRuntime._encode_varint(size, pointer, bs);
ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size);
pointer += size;
delete tmp;
return pointer - offset;
}
function _estimate(
Data memory r
) internal pure returns (uint) {
uint256 e;
e += 1 + ProtoBufRuntime._sz_lendelim(Height._estimate(r.height));
e += 1 + ProtoBufRuntime._sz_uint64(r.timestamp);
return e;
}
function _empty(
Data memory r
) internal pure returns (bool) {
if (r.timestamp != 0) {
return false;
}
return true;
}
function store(Data memory input, Data storage output) internal {
Height.store(input.height, output.height);
output.timestamp = input.timestamp;
}
function nil() internal pure returns (Data memory r) {
assembly {
r := 0
}
}
function isNil(Data memory x) internal pure returns (bool r) {
assembly {
r := iszero(x)
}
}
}
library Upgrade {
struct Data {
UpgradeFields.Data fields;
Timeout.Data timeout;
uint64 next_sequence_send;
}
function decode(bytes memory bs) internal pure returns (Data memory) {
(Data memory x, ) = _decode(32, bs, bs.length);
return x;
}
function decode(Data storage self, bytes memory bs) internal {
(Data memory x, ) = _decode(32, bs, bs.length);
store(x, self);
}
function _decode(uint256 p, bytes memory bs, uint256 sz)
internal
pure
returns (Data memory, uint)
{
Data memory r;
uint256 fieldId;
ProtoBufRuntime.WireType wireType;
uint256 bytesRead;
uint256 offset = p;
uint256 pointer = p;
while (pointer < offset + sz) {
(fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs);
pointer += bytesRead;
if (fieldId == 1) {
pointer += _read_fields(pointer, bs, r);
} else
if (fieldId == 2) {
pointer += _read_timeout(pointer, bs, r);
} else
if (fieldId == 3) {
pointer += _read_next_sequence_send(pointer, bs, r);
} else
{
pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs);
}
}
return (r, sz);
}
function _read_fields(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(UpgradeFields.Data memory x, uint256 sz) = _decode_UpgradeFields(p, bs);
r.fields = x;
return sz;
}
function _read_timeout(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(Timeout.Data memory x, uint256 sz) = _decode_Timeout(p, bs);
r.timeout = x;
return sz;
}
function _read_next_sequence_send(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(uint64 x, uint256 sz) = ProtoBufRuntime._decode_uint64(p, bs);
r.next_sequence_send = x;
return sz;
}
function _decode_UpgradeFields(uint256 p, bytes memory bs)
internal
pure
returns (UpgradeFields.Data memory, uint)
{
uint256 pointer = p;
(uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs);
pointer += bytesRead;
(UpgradeFields.Data memory r, ) = UpgradeFields._decode(pointer, bs, sz);
return (r, sz + bytesRead);
}
function _decode_Timeout(uint256 p, bytes memory bs)
internal
pure
returns (Timeout.Data memory, uint)
{
uint256 pointer = p;
(uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs);
pointer += bytesRead;
(Timeout.Data memory r, ) = Timeout._decode(pointer, bs, sz);
return (r, sz + bytesRead);
}
function encode(Data memory r) internal pure returns (bytes memory) {
bytes memory bs = new bytes(_estimate(r));
uint256 sz = _encode(r, 32, bs);
assembly {
mstore(bs, sz)
}
return bs;
}
function _encode(Data memory r, uint256 p, bytes memory bs)
internal
pure
returns (uint)
{
uint256 offset = p;
uint256 pointer = p;
pointer += ProtoBufRuntime._encode_key(
1,
ProtoBufRuntime.WireType.LengthDelim,
pointer,
bs
);
pointer += UpgradeFields._encode_nested(r.fields, pointer, bs);
pointer += ProtoBufRuntime._encode_key(
2,
ProtoBufRuntime.WireType.LengthDelim,
pointer,
bs
);
pointer += Timeout._encode_nested(r.timeout, pointer, bs);
if (r.next_sequence_send != 0) {
pointer += ProtoBufRuntime._encode_key(
3,
ProtoBufRuntime.WireType.Varint,
pointer,
bs
);
pointer += ProtoBufRuntime._encode_uint64(r.next_sequence_send, pointer, bs);
}
return pointer - offset;
}
function _encode_nested(Data memory r, uint256 p, bytes memory bs)
internal
pure
returns (uint)
{
uint256 offset = p;
uint256 pointer = p;
bytes memory tmp = new bytes(_estimate(r));
uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp);
uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs);
uint256 size = _encode(r, 32, tmp);
pointer += ProtoBufRuntime._encode_varint(size, pointer, bs);
ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size);
pointer += size;
delete tmp;
return pointer - offset;
}
function _estimate(
Data memory r
) internal pure returns (uint) {
uint256 e;
e += 1 + ProtoBufRuntime._sz_lendelim(UpgradeFields._estimate(r.fields));
e += 1 + ProtoBufRuntime._sz_lendelim(Timeout._estimate(r.timeout));
e += 1 + ProtoBufRuntime._sz_uint64(r.next_sequence_send);
return e;
}
function _empty(
Data memory r
) internal pure returns (bool) {
if (r.next_sequence_send != 0) {
return false;
}
return true;
}
function store(Data memory input, Data storage output) internal {
UpgradeFields.store(input.fields, output.fields);
Timeout.store(input.timeout, output.timeout);
output.next_sequence_send = input.next_sequence_send;
}
function nil() internal pure returns (Data memory r) {
assembly {
r := 0
}
}
function isNil(Data memory x) internal pure returns (bool r) {
assembly {
r := iszero(x)
}
}
}
library UpgradeFields {
struct Data {
Channel.Order ordering;
string[] connection_hops;
string version;
}
function decode(bytes memory bs) internal pure returns (Data memory) {
(Data memory x, ) = _decode(32, bs, bs.length);
return x;
}
function decode(Data storage self, bytes memory bs) internal {
(Data memory x, ) = _decode(32, bs, bs.length);
store(x, self);
}
function _decode(uint256 p, bytes memory bs, uint256 sz)
internal
pure
returns (Data memory, uint)
{
Data memory r;
uint[4] memory counters;
uint256 fieldId;
ProtoBufRuntime.WireType wireType;
uint256 bytesRead;
uint256 offset = p;
uint256 pointer = p;
while (pointer < offset + sz) {
(fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs);
pointer += bytesRead;
if (fieldId == 1) {
pointer += _read_ordering(pointer, bs, r);
} else
if (fieldId == 2) {
pointer += _read_unpacked_repeated_connection_hops(pointer, bs, nil(), counters);
} else
if (fieldId == 3) {
pointer += _read_version(pointer, bs, r);
} else
{
pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs);
}
}
pointer = offset;
if (counters[2] > 0) {
require(r.connection_hops.length == 0);
r.connection_hops = new string[](counters[2]);
}
while (pointer < offset + sz) {
(fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs);
pointer += bytesRead;
if (fieldId == 2) {
pointer += _read_unpacked_repeated_connection_hops(pointer, bs, r, counters);
} else
{
pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs);
}
}
return (r, sz);
}
function _read_ordering(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(int64 tmp, uint256 sz) = ProtoBufRuntime._decode_enum(p, bs);
Channel.Order x = Channel.decode_Order(tmp);
r.ordering = x;
return sz;
}
function _read_unpacked_repeated_connection_hops(
uint256 p,
bytes memory bs,
Data memory r,
uint[4] memory counters
) internal pure returns (uint) {
(string memory x, uint256 sz) = ProtoBufRuntime._decode_string(p, bs);
if (isNil(r)) {
counters[2] += 1;
} else {
r.connection_hops[r.connection_hops.length - counters[2]] = x;
counters[2] -= 1;
}
return sz;
}
function _read_version(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(string memory x, uint256 sz) = ProtoBufRuntime._decode_string(p, bs);
r.version = x;
return sz;
}
function encode(Data memory r) internal pure returns (bytes memory) {
bytes memory bs = new bytes(_estimate(r));
uint256 sz = _encode(r, 32, bs);
assembly {
mstore(bs, sz)
}
return bs;
}
function _encode(Data memory r, uint256 p, bytes memory bs)
internal
pure
returns (uint)
{
uint256 offset = p;
uint256 pointer = p;
uint256 i;
if (uint(r.ordering) != 0) {
pointer += ProtoBufRuntime._encode_key(
1,
ProtoBufRuntime.WireType.Varint,
pointer,
bs
);
int32 _enum_ordering = Channel.encode_Order(r.ordering);
pointer += ProtoBufRuntime._encode_enum(_enum_ordering, pointer, bs);
}
if (r.connection_hops.length != 0) {
for(i = 0; i < r.connection_hops.length; i++) {
pointer += ProtoBufRuntime._encode_key(
2,
ProtoBufRuntime.WireType.LengthDelim,
pointer,
bs)
;
pointer += ProtoBufRuntime._encode_string(r.connection_hops[i], pointer, bs);
}
}
if (bytes(r.version).length != 0) {
pointer += ProtoBufRuntime._encode_key(
3,
ProtoBufRuntime.WireType.LengthDelim,
pointer,
bs
);
pointer += ProtoBufRuntime._encode_string(r.version, pointer, bs);
}
return pointer - offset;
}
function _encode_nested(Data memory r, uint256 p, bytes memory bs)
internal
pure
returns (uint)
{
uint256 offset = p;
uint256 pointer = p;
bytes memory tmp = new bytes(_estimate(r));
uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp);
uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs);
uint256 size = _encode(r, 32, tmp);
pointer += ProtoBufRuntime._encode_varint(size, pointer, bs);
ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size);
pointer += size;
delete tmp;
return pointer - offset;
}
function _estimate(
Data memory r
) internal pure returns (uint) {
uint256 e;uint256 i;
e += 1 + ProtoBufRuntime._sz_enum(Channel.encode_Order(r.ordering));
for(i = 0; i < r.connection_hops.length; i++) {
e += 1 + ProtoBufRuntime._sz_lendelim(bytes(r.connection_hops[i]).length);
}
e += 1 + ProtoBufRuntime._sz_lendelim(bytes(r.version).length);
return e;
}
function _empty(
Data memory r
) internal pure returns (bool) {
if (uint(r.ordering) != 0) {
return false;
}
if (r.connection_hops.length != 0) {
return false;
}
if (bytes(r.version).length != 0) {
return false;
}
return true;
}
function store(Data memory input, Data storage output) internal {
output.ordering = input.ordering;
output.connection_hops = input.connection_hops;
output.version = input.version;
}
function addConnectionHops(Data memory self, string memory value) internal pure {
string[] memory tmp = new string[](self.connection_hops.length + 1);
for (uint256 i = 0; i < self.connection_hops.length; i++) {
tmp[i] = self.connection_hops[i];
}
tmp[self.connection_hops.length] = value;
self.connection_hops = tmp;
}
function nil() internal pure returns (Data memory r) {
assembly {
r := 0
}
}
function isNil(Data memory x) internal pure returns (bool r) {
assembly {
r := iszero(x)
}
}
}
library ErrorReceipt {
struct Data {
uint64 sequence;
string message;
}
function decode(bytes memory bs) internal pure returns (Data memory) {
(Data memory x, ) = _decode(32, bs, bs.length);
return x;
}
function decode(Data storage self, bytes memory bs) internal {
(Data memory x, ) = _decode(32, bs, bs.length);
store(x, self);
}
function _decode(uint256 p, bytes memory bs, uint256 sz)
internal
pure
returns (Data memory, uint)
{
Data memory r;
uint256 fieldId;
ProtoBufRuntime.WireType wireType;
uint256 bytesRead;
uint256 offset = p;
uint256 pointer = p;
while (pointer < offset + sz) {
(fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs);
pointer += bytesRead;
if (fieldId == 1) {
pointer += _read_sequence(pointer, bs, r);
} else
if (fieldId == 2) {
pointer += _read_message(pointer, bs, r);
} else
{
pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs);
}
}
return (r, sz);
}
function _read_sequence(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(uint64 x, uint256 sz) = ProtoBufRuntime._decode_uint64(p, bs);
r.sequence = x;
return sz;
}
function _read_message(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(string memory x, uint256 sz) = ProtoBufRuntime._decode_string(p, bs);
r.message = x;
return sz;
}
function encode(Data memory r) internal pure returns (bytes memory) {
bytes memory bs = new bytes(_estimate(r));
uint256 sz = _encode(r, 32, bs);
assembly {
mstore(bs, sz)
}
return bs;
}
function _encode(Data memory r, uint256 p, bytes memory bs)
internal
pure
returns (uint)
{
uint256 offset = p;
uint256 pointer = p;
if (r.sequence != 0) {
pointer += ProtoBufRuntime._encode_key(
1,
ProtoBufRuntime.WireType.Varint,
pointer,
bs
);
pointer += ProtoBufRuntime._encode_uint64(r.sequence, pointer, bs);
}
if (bytes(r.message).length != 0) {
pointer += ProtoBufRuntime._encode_key(
2,
ProtoBufRuntime.WireType.LengthDelim,
pointer,
bs
);
pointer += ProtoBufRuntime._encode_string(r.message, pointer, bs);
}
return pointer - offset;
}
function _encode_nested(Data memory r, uint256 p, bytes memory bs)
internal
pure
returns (uint)
{
uint256 offset = p;
uint256 pointer = p;
bytes memory tmp = new bytes(_estimate(r));
uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp);
uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs);
uint256 size = _encode(r, 32, tmp);
pointer += ProtoBufRuntime._encode_varint(size, pointer, bs);
ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size);
pointer += size;
delete tmp;
return pointer - offset;
}
function _estimate(
Data memory r
) internal pure returns (uint) {
uint256 e;
e += 1 + ProtoBufRuntime._sz_uint64(r.sequence);
e += 1 + ProtoBufRuntime._sz_lendelim(bytes(r.message).length);
return e;
}
function _empty(
Data memory r
) internal pure returns (bool) {
if (r.sequence != 0) {
return false;
}
if (bytes(r.message).length != 0) {
return false;
}
return true;
}
function store(Data memory input, Data storage output) internal {
output.sequence = input.sequence;
output.message = input.message;
}
function nil() internal pure returns (Data memory r) {
assembly {
r := 0
}
}
function isNil(Data memory x) internal pure returns (bool r) {
assembly {
r := iszero(x)
}
}
}
文件 2 的 43:Client.sol
pragma solidity ^0.8.20;
import "./ProtoBufRuntime.sol";
import "./GoogleProtobufAny.sol";
library Height {
struct Data {
uint64 revision_number;
uint64 revision_height;
}
function decode(bytes memory bs) internal pure returns (Data memory) {
(Data memory x, ) = _decode(32, bs, bs.length);
return x;
}
function decode(Data storage self, bytes memory bs) internal {
(Data memory x, ) = _decode(32, bs, bs.length);
store(x, self);
}
function _decode(uint256 p, bytes memory bs, uint256 sz)
internal
pure
returns (Data memory, uint)
{
Data memory r;
uint256 fieldId;
ProtoBufRuntime.WireType wireType;
uint256 bytesRead;
uint256 offset = p;
uint256 pointer = p;
while (pointer < offset + sz) {
(fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs);
pointer += bytesRead;
if (fieldId == 1) {
pointer += _read_revision_number(pointer, bs, r);
} else
if (fieldId == 2) {
pointer += _read_revision_height(pointer, bs, r);
} else
{
pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs);
}
}
return (r, sz);
}
function _read_revision_number(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(uint64 x, uint256 sz) = ProtoBufRuntime._decode_uint64(p, bs);
r.revision_number = x;
return sz;
}
function _read_revision_height(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(uint64 x, uint256 sz) = ProtoBufRuntime._decode_uint64(p, bs);
r.revision_height = x;
return sz;
}
function encode(Data memory r) internal pure returns (bytes memory) {
bytes memory bs = new bytes(_estimate(r));
uint256 sz = _encode(r, 32, bs);
assembly {
mstore(bs, sz)
}
return bs;
}
function _encode(Data memory r, uint256 p, bytes memory bs)
internal
pure
returns (uint)
{
uint256 offset = p;
uint256 pointer = p;
if (r.revision_number != 0) {
pointer += ProtoBufRuntime._encode_key(
1,
ProtoBufRuntime.WireType.Varint,
pointer,
bs
);
pointer += ProtoBufRuntime._encode_uint64(r.revision_number, pointer, bs);
}
if (r.revision_height != 0) {
pointer += ProtoBufRuntime._encode_key(
2,
ProtoBufRuntime.WireType.Varint,
pointer,
bs
);
pointer += ProtoBufRuntime._encode_uint64(r.revision_height, pointer, bs);
}
return pointer - offset;
}
function _encode_nested(Data memory r, uint256 p, bytes memory bs)
internal
pure
returns (uint)
{
uint256 offset = p;
uint256 pointer = p;
bytes memory tmp = new bytes(_estimate(r));
uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp);
uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs);
uint256 size = _encode(r, 32, tmp);
pointer += ProtoBufRuntime._encode_varint(size, pointer, bs);
ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size);
pointer += size;
delete tmp;
return pointer - offset;
}
function _estimate(
Data memory r
) internal pure returns (uint) {
uint256 e;
e += 1 + ProtoBufRuntime._sz_uint64(r.revision_number);
e += 1 + ProtoBufRuntime._sz_uint64(r.revision_height);
return e;
}
function _empty(
Data memory r
) internal pure returns (bool) {
if (r.revision_number != 0) {
return false;
}
if (r.revision_height != 0) {
return false;
}
return true;
}
function store(Data memory input, Data storage output) internal {
output.revision_number = input.revision_number;
output.revision_height = input.revision_height;
}
function nil() internal pure returns (Data memory r) {
assembly {
r := 0
}
}
function isNil(Data memory x) internal pure returns (bool r) {
assembly {
r := iszero(x)
}
}
}
文件 3 的 43:Commitment.sol
pragma solidity ^0.8.20;
import "./ProtoBufRuntime.sol";
import "./GoogleProtobufAny.sol";
library MerklePrefix {
struct Data {
bytes key_prefix;
}
function decode(bytes memory bs) internal pure returns (Data memory) {
(Data memory x, ) = _decode(32, bs, bs.length);
return x;
}
function decode(Data storage self, bytes memory bs) internal {
(Data memory x, ) = _decode(32, bs, bs.length);
store(x, self);
}
function _decode(uint256 p, bytes memory bs, uint256 sz)
internal
pure
returns (Data memory, uint)
{
Data memory r;
uint256 fieldId;
ProtoBufRuntime.WireType wireType;
uint256 bytesRead;
uint256 offset = p;
uint256 pointer = p;
while (pointer < offset + sz) {
(fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs);
pointer += bytesRead;
if (fieldId == 1) {
pointer += _read_key_prefix(pointer, bs, r);
} else
{
pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs);
}
}
return (r, sz);
}
function _read_key_prefix(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(bytes memory x, uint256 sz) = ProtoBufRuntime._decode_bytes(p, bs);
r.key_prefix = x;
return sz;
}
function encode(Data memory r) internal pure returns (bytes memory) {
bytes memory bs = new bytes(_estimate(r));
uint256 sz = _encode(r, 32, bs);
assembly {
mstore(bs, sz)
}
return bs;
}
function _encode(Data memory r, uint256 p, bytes memory bs)
internal
pure
returns (uint)
{
uint256 offset = p;
uint256 pointer = p;
if (r.key_prefix.length != 0) {
pointer += ProtoBufRuntime._encode_key(
1,
ProtoBufRuntime.WireType.LengthDelim,
pointer,
bs
);
pointer += ProtoBufRuntime._encode_bytes(r.key_prefix, pointer, bs);
}
return pointer - offset;
}
function _encode_nested(Data memory r, uint256 p, bytes memory bs)
internal
pure
returns (uint)
{
uint256 offset = p;
uint256 pointer = p;
bytes memory tmp = new bytes(_estimate(r));
uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp);
uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs);
uint256 size = _encode(r, 32, tmp);
pointer += ProtoBufRuntime._encode_varint(size, pointer, bs);
ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size);
pointer += size;
delete tmp;
return pointer - offset;
}
function _estimate(
Data memory r
) internal pure returns (uint) {
uint256 e;
e += 1 + ProtoBufRuntime._sz_lendelim(r.key_prefix.length);
return e;
}
function _empty(
Data memory r
) internal pure returns (bool) {
if (r.key_prefix.length != 0) {
return false;
}
return true;
}
function store(Data memory input, Data storage output) internal {
output.key_prefix = input.key_prefix;
}
function nil() internal pure returns (Data memory r) {
assembly {
r := 0
}
}
function isNil(Data memory x) internal pure returns (bool r) {
assembly {
r := iszero(x)
}
}
}
文件 4 的 43:Connection.sol
pragma solidity ^0.8.20;
import "./ProtoBufRuntime.sol";
import "./GoogleProtobufAny.sol";
import "./Commitment.sol";
library ConnectionEnd {
enum State {
STATE_UNINITIALIZED_UNSPECIFIED,
STATE_INIT,
STATE_TRYOPEN,
STATE_OPEN
}
function encode_State(State x) internal pure returns (int32) {
if (x == State.STATE_UNINITIALIZED_UNSPECIFIED) {
return 0;
}
if (x == State.STATE_INIT) {
return 1;
}
if (x == State.STATE_TRYOPEN) {
return 2;
}
if (x == State.STATE_OPEN) {
return 3;
}
revert();
}
function decode_State(int64 x) internal pure returns (State) {
if (x == 0) {
return State.STATE_UNINITIALIZED_UNSPECIFIED;
}
if (x == 1) {
return State.STATE_INIT;
}
if (x == 2) {
return State.STATE_TRYOPEN;
}
if (x == 3) {
return State.STATE_OPEN;
}
revert();
}
function estimate_packed_repeated_State(
State[] memory a
) internal pure returns (uint256) {
uint256 e = 0;
for (uint i = 0; i < a.length; i++) {
e += ProtoBufRuntime._sz_enum(encode_State(a[i]));
}
return e;
}
struct Data {
string client_id;
Version.Data[] versions;
ConnectionEnd.State state;
Counterparty.Data counterparty;
uint64 delay_period;
}
function decode(bytes memory bs) internal pure returns (Data memory) {
(Data memory x, ) = _decode(32, bs, bs.length);
return x;
}
function decode(Data storage self, bytes memory bs) internal {
(Data memory x, ) = _decode(32, bs, bs.length);
store(x, self);
}
function _decode(uint256 p, bytes memory bs, uint256 sz)
internal
pure
returns (Data memory, uint)
{
Data memory r;
uint[6] memory counters;
uint256 fieldId;
ProtoBufRuntime.WireType wireType;
uint256 bytesRead;
uint256 offset = p;
uint256 pointer = p;
while (pointer < offset + sz) {
(fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs);
pointer += bytesRead;
if (fieldId == 1) {
pointer += _read_client_id(pointer, bs, r);
} else
if (fieldId == 2) {
pointer += _read_unpacked_repeated_versions(pointer, bs, nil(), counters);
} else
if (fieldId == 3) {
pointer += _read_state(pointer, bs, r);
} else
if (fieldId == 4) {
pointer += _read_counterparty(pointer, bs, r);
} else
if (fieldId == 5) {
pointer += _read_delay_period(pointer, bs, r);
} else
{
pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs);
}
}
pointer = offset;
if (counters[2] > 0) {
require(r.versions.length == 0);
r.versions = new Version.Data[](counters[2]);
}
while (pointer < offset + sz) {
(fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs);
pointer += bytesRead;
if (fieldId == 2) {
pointer += _read_unpacked_repeated_versions(pointer, bs, r, counters);
} else
{
pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs);
}
}
return (r, sz);
}
function _read_client_id(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(string memory x, uint256 sz) = ProtoBufRuntime._decode_string(p, bs);
r.client_id = x;
return sz;
}
function _read_unpacked_repeated_versions(
uint256 p,
bytes memory bs,
Data memory r,
uint[6] memory counters
) internal pure returns (uint) {
(Version.Data memory x, uint256 sz) = _decode_Version(p, bs);
if (isNil(r)) {
counters[2] += 1;
} else {
r.versions[r.versions.length - counters[2]] = x;
counters[2] -= 1;
}
return sz;
}
function _read_state(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(int64 tmp, uint256 sz) = ProtoBufRuntime._decode_enum(p, bs);
ConnectionEnd.State x = decode_State(tmp);
r.state = x;
return sz;
}
function _read_counterparty(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(Counterparty.Data memory x, uint256 sz) = _decode_Counterparty(p, bs);
r.counterparty = x;
return sz;
}
function _read_delay_period(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(uint64 x, uint256 sz) = ProtoBufRuntime._decode_uint64(p, bs);
r.delay_period = x;
return sz;
}
function _decode_Version(uint256 p, bytes memory bs)
internal
pure
returns (Version.Data memory, uint)
{
uint256 pointer = p;
(uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs);
pointer += bytesRead;
(Version.Data memory r, ) = Version._decode(pointer, bs, sz);
return (r, sz + bytesRead);
}
function _decode_Counterparty(uint256 p, bytes memory bs)
internal
pure
returns (Counterparty.Data memory, uint)
{
uint256 pointer = p;
(uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs);
pointer += bytesRead;
(Counterparty.Data memory r, ) = Counterparty._decode(pointer, bs, sz);
return (r, sz + bytesRead);
}
function encode(Data memory r) internal pure returns (bytes memory) {
bytes memory bs = new bytes(_estimate(r));
uint256 sz = _encode(r, 32, bs);
assembly {
mstore(bs, sz)
}
return bs;
}
function _encode(Data memory r, uint256 p, bytes memory bs)
internal
pure
returns (uint)
{
uint256 offset = p;
uint256 pointer = p;
uint256 i;
if (bytes(r.client_id).length != 0) {
pointer += ProtoBufRuntime._encode_key(
1,
ProtoBufRuntime.WireType.LengthDelim,
pointer,
bs
);
pointer += ProtoBufRuntime._encode_string(r.client_id, pointer, bs);
}
if (r.versions.length != 0) {
for(i = 0; i < r.versions.length; i++) {
pointer += ProtoBufRuntime._encode_key(
2,
ProtoBufRuntime.WireType.LengthDelim,
pointer,
bs)
;
pointer += Version._encode_nested(r.versions[i], pointer, bs);
}
}
if (uint(r.state) != 0) {
pointer += ProtoBufRuntime._encode_key(
3,
ProtoBufRuntime.WireType.Varint,
pointer,
bs
);
int32 _enum_state = encode_State(r.state);
pointer += ProtoBufRuntime._encode_enum(_enum_state, pointer, bs);
}
pointer += ProtoBufRuntime._encode_key(
4,
ProtoBufRuntime.WireType.LengthDelim,
pointer,
bs
);
pointer += Counterparty._encode_nested(r.counterparty, pointer, bs);
if (r.delay_period != 0) {
pointer += ProtoBufRuntime._encode_key(
5,
ProtoBufRuntime.WireType.Varint,
pointer,
bs
);
pointer += ProtoBufRuntime._encode_uint64(r.delay_period, pointer, bs);
}
return pointer - offset;
}
function _encode_nested(Data memory r, uint256 p, bytes memory bs)
internal
pure
returns (uint)
{
uint256 offset = p;
uint256 pointer = p;
bytes memory tmp = new bytes(_estimate(r));
uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp);
uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs);
uint256 size = _encode(r, 32, tmp);
pointer += ProtoBufRuntime._encode_varint(size, pointer, bs);
ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size);
pointer += size;
delete tmp;
return pointer - offset;
}
function _estimate(
Data memory r
) internal pure returns (uint) {
uint256 e;uint256 i;
e += 1 + ProtoBufRuntime._sz_lendelim(bytes(r.client_id).length);
for(i = 0; i < r.versions.length; i++) {
e += 1 + ProtoBufRuntime._sz_lendelim(Version._estimate(r.versions[i]));
}
e += 1 + ProtoBufRuntime._sz_enum(encode_State(r.state));
e += 1 + ProtoBufRuntime._sz_lendelim(Counterparty._estimate(r.counterparty));
e += 1 + ProtoBufRuntime._sz_uint64(r.delay_period);
return e;
}
function _empty(
Data memory r
) internal pure returns (bool) {
if (bytes(r.client_id).length != 0) {
return false;
}
if (r.versions.length != 0) {
return false;
}
if (uint(r.state) != 0) {
return false;
}
if (r.delay_period != 0) {
return false;
}
return true;
}
function store(Data memory input, Data storage output) internal {
output.client_id = input.client_id;
for(uint256 i2 = 0; i2 < input.versions.length; i2++) {
output.versions.push(input.versions[i2]);
}
output.state = input.state;
Counterparty.store(input.counterparty, output.counterparty);
output.delay_period = input.delay_period;
}
function addVersions(Data memory self, Version.Data memory value) internal pure {
Version.Data[] memory tmp = new Version.Data[](self.versions.length + 1);
for (uint256 i = 0; i < self.versions.length; i++) {
tmp[i] = self.versions[i];
}
tmp[self.versions.length] = value;
self.versions = tmp;
}
function nil() internal pure returns (Data memory r) {
assembly {
r := 0
}
}
function isNil(Data memory x) internal pure returns (bool r) {
assembly {
r := iszero(x)
}
}
}
library Counterparty {
struct Data {
string client_id;
string connection_id;
MerklePrefix.Data prefix;
}
function decode(bytes memory bs) internal pure returns (Data memory) {
(Data memory x, ) = _decode(32, bs, bs.length);
return x;
}
function decode(Data storage self, bytes memory bs) internal {
(Data memory x, ) = _decode(32, bs, bs.length);
store(x, self);
}
function _decode(uint256 p, bytes memory bs, uint256 sz)
internal
pure
returns (Data memory, uint)
{
Data memory r;
uint256 fieldId;
ProtoBufRuntime.WireType wireType;
uint256 bytesRead;
uint256 offset = p;
uint256 pointer = p;
while (pointer < offset + sz) {
(fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs);
pointer += bytesRead;
if (fieldId == 1) {
pointer += _read_client_id(pointer, bs, r);
} else
if (fieldId == 2) {
pointer += _read_connection_id(pointer, bs, r);
} else
if (fieldId == 3) {
pointer += _read_prefix(pointer, bs, r);
} else
{
pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs);
}
}
return (r, sz);
}
function _read_client_id(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(string memory x, uint256 sz) = ProtoBufRuntime._decode_string(p, bs);
r.client_id = x;
return sz;
}
function _read_connection_id(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(string memory x, uint256 sz) = ProtoBufRuntime._decode_string(p, bs);
r.connection_id = x;
return sz;
}
function _read_prefix(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(MerklePrefix.Data memory x, uint256 sz) = _decode_MerklePrefix(p, bs);
r.prefix = x;
return sz;
}
function _decode_MerklePrefix(uint256 p, bytes memory bs)
internal
pure
returns (MerklePrefix.Data memory, uint)
{
uint256 pointer = p;
(uint256 sz, uint256 bytesRead) = ProtoBufRuntime._decode_varint(pointer, bs);
pointer += bytesRead;
(MerklePrefix.Data memory r, ) = MerklePrefix._decode(pointer, bs, sz);
return (r, sz + bytesRead);
}
function encode(Data memory r) internal pure returns (bytes memory) {
bytes memory bs = new bytes(_estimate(r));
uint256 sz = _encode(r, 32, bs);
assembly {
mstore(bs, sz)
}
return bs;
}
function _encode(Data memory r, uint256 p, bytes memory bs)
internal
pure
returns (uint)
{
uint256 offset = p;
uint256 pointer = p;
if (bytes(r.client_id).length != 0) {
pointer += ProtoBufRuntime._encode_key(
1,
ProtoBufRuntime.WireType.LengthDelim,
pointer,
bs
);
pointer += ProtoBufRuntime._encode_string(r.client_id, pointer, bs);
}
if (bytes(r.connection_id).length != 0) {
pointer += ProtoBufRuntime._encode_key(
2,
ProtoBufRuntime.WireType.LengthDelim,
pointer,
bs
);
pointer += ProtoBufRuntime._encode_string(r.connection_id, pointer, bs);
}
pointer += ProtoBufRuntime._encode_key(
3,
ProtoBufRuntime.WireType.LengthDelim,
pointer,
bs
);
pointer += MerklePrefix._encode_nested(r.prefix, pointer, bs);
return pointer - offset;
}
function _encode_nested(Data memory r, uint256 p, bytes memory bs)
internal
pure
returns (uint)
{
uint256 offset = p;
uint256 pointer = p;
bytes memory tmp = new bytes(_estimate(r));
uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp);
uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs);
uint256 size = _encode(r, 32, tmp);
pointer += ProtoBufRuntime._encode_varint(size, pointer, bs);
ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size);
pointer += size;
delete tmp;
return pointer - offset;
}
function _estimate(
Data memory r
) internal pure returns (uint) {
uint256 e;
e += 1 + ProtoBufRuntime._sz_lendelim(bytes(r.client_id).length);
e += 1 + ProtoBufRuntime._sz_lendelim(bytes(r.connection_id).length);
e += 1 + ProtoBufRuntime._sz_lendelim(MerklePrefix._estimate(r.prefix));
return e;
}
function _empty(
Data memory r
) internal pure returns (bool) {
if (bytes(r.client_id).length != 0) {
return false;
}
if (bytes(r.connection_id).length != 0) {
return false;
}
return true;
}
function store(Data memory input, Data storage output) internal {
output.client_id = input.client_id;
output.connection_id = input.connection_id;
MerklePrefix.store(input.prefix, output.prefix);
}
function nil() internal pure returns (Data memory r) {
assembly {
r := 0
}
}
function isNil(Data memory x) internal pure returns (bool r) {
assembly {
r := iszero(x)
}
}
}
library Version {
struct Data {
string identifier;
string[] features;
}
function decode(bytes memory bs) internal pure returns (Data memory) {
(Data memory x, ) = _decode(32, bs, bs.length);
return x;
}
function decode(Data storage self, bytes memory bs) internal {
(Data memory x, ) = _decode(32, bs, bs.length);
store(x, self);
}
function _decode(uint256 p, bytes memory bs, uint256 sz)
internal
pure
returns (Data memory, uint)
{
Data memory r;
uint[3] memory counters;
uint256 fieldId;
ProtoBufRuntime.WireType wireType;
uint256 bytesRead;
uint256 offset = p;
uint256 pointer = p;
while (pointer < offset + sz) {
(fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs);
pointer += bytesRead;
if (fieldId == 1) {
pointer += _read_identifier(pointer, bs, r);
} else
if (fieldId == 2) {
pointer += _read_unpacked_repeated_features(pointer, bs, nil(), counters);
} else
{
pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs);
}
}
pointer = offset;
if (counters[2] > 0) {
require(r.features.length == 0);
r.features = new string[](counters[2]);
}
while (pointer < offset + sz) {
(fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs);
pointer += bytesRead;
if (fieldId == 2) {
pointer += _read_unpacked_repeated_features(pointer, bs, r, counters);
} else
{
pointer += ProtoBufRuntime._skip_field_decode(wireType, pointer, bs);
}
}
return (r, sz);
}
function _read_identifier(
uint256 p,
bytes memory bs,
Data memory r
) internal pure returns (uint) {
(string memory x, uint256 sz) = ProtoBufRuntime._decode_string(p, bs);
r.identifier = x;
return sz;
}
function _read_unpacked_repeated_features(
uint256 p,
bytes memory bs,
Data memory r,
uint[3] memory counters
) internal pure returns (uint) {
(string memory x, uint256 sz) = ProtoBufRuntime._decode_string(p, bs);
if (isNil(r)) {
counters[2] += 1;
} else {
r.features[r.features.length - counters[2]] = x;
counters[2] -= 1;
}
return sz;
}
function encode(Data memory r) internal pure returns (bytes memory) {
bytes memory bs = new bytes(_estimate(r));
uint256 sz = _encode(r, 32, bs);
assembly {
mstore(bs, sz)
}
return bs;
}
function _encode(Data memory r, uint256 p, bytes memory bs)
internal
pure
returns (uint)
{
uint256 offset = p;
uint256 pointer = p;
uint256 i;
if (bytes(r.identifier).length != 0) {
pointer += ProtoBufRuntime._encode_key(
1,
ProtoBufRuntime.WireType.LengthDelim,
pointer,
bs
);
pointer += ProtoBufRuntime._encode_string(r.identifier, pointer, bs);
}
if (r.features.length != 0) {
for(i = 0; i < r.features.length; i++) {
pointer += ProtoBufRuntime._encode_key(
2,
ProtoBufRuntime.WireType.LengthDelim,
pointer,
bs)
;
pointer += ProtoBufRuntime._encode_string(r.features[i], pointer, bs);
}
}
return pointer - offset;
}
function _encode_nested(Data memory r, uint256 p, bytes memory bs)
internal
pure
returns (uint)
{
uint256 offset = p;
uint256 pointer = p;
bytes memory tmp = new bytes(_estimate(r));
uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp);
uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs);
uint256 size = _encode(r, 32, tmp);
pointer += ProtoBufRuntime._encode_varint(size, pointer, bs);
ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size);
pointer += size;
delete tmp;
return pointer - offset;
}
function _estimate(
Data memory r
) internal pure returns (uint) {
uint256 e;uint256 i;
e += 1 + ProtoBufRuntime._sz_lendelim(bytes(r.identifier).length);
for(i = 0; i < r.features.length; i++) {
e += 1 + ProtoBufRuntime._sz_lendelim(bytes(r.features[i]).length);
}
return e;
}
function _empty(
Data memory r
) internal pure returns (bool) {
if (bytes(r.identifier).length != 0) {
return false;
}
if (r.features.length != 0) {
return false;
}
return true;
}
function store(Data memory input, Data storage output) internal {
output.identifier = input.identifier;
output.features = input.features;
}
function addFeatures(Data memory self, string memory value) internal pure {
string[] memory tmp = new string[](self.features.length + 1);
for (uint256 i = 0; i < self.features.length; i++) {
tmp[i] = self.features[i];
}
tmp[self.features.length] = value;
self.features = tmp;
}
function nil() internal pure returns (Data memory r) {
assembly {
r := 0
}
}
function isNil(Data memory x) internal pure returns (bool r) {
assembly {
r := iszero(x)
}
}
}
文件 5 的 43:Context.sol
pragma solidity ^0.8.20;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
文件 6 的 43:ERC165Checker.sol
pragma solidity ^0.8.20;
import {IERC165} from "./IERC165.sol";
library ERC165Checker {
bytes4 private constant INTERFACE_ID_INVALID = 0xffffffff;
function supportsERC165(address account) internal view returns (bool) {
return
supportsERC165InterfaceUnchecked(account, type(IERC165).interfaceId) &&
!supportsERC165InterfaceUnchecked(account, INTERFACE_ID_INVALID);
}
function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
return supportsERC165(account) && supportsERC165InterfaceUnchecked(account, interfaceId);
}
function getSupportedInterfaces(
address account,
bytes4[] memory interfaceIds
) internal view returns (bool[] memory) {
bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);
if (supportsERC165(account)) {
for (uint256 i = 0; i < interfaceIds.length; i++) {
interfaceIdsSupported[i] = supportsERC165InterfaceUnchecked(account, interfaceIds[i]);
}
}
return interfaceIdsSupported;
}
function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {
if (!supportsERC165(account)) {
return false;
}
for (uint256 i = 0; i < interfaceIds.length; i++) {
if (!supportsERC165InterfaceUnchecked(account, interfaceIds[i])) {
return false;
}
}
return true;
}
function supportsERC165InterfaceUnchecked(address account, bytes4 interfaceId) internal view returns (bool) {
bytes memory encodedParams = abi.encodeCall(IERC165.supportsInterface, (interfaceId));
bool success;
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)
returnSize := returndatasize()
returnValue := mload(0x00)
}
return success && returnSize >= 0x20 && returnValue > 0;
}
}
文件 7 的 43:GoogleProtobufAny.sol
pragma solidity ^0.8.20;
import "./ProtoBufRuntime.sol";
library GoogleProtobufAny {
struct Data {
string type_url;
bytes value;
}
function decode(bytes memory bs) internal pure returns (Data memory) {
(Data memory x, ) = _decode(32, bs, bs.length);
return x;
}
function decode(Data storage self, bytes memory bs) internal {
(Data memory x, ) = _decode(32, bs, bs.length);
store(x, self);
}
function _decode(uint256 p, bytes memory bs, uint256 sz)
internal
pure
returns (Data memory, uint)
{
Data memory r;
uint[3] memory counters;
uint256 fieldId;
ProtoBufRuntime.WireType wireType;
uint256 bytesRead;
uint256 offset = p;
uint256 pointer = p;
while (pointer < offset + sz) {
(fieldId, wireType, bytesRead) = ProtoBufRuntime._decode_key(pointer, bs);
pointer += bytesRead;
if (fieldId == 1) {
pointer += _read_type_url(pointer, bs, r, counters);
}
else if (fieldId == 2) {
pointer += _read_value(pointer, bs, r, counters);
}
else {
if (wireType == ProtoBufRuntime.WireType.Fixed64) {
uint256 size;
(, size) = ProtoBufRuntime._decode_fixed64(pointer, bs);
pointer += size;
}
if (wireType == ProtoBufRuntime.WireType.Fixed32) {
uint256 size;
(, size) = ProtoBufRuntime._decode_fixed32(pointer, bs);
pointer += size;
}
if (wireType == ProtoBufRuntime.WireType.Varint) {
uint256 size;
(, size) = ProtoBufRuntime._decode_varint(pointer, bs);
pointer += size;
}
if (wireType == ProtoBufRuntime.WireType.LengthDelim) {
uint256 size;
(, size) = ProtoBufRuntime._decode_lendelim(pointer, bs);
pointer += size;
}
}
}
return (r, sz);
}
function _read_type_url(
uint256 p,
bytes memory bs,
Data memory r,
uint[3] memory counters
) internal pure returns (uint) {
(string memory x, uint256 sz) = ProtoBufRuntime._decode_string(p, bs);
if (isNil(r)) {
counters[1] += 1;
} else {
r.type_url = x;
if (counters[1] > 0) counters[1] -= 1;
}
return sz;
}
function _read_value(
uint256 p,
bytes memory bs,
Data memory r,
uint[3] memory counters
) internal pure returns (uint) {
(bytes memory x, uint256 sz) = ProtoBufRuntime._decode_bytes(p, bs);
if (isNil(r)) {
counters[2] += 1;
} else {
r.value = x;
if (counters[2] > 0) counters[2] -= 1;
}
return sz;
}
function encode(Data memory r) internal pure returns (bytes memory) {
bytes memory bs = new bytes(_estimate(r));
uint256 sz = _encode(r, 32, bs);
assembly {
mstore(bs, sz)
}
return bs;
}
function _encode(Data memory r, uint256 p, bytes memory bs)
internal
pure
returns (uint)
{
uint256 offset = p;
uint256 pointer = p;
pointer += ProtoBufRuntime._encode_key(
1,
ProtoBufRuntime.WireType.LengthDelim,
pointer,
bs
);
pointer += ProtoBufRuntime._encode_string(r.type_url, pointer, bs);
pointer += ProtoBufRuntime._encode_key(
2,
ProtoBufRuntime.WireType.LengthDelim,
pointer,
bs
);
pointer += ProtoBufRuntime._encode_bytes(r.value, pointer, bs);
return pointer - offset;
}
function _encode_nested(Data memory r, uint256 p, bytes memory bs)
internal
pure
returns (uint)
{
uint256 offset = p;
uint256 pointer = p;
bytes memory tmp = new bytes(_estimate(r));
uint256 tmpAddr = ProtoBufRuntime.getMemoryAddress(tmp);
uint256 bsAddr = ProtoBufRuntime.getMemoryAddress(bs);
uint256 size = _encode(r, 32, tmp);
pointer += ProtoBufRuntime._encode_varint(size, pointer, bs);
ProtoBufRuntime.copyBytes(tmpAddr + 32, bsAddr + pointer, size);
pointer += size;
delete tmp;
return pointer - offset;
}
function _estimate(
Data memory r
) internal pure returns (uint) {
uint256 e;
e += 1 + ProtoBufRuntime._sz_lendelim(bytes(r.type_url).length);
e += 1 + ProtoBufRuntime._sz_lendelim(r.value.length);
return e;
}
function store(Data memory input, Data storage output) internal {
output.type_url = input.type_url;
output.value = input.value;
}
function nil() internal pure returns (Data memory r) {
assembly {
r := 0
}
}
function isNil(Data memory x) internal pure returns (bool r) {
assembly {
r := iszero(x)
}
}
}
文件 8 的 43:IBCChannelLib.sol
pragma solidity ^0.8.20;
import {Channel} from "../../proto/Channel.sol";
import {IIBCChannelErrors} from "./IIBCChannelErrors.sol";
library IBCChannelLib {
enum PacketReceipt {
NONE,
SUCCESSFUL
}
string internal constant ORDER_UNORDERED = "ORDER_UNORDERED";
string internal constant ORDER_ORDERED = "ORDER_ORDERED";
bytes32 internal constant PACKET_RECEIPT_SUCCESSFUL_KECCAK256 =
keccak256(abi.encodePacked(PacketReceipt.SUCCESSFUL));
function receiptCommitmentToReceipt(bytes32 commitment) internal pure returns (PacketReceipt) {
if (commitment == bytes32(0)) {
return PacketReceipt.NONE;
} else if (commitment == PACKET_RECEIPT_SUCCESSFUL_KECCAK256) {
return PacketReceipt.SUCCESSFUL;
} else {
revert IIBCChannelErrors.IBCChannelUnknownPacketReceiptCommitment(commitment);
}
}
function buildConnectionHops(string memory connectionId) internal pure returns (string[] memory hops) {
hops = new string[](1);
hops[0] = connectionId;
return hops;
}
function toString(Channel.Order order) internal pure returns (string memory) {
if (order == Channel.Order.ORDER_UNORDERED) {
return ORDER_UNORDERED;
} else if (order == Channel.Order.ORDER_ORDERED) {
return ORDER_ORDERED;
} else {
revert IIBCChannelErrors.IBCChannelUnknownChannelOrder(order);
}
}
function uint64ToBigEndianBytes(uint64 v) internal pure returns (bytes memory) {
return abi.encodePacked(bytes8(v));
}
}
文件 9 的 43:IBCClientConnectionChannelHandler.sol
pragma solidity ^0.8.20;
import {Height} from "../../proto/Client.sol";
import {IIBCClient} from "../02-client/IIBCClient.sol";
import {IIBCConnection} from "../03-connection/IIBCConnection.sol";
import {
IIBCChannelHandshake, IIBCChannelPacketSendRecv, IIBCChannelPacketTimeout
} from "../04-channel/IIBCChannel.sol";
import {
IIBCChannelUpgrade,
IIBCChannelUpgradeInitTryAck,
IIBCChannelUpgradeConfirmOpenTimeoutCancel
} from "../04-channel/IIBCChannelUpgrade.sol";
interface IBCHandlerViewFunctionWrapper {
function wrappedRouteUpdateClient(IIBCClient.MsgUpdateClient calldata msg_)
external
view
returns (address, bytes4, bytes memory);
}
abstract contract IBCClientConnectionChannelHandler is
IIBCClient,
IIBCConnection,
IIBCChannelHandshake,
IIBCChannelPacketSendRecv,
IIBCChannelPacketTimeout,
IIBCChannelUpgrade
{
address internal immutable ibcClient;
address internal immutable ibcConnection;
address internal immutable ibcChannelHandshake;
address internal immutable ibcChannelPacketSendRecv;
address internal immutable ibcChannelPacketTimeout;
address internal immutable ibcChannelUpgradeInitTryAck;
address internal immutable ibcChannelUpgradeConfirmOpenTimeoutCancel;
constructor(
IIBCClient ibcClient_,
IIBCConnection ibcConnection_,
IIBCChannelHandshake ibcChannelHandshake_,
IIBCChannelPacketSendRecv ibcChannelPacketSendRecv_,
IIBCChannelPacketTimeout ibcChannelPacketTimeout_,
IIBCChannelUpgradeInitTryAck ibcChannelUpgradeInitTryAck_,
IIBCChannelUpgradeConfirmOpenTimeoutCancel ibcChannelUpgradeConfirmOpenTimeoutCancel_
) {
ibcClient = address(ibcClient_);
ibcConnection = address(ibcConnection_);
ibcChannelHandshake = address(ibcChannelHandshake_);
ibcChannelPacketSendRecv = address(ibcChannelPacketSendRecv_);
ibcChannelPacketTimeout = address(ibcChannelPacketTimeout_);
ibcChannelUpgradeInitTryAck = address(ibcChannelUpgradeInitTryAck_);
ibcChannelUpgradeConfirmOpenTimeoutCancel = address(ibcChannelUpgradeConfirmOpenTimeoutCancel_);
}
function createClient(MsgCreateClient calldata) external returns (string memory) {
doFallback(ibcClient);
}
function updateClient(MsgUpdateClient calldata) external {
doFallback(ibcClient);
}
function updateClientCommitments(string calldata, Height.Data[] calldata) external {
doFallback(ibcClient);
}
function routeUpdateClient(MsgUpdateClient calldata msg_) external view returns (address, bytes4, bytes memory) {
return IBCHandlerViewFunctionWrapper(address(this)).wrappedRouteUpdateClient(msg_);
}
function wrappedRouteUpdateClient(MsgUpdateClient calldata msg_) public returns (address, bytes4, bytes memory) {
(bool success, bytes memory returndata) =
address(ibcClient).delegatecall(abi.encodeWithSelector(IIBCClient.routeUpdateClient.selector, msg_));
if (!success) {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert("routeUpdateClient failed");
}
}
return abi.decode(returndata, (address, bytes4, bytes));
}
function connectionOpenInit(IIBCConnection.MsgConnectionOpenInit calldata) external returns (string memory) {
doFallback(ibcConnection);
}
function connectionOpenTry(IIBCConnection.MsgConnectionOpenTry calldata) external returns (string memory) {
doFallback(ibcConnection);
}
function connectionOpenAck(IIBCConnection.MsgConnectionOpenAck calldata) external {
doFallback(ibcConnection);
}
function connectionOpenConfirm(IIBCConnection.MsgConnectionOpenConfirm calldata) external {
doFallback(ibcConnection);
}
function channelOpenInit(IIBCChannelHandshake.MsgChannelOpenInit calldata)
external
returns (string memory, string memory)
{
doFallback(ibcChannelHandshake);
}
function channelOpenTry(IIBCChannelHandshake.MsgChannelOpenTry calldata)
external
returns (string memory, string memory)
{
doFallback(ibcChannelHandshake);
}
function channelOpenAck(IIBCChannelHandshake.MsgChannelOpenAck calldata) external {
doFallback(ibcChannelHandshake);
}
function channelOpenConfirm(IIBCChannelHandshake.MsgChannelOpenConfirm calldata) external {
doFallback(ibcChannelHandshake);
}
function channelCloseInit(IIBCChannelHandshake.MsgChannelCloseInit calldata) external {
doFallback(ibcChannelHandshake);
}
function channelCloseConfirm(IIBCChannelHandshake.MsgChannelCloseConfirm calldata) external {
doFallback(ibcChannelHandshake);
}
function sendPacket(string calldata, string calldata, Height.Data calldata, uint64, bytes calldata)
external
returns (uint64)
{
doFallback(ibcChannelPacketSendRecv);
}
function writeAcknowledgement(string calldata, string calldata, uint64, bytes calldata) external {
doFallback(ibcChannelPacketSendRecv);
}
function recvPacket(MsgPacketRecv calldata) external {
doFallback(ibcChannelPacketSendRecv);
}
function acknowledgePacket(MsgPacketAcknowledgement calldata) external {
doFallback(ibcChannelPacketSendRecv);
}
function timeoutPacket(MsgTimeoutPacket calldata) external {
doFallback(ibcChannelPacketTimeout);
}
function timeoutOnClose(MsgTimeoutOnClose calldata) external {
doFallback(ibcChannelPacketTimeout);
}
function channelUpgradeInit(MsgChannelUpgradeInit calldata) external returns (uint64) {
doFallback(ibcChannelUpgradeInitTryAck);
}
function channelUpgradeTry(MsgChannelUpgradeTry calldata) external returns (bool, uint64) {
doFallback(ibcChannelUpgradeInitTryAck);
}
function channelUpgradeAck(MsgChannelUpgradeAck calldata) external returns (bool) {
doFallback(ibcChannelUpgradeInitTryAck);
}
function channelUpgradeConfirm(MsgChannelUpgradeConfirm calldata) external returns (bool) {
doFallback(ibcChannelUpgradeConfirmOpenTimeoutCancel);
}
function channelUpgradeOpen(MsgChannelUpgradeOpen calldata) external {
doFallback(ibcChannelUpgradeConfirmOpenTimeoutCancel);
}
function cancelChannelUpgrade(MsgCancelChannelUpgrade calldata) external {
doFallback(ibcChannelUpgradeConfirmOpenTimeoutCancel);
}
function timeoutChannelUpgrade(MsgTimeoutChannelUpgrade calldata) external {
doFallback(ibcChannelUpgradeConfirmOpenTimeoutCancel);
}
function doFallback(address impl) internal virtual {
assembly {
calldatacopy(0, 0, calldatasize())
let result := delegatecall(gas(), impl, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
switch result
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
}
文件 10 的 43:IBCClientLib.sol
pragma solidity ^0.8.20;
library IBCClientLib {
function validateClientType(bytes memory clientTypeBytes) internal pure returns (bool) {
uint256 byteLength = clientTypeBytes.length;
if (byteLength == 0) {
return false;
}
for (uint256 i = 0; i < byteLength; i++) {
uint256 c = uint256(uint8(clientTypeBytes[i]));
if (0x61 <= c && c <= 0x7a) {
continue;
} else if (c == 0x2d) {
unchecked {
if (i == 0 || i == byteLength - 1) {
return false;
}
}
continue;
} else if (0x30 <= c && c <= 0x39) {
continue;
} else {
return false;
}
}
return true;
}
}
文件 11 的 43:IBCCommitment.sol
pragma solidity ^0.8.20;
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
library IBCCommitment {
function clientStatePath(string memory clientId) internal pure returns (bytes memory) {
return abi.encodePacked("clients/", clientId, "/clientState");
}
function consensusStatePath(string memory clientId, uint64 revisionNumber, uint64 revisionHeight)
internal
pure
returns (bytes memory)
{
return abi.encodePacked(
"clients/",
clientId,
"/consensusStates/",
Strings.toString(revisionNumber),
"-",
Strings.toString(revisionHeight)
);
}
function connectionPath(string memory connectionId) internal pure returns (bytes memory) {
return abi.encodePacked("connections/", connectionId);
}
function channelPath(string memory portId, string memory channelId) internal pure returns (bytes memory) {
return abi.encodePacked("channelEnds/ports/", portId, "/channels/", channelId);
}
function packetCommitmentPathCalldata(string calldata portId, string calldata channelId, uint64 sequence)
internal
pure
returns (bytes memory)
{
return abi.encodePacked(
"commitments/ports/", portId, "/channels/", channelId, "/sequences/", Strings.toString(sequence)
);
}
function packetAcknowledgementCommitmentPathCalldata(
string calldata portId,
string calldata channelId,
uint64 sequence
) internal pure returns (bytes memory) {
return
abi.encodePacked("acks/ports/", portId, "/channels/", channelId, "/sequences/", Strings.toString(sequence));
}
function packetReceiptCommitmentPathCalldata(string calldata portId, string calldata channelId, uint64 sequence)
internal
pure
returns (bytes memory)
{
return abi.encodePacked(
"receipts/ports/", portId, "/channels/", channelId, "/sequences/", Strings.toString(sequence)
);
}
function nextSequenceRecvCommitmentPath(string memory portId, string memory channelId)
internal
pure
returns (bytes memory)
{
return abi.encodePacked("nextSequenceRecv/ports/", portId, "/channels/", channelId);
}
function nextSequenceRecvCommitmentPathCalldata(string calldata portId, string calldata channelId)
internal
pure
returns (bytes memory)
{
return abi.encodePacked("nextSequenceRecv/ports/", portId, "/channels/", channelId);
}
function channelUpgradePath(string memory portId, string memory channelId) internal pure returns (bytes memory) {
return abi.encodePacked("channelUpgrades/upgrades/ports/", portId, "/channels/", channelId);
}
function channelUpgradeErrorPath(string memory portId, string memory channelId)
internal
pure
returns (bytes memory)
{
return abi.encodePacked("channelUpgrades/upgradeError/ports/", portId, "/channels/", channelId);
}
function clientStateCommitmentKey(string memory clientId) internal pure returns (bytes32) {
return keccak256(clientStatePath(clientId));
}
function consensusStateCommitmentKey(string memory clientId, uint64 revisionNumber, uint64 revisionHeight)
internal
pure
returns (bytes32)
{
return keccak256(consensusStatePath(clientId, revisionNumber, revisionHeight));
}
function connectionCommitmentKey(string memory connectionId) internal pure returns (bytes32) {
return keccak256(connectionPath(connectionId));
}
function channelCommitmentKey(string memory portId, string memory channelId) internal pure returns (bytes32) {
return keccak256(channelPath(portId, channelId));
}
function nextSequenceRecvCommitmentKey(string memory portId, string memory channelId)
internal
pure
returns (bytes32)
{
return keccak256(nextSequenceRecvCommitmentPath(portId, channelId));
}
function packetCommitmentKeyCalldata(string calldata portId, string calldata channelId, uint64 sequence)
internal
pure
returns (bytes32)
{
return keccak256(packetCommitmentPathCalldata(portId, channelId, sequence));
}
function packetAcknowledgementCommitmentKeyCalldata(
string calldata portId,
string calldata channelId,
uint64 sequence
) internal pure returns (bytes32) {
return keccak256(packetAcknowledgementCommitmentPathCalldata(portId, channelId, sequence));
}
function packetReceiptCommitmentKeyCalldata(string calldata portId, string calldata channelId, uint64 sequence)
internal
pure
returns (bytes32)
{
return keccak256(packetReceiptCommitmentPathCalldata(portId, channelId, sequence));
}
function nextSequenceRecvCommitmentKeyCalldata(string calldata portId, string calldata channelId)
internal
pure
returns (bytes32)
{
return keccak256(nextSequenceRecvCommitmentPathCalldata(portId, channelId));
}
function channelUpgradeCommitmentKey(string memory portId, string memory channelId)
internal
pure
returns (bytes32)
{
return keccak256(channelUpgradePath(portId, channelId));
}
function channelUpgradeErrorCommitmentKey(string memory portId, string memory channelId)
internal
pure
returns (bytes32)
{
return keccak256(channelUpgradeErrorPath(portId, channelId));
}
}
文件 12 的 43:IBCHandler.sol
pragma solidity ^0.8.20;
import {IIBCClient} from "../02-client/IIBCClient.sol";
import {IIBCConnection} from "../03-connection/IIBCConnection.sol";
import {
IIBCChannelHandshake, IIBCChannelPacketSendRecv, IIBCChannelPacketTimeout
} from "../04-channel/IIBCChannel.sol";
import {
IIBCChannelUpgradeInitTryAck,
IIBCChannelUpgradeConfirmOpenTimeoutCancel
} from "../04-channel/IIBCChannelUpgrade.sol";
import {IBCHostConfigurator} from "../24-host/IBCHostConfigurator.sol";
import {IBCClientConnectionChannelHandler} from "./IBCClientConnectionChannelHandler.sol";
import {IBCQuerier} from "./IBCQuerier.sol";
import {IIBCHandler} from "./IIBCHandler.sol";
abstract contract IBCHandler is IBCHostConfigurator, IBCClientConnectionChannelHandler, IBCQuerier, IIBCHandler {
constructor(
IIBCClient ibcClient_,
IIBCConnection ibcConnection_,
IIBCChannelHandshake ibcChannelHandshake_,
IIBCChannelPacketSendRecv ibcChannelPacketSendRecv_,
IIBCChannelPacketTimeout ibcChannelPacketTimeout_,
IIBCChannelUpgradeInitTryAck ibcChannelUpgradeInitTryAck_,
IIBCChannelUpgradeConfirmOpenTimeoutCancel ibcChannelUpgradeConfirmOpenTimeoutCancel_
)
IBCClientConnectionChannelHandler(
ibcClient_,
ibcConnection_,
ibcChannelHandshake_,
ibcChannelPacketSendRecv_,
ibcChannelPacketTimeout_,
ibcChannelUpgradeInitTryAck_,
ibcChannelUpgradeConfirmOpenTimeoutCancel_
)
{}
}
文件 13 的 43:IBCHost.sol
pragma solidity ^0.8.20;
import {ILightClient} from "../02-client/ILightClient.sol";
import {IIBCClientErrors} from "../02-client/IIBCClientErrors.sol";
import {IBCStore} from "./IBCStore.sol";
import {IIBCHostErrors} from "./IIBCHostErrors.sol";
contract IBCHost is IBCStore, IIBCHostErrors {
bytes internal constant DEFAULT_COMMITMENT_PREFIX = bytes("ibc");
function hostTimestamp() internal view virtual returns (uint64) {
return uint64(block.timestamp) * 1e9;
}
function checkAndGetClient(string memory clientId) internal view returns (ILightClient) {
address clientImpl = getClientStorage()[clientId].clientImpl;
if (clientImpl == address(0)) {
revert IIBCClientErrors.IBCClientClientNotFound(clientId);
}
return ILightClient(clientImpl);
}
function _getCommitmentPrefix() internal view virtual returns (bytes memory) {
return DEFAULT_COMMITMENT_PREFIX;
}
}
文件 14 的 43:IBCHostConfigurator.sol
pragma solidity ^0.8.20;
import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
import {IBCClientLib} from "../02-client/IBCClientLib.sol";
import {ILightClient} from "../02-client/ILightClient.sol";
import {IBCHostLib} from "./IBCHostLib.sol";
import {IBCModuleManager} from "../26-router/IBCModuleManager.sol";
import {IIBCModule, IIBCModuleInitializer} from "../26-router/IIBCModule.sol";
import {IIBCHostConfigurator} from "./IIBCHostConfigurator.sol";
abstract contract IBCHostConfigurator is IIBCHostConfigurator, IBCModuleManager {
function _setExpectedTimePerBlock(uint64 expectedTimePerBlock_) internal virtual {
getHostStorage().expectedTimePerBlock = expectedTimePerBlock_;
}
function _registerClient(string calldata clientType, ILightClient client) internal virtual {
HostStorage storage hostStorage = getHostStorage();
if (!IBCClientLib.validateClientType(bytes(clientType))) {
revert IBCHostInvalidClientType(clientType);
} else if (address(hostStorage.clientRegistry[clientType]) != address(0)) {
revert IBCHostClientTypeAlreadyExists(clientType);
}
if (address(client) == address(0) || address(client) == address(this)) {
revert IBCHostInvalidLightClientAddress(address(client));
}
hostStorage.clientRegistry[clientType] = address(client);
}
function _bindPort(string calldata portId, IIBCModuleInitializer module) internal virtual {
address moduleAddress = address(module);
if (!IBCHostLib.validatePortIdentifier(bytes(portId))) {
revert IBCHostInvalidPortIdentifier(portId);
}
if (moduleAddress == address(0) || moduleAddress == address(this)) {
revert IBCHostInvalidModuleAddress(moduleAddress);
}
if (!ERC165Checker.supportsERC165(moduleAddress)) {
revert IBCHostModuleDoesNotSupportERC165();
}
if (
!(
ERC165Checker.supportsERC165InterfaceUnchecked(moduleAddress, type(IIBCModule).interfaceId)
|| ERC165Checker.supportsERC165InterfaceUnchecked(
moduleAddress, type(IIBCModuleInitializer).interfaceId
)
)
) {
revert IBCHostModuleDoesNotSupportIIBCModuleInitializer(
moduleAddress, type(IIBCModuleInitializer).interfaceId
);
}
claimPortCapability(portId, moduleAddress);
}
}
文件 15 的 43:IBCHostLib.sol
pragma solidity ^0.8.20;
library IBCHostLib {
function validatePortIdentifier(bytes memory portId) internal pure returns (bool) {
uint256 portIdLength = portId.length;
if (portIdLength < 2 || portIdLength > 128) {
return false;
}
for (uint256 i = 0; i < portIdLength; i++) {
uint256 c = uint256(uint8(portId[i]));
if (
!(c >= 0x61 && c <= 0x7A) && !(c >= 0x30 && c <= 0x39) && !(c >= 0x41 && c <= 0x5A)
&& !(c == 0x2E || c == 0x5F || c == 0x2B || c == 0x2D)
&& !(c == 0x23 || c == 0x5B || c == 0x5D || c == 0x3C || c == 0x3E)
) {
return false;
}
}
return true;
}
}
文件 16 的 43:IBCModuleManager.sol
pragma solidity ^0.8.20;
import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
import {Context} from "@openzeppelin/contracts/utils/Context.sol";
import {IBCHost} from "../24-host/IBCHost.sol";
import {Channel} from "../../proto/Channel.sol";
import {IIBCModule, IIBCModuleInitializer} from "./IIBCModule.sol";
import {IIBCModuleUpgrade} from "./IIBCModuleUpgrade.sol";
import {IIBCModuleManager} from "./IIBCModuleManager.sol";
contract IBCModuleManager is Context, IBCHost, IIBCModuleManager {
function claimPortCapability(string calldata portId, address module) internal {
HostStorage storage hostStorage = getHostStorage();
if (hostStorage.portCapabilities[portId] != address(0)) {
revert IBCHostPortCapabilityAlreadyClaimed(portId);
}
if (module == address(0)) {
revert IBCHostInvalidModuleAddress(module);
}
if (!ERC165Checker.supportsERC165(module)) {
revert IBCHostModuleDoesNotSupportERC165();
}
if (
!(
ERC165Checker.supportsERC165InterfaceUnchecked(module, type(IIBCModule).interfaceId)
|| ERC165Checker.supportsERC165InterfaceUnchecked(module, type(IIBCModuleInitializer).interfaceId)
)
) {
revert IBCHostModuleDoesNotSupportIIBCModuleInitializer(module, type(IIBCModuleInitializer).interfaceId);
}
hostStorage.portCapabilities[portId] = module;
emit IBCModuleManagerPortCapabilityClaimed(portId, module);
}
function claimChannelCapability(string calldata portId, string memory channelId, address module) internal {
HostStorage storage hostStorage = getHostStorage();
if (hostStorage.channelCapabilities[portId][channelId] != address(0)) {
revert IBCHostChannelCapabilityAlreadyClaimed(portId, channelId);
}
if (module == address(0)) {
revert IBCHostInvalidModuleAddress(module);
}
if (!ERC165Checker.supportsERC165(module)) {
revert IBCHostModuleDoesNotSupportERC165();
}
if (!ERC165Checker.supportsERC165InterfaceUnchecked(module, type(IIBCModule).interfaceId)) {
revert IBCHostModuleDoesNotSupportIIBCModule(module, type(IIBCModule).interfaceId);
}
hostStorage.channelCapabilities[portId][channelId] = module;
emit IBCModuleManagerChannelCapabilityClaimed(portId, channelId, module);
}
function authenticateChannelCapability(string calldata portId, string calldata channelId) internal view {
address msgSender = _msgSender();
if (getHostStorage().channelCapabilities[portId][channelId] != msgSender) {
revert IBCHostFailedAuthenticateChannelCapability(portId, channelId, msgSender);
}
}
function lookupModuleByPort(string calldata portId) internal view virtual returns (IIBCModuleInitializer) {
address module = getHostStorage().portCapabilities[portId];
if (module == address(0)) {
revert IBCHostModulePortNotFound(portId);
}
return IIBCModuleInitializer(module);
}
function lookupModuleByChannel(string calldata portId, string calldata channelId)
internal
view
virtual
returns (IIBCModule)
{
address module = getHostStorage().channelCapabilities[portId][channelId];
if (module == address(0)) {
revert IBCHostModuleChannelNotFound(portId, channelId);
}
return IIBCModule(module);
}
function lookupUpgradableModuleUnchecked(string calldata portId, string calldata channelId)
internal
view
returns (IIBCModuleUpgrade)
{
return IIBCModuleUpgrade(address(lookupModuleByChannel(portId, channelId)));
}
function lookupUpgradableModule(string calldata portId, string calldata channelId)
internal
view
returns (IIBCModuleUpgrade)
{
IIBCModule module = lookupModuleByChannel(portId, channelId);
if (!module.supportsInterface(type(IIBCModuleUpgrade).interfaceId)) {
revert IBCHostModuleDoesNotSupportIIBCModuleUpgrade(address(module));
}
return IIBCModuleUpgrade(address(module));
}
function canTransitionToFlushComplete(
Channel.Order ordering,
string calldata portId,
string calldata channelId,
uint64 upgradeSequence
) internal view virtual returns (bool) {
if (ordering == Channel.Order.ORDER_ORDERED) {
ChannelStorage storage channelStorage = getChannelStorage()[portId][channelId];
if (channelStorage.nextSequenceSend == channelStorage.nextSequenceAck) {
return true;
}
}
return lookupUpgradableModuleUnchecked(portId, channelId).canTransitionToFlushComplete(
portId, channelId, upgradeSequence, _msgSender()
);
}
}
文件 17 的 43:IBCQuerier.sol
pragma solidity ^0.8.20;
import {Height} from "../../proto/Client.sol";
import {ConnectionEnd} from "../../proto/Connection.sol";
import {Channel, Upgrade} from "../../proto/Channel.sol";
import {IBCChannelLib} from "../04-channel/IBCChannelLib.sol";
import {IBCCommitment} from "../24-host/IBCCommitment.sol";
import {IIBCModule, IIBCModuleInitializer} from "../26-router/IIBCModule.sol";
import {IBCModuleManager} from "../26-router/IBCModuleManager.sol";
import {IIBCQuerier} from "./IIBCQuerier.sol";
contract IBCQuerier is IBCModuleManager, IIBCQuerier {
function getCommitmentPrefix() public view override returns (bytes memory) {
return _getCommitmentPrefix();
}
function getCommitmentsSlot() public pure override returns (bytes32) {
return COMMITMENT_STORAGE_LOCATION;
}
function getCommitment(bytes32 hashedPath) public view override returns (bytes32) {
return getCommitments()[hashedPath];
}
function getExpectedTimePerBlock() public view override returns (uint64) {
return getHostStorage().expectedTimePerBlock;
}
function getIBCModuleByPort(string calldata portId) public view override returns (IIBCModuleInitializer) {
return lookupModuleByPort(portId);
}
function getIBCModuleByChannel(string calldata portId, string calldata channelId)
public
view
override
returns (IIBCModule)
{
return lookupModuleByChannel(portId, channelId);
}
function getClientByType(string calldata clientType) public view override returns (address) {
return getHostStorage().clientRegistry[clientType];
}
function getClientType(string calldata clientId) public view override returns (string memory) {
return getClientStorage()[clientId].clientType;
}
function getClient(string calldata clientId) public view override returns (address) {
return getClientStorage()[clientId].clientImpl;
}
function getClientState(string calldata clientId) public view override returns (bytes memory, bool) {
return checkAndGetClient(clientId).getClientState(clientId);
}
function getConsensusState(string calldata clientId, Height.Data calldata height)
public
view
override
returns (bytes memory consensusStateBytes, bool)
{
return checkAndGetClient(clientId).getConsensusState(clientId, height);
}
function getConnection(string calldata connectionId)
public
view
override
returns (ConnectionEnd.Data memory, bool)
{
ConnectionEnd.Data storage connection = getConnectionStorage()[connectionId].connection;
return (connection, connection.state != ConnectionEnd.State.STATE_UNINITIALIZED_UNSPECIFIED);
}
function getChannel(string calldata portId, string calldata channelId)
public
view
override
returns (Channel.Data memory, bool)
{
Channel.Data storage channel = getChannelStorage()[portId][channelId].channel;
return (channel, channel.state != Channel.State.STATE_UNINITIALIZED_UNSPECIFIED);
}
function getNextSequenceSend(string calldata portId, string calldata channelId)
public
view
override
returns (uint64)
{
return getChannelStorage()[portId][channelId].nextSequenceSend;
}
function getNextSequenceRecv(string calldata portId, string calldata channelId)
public
view
override
returns (uint64)
{
return getChannelStorage()[portId][channelId].nextSequenceRecv;
}
function getNextSequenceAck(string calldata portId, string calldata channelId)
public
view
override
returns (uint64)
{
return getChannelStorage()[portId][channelId].nextSequenceAck;
}
function getPacketReceipt(string calldata portId, string calldata channelId, uint64 sequence)
public
view
override
returns (IBCChannelLib.PacketReceipt)
{
return IBCChannelLib.receiptCommitmentToReceipt(
getCommitments()[IBCCommitment.packetReceiptCommitmentKeyCalldata(portId, channelId, sequence)]
);
}
function getChannelUpgrade(string calldata portId, string calldata channelId)
public
view
override
returns (Upgrade.Data memory, bool)
{
Upgrade.Data storage upgrade = getChannelStorage()[portId][channelId].upgrade;
return (upgrade, upgrade.fields.connection_hops.length != 0);
}
function getCanTransitionToFlushComplete(string calldata portId, string calldata channelId)
public
view
override
returns (bool)
{
Channel.Data storage channel = getChannelStorage()[portId][channelId].channel;
if (channel.state != Channel.State.STATE_FLUSHING) {
return false;
}
return canTransitionToFlushComplete(channel.ordering, portId, channelId, channel.upgrade_sequence);
}
}
文件 18 的 43:IBCStore.sol
pragma solidity ^0.8.20;
import {ConnectionEnd} from "../../proto/Connection.sol";
import {Channel, Upgrade} from "../../proto/Channel.sol";
abstract contract IBCStore {
bytes32 internal constant COMMITMENT_STORAGE_LOCATION =
0x1ee222554989dda120e26ecacf756fe1235cd8d726706b57517715dde4f0c900;
bytes32 internal constant HOST_STORAGE_LOCATION = 0x74277c96171a830beeb656543654929b9b37cec88976b4c31924799951550500;
bytes32 internal constant CLIENT_STORAGE_LOCATION =
0x521e6acb905d37b69880078e1a941104ad5d8bcb8c5cf52f1d5f47d31739d500;
bytes32 internal constant CONNECTION_STORAGE_LOCATION =
0x9ef02a9acd7179d999aa130fa65a34ac06dd2f1bae667ae0fb55000408793800;
bytes32 internal constant CHANNEL_STORAGE_LOCATION =
0x1952ed347963c5b7b1856335782fc9c26716d4219254baf3dfc6b26981b2dc00;
struct CommitmentStorage {
mapping(bytes32 => bytes32) commitments;
}
struct HostStorage {
mapping(string => address) clientRegistry;
mapping(string => address) portCapabilities;
mapping(string => mapping(string => address)) channelCapabilities;
uint64 nextClientSequence;
uint64 nextConnectionSequence;
uint64 nextChannelSequence;
uint64 expectedTimePerBlock;
}
struct ClientStorage {
string clientType;
address clientImpl;
}
struct ConnectionStorage {
ConnectionEnd.Data connection;
}
struct RecvStartSequence {
uint64 sequence;
uint64 prevSequence;
}
struct ChannelStorage {
Channel.Data channel;
uint64 nextSequenceSend;
uint64 nextSequenceRecv;
uint64 nextSequenceAck;
Upgrade.Data upgrade;
uint64 latestErrorReceiptSequence;
RecvStartSequence recvStartSequence;
uint64 ackStartSequence;
}
function getCommitments() internal pure returns (mapping(bytes32 => bytes32) storage $) {
assembly {
$.slot := COMMITMENT_STORAGE_LOCATION
}
}
function getHostStorage() internal pure returns (HostStorage storage $) {
assembly {
$.slot := HOST_STORAGE_LOCATION
}
}
function getClientStorage() internal pure returns (mapping(string => ClientStorage) storage $) {
assembly {
$.slot := CLIENT_STORAGE_LOCATION
}
}
function getConnectionStorage() internal pure returns (mapping(string => ConnectionStorage) storage $) {
assembly {
$.slot := CONNECTION_STORAGE_LOCATION
}
}
function getChannelStorage()
internal
pure
returns (mapping(string => mapping(string => ChannelStorage)) storage $)
{
assembly {
$.slot := CHANNEL_STORAGE_LOCATION
}
}
}
文件 19 的 43:IERC165.sol
pragma solidity ^0.8.20;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 20 的 43:IIBCChannel.sol
pragma solidity ^0.8.20;
import {Height} from "../../proto/Client.sol";
import {Channel} from "../../proto/Channel.sol";
struct Packet {
uint64 sequence;
string sourcePort;
string sourceChannel;
string destinationPort;
string destinationChannel;
bytes data;
Height.Data timeoutHeight;
uint64 timeoutTimestamp;
}
interface IIBCChannelHandshake {
struct MsgChannelOpenInit {
string portId;
Channel.Data channel;
}
struct MsgChannelOpenTry {
string portId;
Channel.Data channel;
string counterpartyVersion;
bytes proofInit;
Height.Data proofHeight;
}
struct MsgChannelOpenAck {
string portId;
string channelId;
string counterpartyVersion;
string counterpartyChannelId;
bytes proofTry;
Height.Data proofHeight;
}
struct MsgChannelOpenConfirm {
string portId;
string channelId;
bytes proofAck;
Height.Data proofHeight;
}
struct MsgChannelCloseInit {
string portId;
string channelId;
}
struct MsgChannelCloseConfirm {
string portId;
string channelId;
bytes proofInit;
Height.Data proofHeight;
}
event GeneratedChannelIdentifier(string channelId);
function channelOpenInit(MsgChannelOpenInit calldata msg_)
external
returns (string memory channelId, string memory version);
function channelOpenTry(MsgChannelOpenTry calldata msg_)
external
returns (string memory channelId, string memory version);
function channelOpenAck(MsgChannelOpenAck calldata msg_) external;
function channelOpenConfirm(MsgChannelOpenConfirm calldata msg_) external;
function channelCloseInit(MsgChannelCloseInit calldata msg_) external;
function channelCloseConfirm(MsgChannelCloseConfirm calldata msg_) external;
}
interface IICS04SendPacket {
event SendPacket(
uint64 sequence,
string sourcePort,
string sourceChannel,
Height.Data timeoutHeight,
uint64 timeoutTimestamp,
bytes data
);
function sendPacket(
string calldata sourcePort,
string calldata sourceChannel,
Height.Data calldata timeoutHeight,
uint64 timeoutTimestamp,
bytes calldata data
) external returns (uint64);
}
interface IICS04WriteAcknowledgement {
event WriteAcknowledgement(
string destinationPortId, string destinationChannel, uint64 sequence, bytes acknowledgement
);
function writeAcknowledgement(
string calldata destinationPortId,
string calldata destinationChannel,
uint64 sequence,
bytes calldata acknowledgement
) external;
}
interface IIBCChannelRecvPacket {
struct MsgPacketRecv {
Packet packet;
bytes proof;
Height.Data proofHeight;
}
event RecvPacket(Packet packet);
function recvPacket(MsgPacketRecv calldata msg_) external;
}
interface IIBCChannelAcknowledgePacket {
struct MsgPacketAcknowledgement {
Packet packet;
bytes acknowledgement;
bytes proof;
Height.Data proofHeight;
}
event AcknowledgePacket(Packet packet, bytes acknowledgement);
function acknowledgePacket(MsgPacketAcknowledgement calldata msg_) external;
}
interface IIBCChannelPacketTimeout {
struct MsgTimeoutPacket {
Packet packet;
bytes proof;
Height.Data proofHeight;
uint64 nextSequenceRecv;
}
struct MsgTimeoutOnClose {
Packet packet;
bytes proofUnreceived;
bytes proofClose;
Height.Data proofHeight;
uint64 nextSequenceRecv;
uint64 counterpartyUpgradeSequence;
}
event TimeoutPacket(Packet packet);
function timeoutPacket(MsgTimeoutPacket calldata msg_) external;
function timeoutOnClose(MsgTimeoutOnClose calldata msg_) external;
}
interface IICS04Wrapper is IICS04SendPacket, IICS04WriteAcknowledgement {}
interface IIBCChannelPacketSendRecv is IICS04Wrapper, IIBCChannelRecvPacket, IIBCChannelAcknowledgePacket {}
interface IIBCChannelPacket is IIBCChannelPacketSendRecv, IIBCChannelPacketTimeout {}
文件 21 的 43:IIBCChannelErrors.sol
pragma solidity ^0.8.20;
import {Height} from "../../proto/Client.sol";
import {Channel} from "../../proto/Channel.sol";
interface IIBCChannelErrors {
error IBCChannelUnexpectedChannelState(Channel.State state);
error IBCChannelChannelNotFound(string portId, string channelId);
error IBCChannelUnknownChannelOrder(Channel.Order ordering);
error IBCChannelFailedVerifyChannelState(string clientId, bytes path, bytes value, bytes proof, Height.Data height);
error IBCChannelConnectionNotOpened(string connectionId);
error IBCChannelCounterpartyChannelIdNotEmpty(string counterpartyChannelId);
error IBCChannelInvalidConnectionHopsLength(uint256 length);
error IBCChannelConnectionMultipleVersionsFound(string connectionId, uint256 length);
error IBCChannelConnectionFeatureNotSupported(Channel.Order ordering);
error IBCChannelZeroPacketTimeout();
error IBCChannelPastPacketTimeoutHeight(Height.Data timeoutHeight, Height.Data latestHeight);
error IBCChannelPastPacketTimeoutTimestamp(uint64 timeoutTimestamp, uint64 latestTimestamp);
error IBCChannelTimeoutNotReached();
error IBCChannelUnknownPacketReceiptCommitment(bytes32 commitment);
error IBCChannelUnexpectedPacketSource(string sourcePort, string sourceChannel);
error IBCChannelUnexpectedPacketDestination(string destinationPort, string destinationChannel);
error IBCChannelCannotRecvNextUpgradePacket(uint64 sequence, uint64 counterpartyNextSequenceSend);
error IBCChannelPacketAlreadyProcessInPreviousUpgrade(uint64 sequence, uint64 recvStartSequence);
error IBCChannelAckAlreadyProcessedInPreviousUpgrade(uint64 sequence, uint64 ackStartSequence);
error IBCChannelTimeoutPacketHeight(uint256 currentBlockNumber, uint64 timeoutHeight);
error IBCChannelTimeoutPacketTimestamp(uint256 currentTimestamp, uint64 timeoutTimestamp);
error IBCChannelPacketReceiptAlreadyExists(string destinationPort, string destinationChannel, uint64 sequence);
error IBCChannelUnexpectedNextSequenceRecv(uint64 expected);
error IBCChannelPacketCommitmentNotFound(string portId, string channelId, uint64 sequence);
error IBCChannelUnexpectedNextSequenceAck(uint64 expected);
error IBCChannelPacketCommitmentMismatch(bytes32 expected, bytes32 actual);
error IBCChannelPacketMaybeAlreadyReceived(uint64 sequence, uint64 nextSequenceRecv);
error IBCChannelFailedVerifyPacketCommitment(
string clientId, bytes path, bytes32 commitment, bytes proof, Height.Data height
);
error IBCChannelFailedVerifyPacketAcknowledgement(
string clientId, bytes path, bytes32 commitment, bytes proof, Height.Data height
);
error IBCChannelFailedVerifyNextSequenceRecv(
string clientId, bytes path, uint64 nextSequenceRecv, bytes proof, Height.Data height
);
error IBCChannelFailedVerifyPacketReceiptAbsence(string clientId, bytes path, bytes proof, Height.Data height);
error IBCChannelEmptyAcknowledgement();
error IBCChannelAcknowledgementAlreadyWritten(string destinationPort, string destinationChannel, uint64 sequence);
}
文件 22 的 43:IIBCChannelUpgrade.sol
pragma solidity ^0.8.20;
import {Height} from "../../proto/Client.sol";
import {Channel, Upgrade, UpgradeFields, ErrorReceipt, Timeout} from "../../proto/Channel.sol";
interface IIBCChannelUpgradeBase {
event ChannelUpgradeInit(
string portId, string channelId, uint64 upgradeSequence, UpgradeFields.Data proposedUpgradeFields
);
event ChannelUpgradeTry(
string portId,
string channelId,
uint64 upgradeSequence,
UpgradeFields.Data upgradeFields,
Timeout.Data timeout,
uint64 nextSequenceSend
);
event ChannelUpgradeAck(
string portId,
string channelId,
uint64 upgradeSequence,
Channel.State channelState,
UpgradeFields.Data upgradeFields,
Timeout.Data timeout,
uint64 nextSequenceSend
);
event ChannelUpgradeConfirm(string portId, string channelId, uint64 upgradeSequence, Channel.State channelState);
event ChannelUpgradeOpen(string portId, string channelId, uint64 upgradeSequence);
event WriteErrorReceipt(string portId, string channelId, uint64 upgradeSequence, string message);
enum UpgradeHandshakeError {
None,
Overwritten,
OutOfSync,
Timeout,
Cancel,
IncompatibleProposal,
AckCallbackFailed
}
struct MsgChannelUpgradeInit {
string portId;
string channelId;
UpgradeFields.Data proposedUpgradeFields;
}
struct MsgChannelUpgradeTry {
string portId;
string channelId;
uint64 counterpartyUpgradeSequence;
UpgradeFields.Data counterpartyUpgradeFields;
string[] proposedConnectionHops;
ChannelUpgradeProofs proofs;
}
struct MsgChannelUpgradeAck {
string portId;
string channelId;
Upgrade.Data counterpartyUpgrade;
ChannelUpgradeProofs proofs;
}
struct MsgChannelUpgradeConfirm {
string portId;
string channelId;
Channel.State counterpartyChannelState;
Upgrade.Data counterpartyUpgrade;
ChannelUpgradeProofs proofs;
}
struct MsgChannelUpgradeOpen {
string portId;
string channelId;
Channel.State counterpartyChannelState;
uint64 counterpartyUpgradeSequence;
bytes proofChannel;
Height.Data proofHeight;
}
struct MsgCancelChannelUpgrade {
string portId;
string channelId;
ErrorReceipt.Data errorReceipt;
bytes proofUpgradeError;
Height.Data proofHeight;
}
struct MsgTimeoutChannelUpgrade {
string portId;
string channelId;
Channel.Data counterpartyChannel;
bytes proofChannel;
Height.Data proofHeight;
}
struct ChannelUpgradeProofs {
bytes proofChannel;
bytes proofUpgrade;
Height.Data proofHeight;
}
}
interface IIBCChannelUpgradeInitTryAck is IIBCChannelUpgradeBase {
function channelUpgradeInit(MsgChannelUpgradeInit calldata msg_) external returns (uint64 upgradeSequence);
function channelUpgradeTry(MsgChannelUpgradeTry calldata msg_) external returns (bool ok, uint64 upgradeSequence);
function channelUpgradeAck(MsgChannelUpgradeAck calldata msg_) external returns (bool);
}
interface IIBCChannelUpgradeConfirmOpenTimeoutCancel is IIBCChannelUpgradeBase {
function channelUpgradeConfirm(MsgChannelUpgradeConfirm calldata msg_) external returns (bool);
function channelUpgradeOpen(MsgChannelUpgradeOpen calldata msg_) external;
function cancelChannelUpgrade(MsgCancelChannelUpgrade calldata msg_) external;
function timeoutChannelUpgrade(MsgTimeoutChannelUpgrade calldata msg_) external;
}
interface IIBCChannelUpgrade is IIBCChannelUpgradeInitTryAck, IIBCChannelUpgradeConfirmOpenTimeoutCancel {}
文件 23 的 43:IIBCChannelUpgradeErrors.sol
pragma solidity ^0.8.20;
import {Height} from "../../proto/Client.sol";
import {Channel} from "../../proto/Channel.sol";
import {IIBCChannelErrors} from "./IIBCChannelErrors.sol";
interface IIBCChannelUpgradeErrors is IIBCChannelErrors {
error IBCChannelUpgradeNoChanges();
error IBCChannelUpgradeInvalidUpgradeFields();
error IBCChannelUpgradeTryProposedConnectionHopsEmpty();
error IBCChannelUpgradeTryProposedConnectionHopsMismatch();
error IBCChannelUpgradeUnauthorizedChannelUpgrader(address upgrader);
error IBCChannelUpgradeIncompatibleProposal();
error IBCChannelUpgradeErrorReceiptEmpty();
error IBCChannelUpgradeWriteOldErrorReceiptSequence(uint64 latestSequence, uint64 sequence);
error IBCChannelUpgradeNoExistingUpgrade();
error IBCChannelUpgradeNotFlushing(Channel.State state);
error IBCChannelUpgradeNotOpenOrFlushing(Channel.State state);
error IBCChannelUpgradeCounterpartyNotOpenOrFlushcomplete(Channel.State state);
error IBCChannelUpgradeCounterpartyNotFlushingOrFlushcomplete(Channel.State state);
error IBCChannelUpgradeNotFlushcomplete(Channel.State state);
error IBCChannelUpgradeFailedVerifyMembership(
string clientId, string path, bytes value, bytes proof, Height.Data height
);
error IBCChannelUpgradeTimeoutHeightNotReached();
error IBCChannelUpgradeTimeoutTimestampNotReached();
error IBCChannelUpgradeInvalidTimeout();
error IBCChannelUpgradeCounterpartyAlreadyFlushCompleted();
error IBCChannelUpgradeCounterpartyAlreadyUpgraded();
error IBCChannelUpgradeTimeoutUnallowedState();
error IBCChannelUpgradeOldErrorReceiptSequence();
error IBCChannelUpgradeInvalidErrorReceiptSequence();
error IBCChannelUpgradeOldCounterpartyUpgradeSequence();
error IBCChannelUpgradeUnsupportedOrdering(Channel.Order ordering);
}
文件 24 的 43:IIBCClient.sol
pragma solidity ^0.8.20;
import {Height} from "../../proto/Client.sol";
interface IIBCClient {
struct MsgCreateClient {
string clientType;
bytes protoClientState;
bytes protoConsensusState;
}
struct MsgUpdateClient {
string clientId;
bytes protoClientMessage;
}
event GeneratedClientIdentifier(string clientId);
function createClient(MsgCreateClient calldata msg_) external returns (string memory clientId);
function updateClient(MsgUpdateClient calldata msg_) external;
function routeUpdateClient(MsgUpdateClient calldata msg_) external view returns (address, bytes4, bytes memory);
function updateClientCommitments(string calldata clientId, Height.Data[] calldata heights) external;
}
文件 25 的 43:IIBCClientErrors.sol
pragma solidity ^0.8.20;
import {Height} from "../../proto/Client.sol";
interface IIBCClientErrors {
error IBCClientUnregisteredClientType(string clientType);
error IBCClientClientNotFound(string clientId);
error IBCClientConsensusStateNotFound(string clientId, Height.Data consensusHeight);
error IBCClientNotActiveClient(string clientId);
error IBCClientFailedUpdateClient(bytes4 selector, bytes args);
}
文件 26 的 43:IIBCConnection.sol
pragma solidity ^0.8.20;
import {Height} from "../../proto/Client.sol";
import {Version, Counterparty} from "../../proto/Connection.sol";
interface IIBCConnection {
struct MsgConnectionOpenInit {
string clientId;
Counterparty.Data counterparty;
Version.Data version;
uint64 delayPeriod;
}
struct MsgConnectionOpenTry {
Counterparty.Data counterparty;
uint64 delayPeriod;
string clientId;
bytes clientStateBytes;
Version.Data[] counterpartyVersions;
bytes proofInit;
bytes proofClient;
bytes proofConsensus;
Height.Data proofHeight;
Height.Data consensusHeight;
bytes hostConsensusStateProof;
}
struct MsgConnectionOpenAck {
string connectionId;
bytes clientStateBytes;
Version.Data version;
string counterpartyConnectionId;
bytes proofTry;
bytes proofClient;
bytes proofConsensus;
Height.Data proofHeight;
Height.Data consensusHeight;
bytes hostConsensusStateProof;
}
struct MsgConnectionOpenConfirm {
string connectionId;
bytes proofAck;
Height.Data proofHeight;
}
event GeneratedConnectionIdentifier(string connectionId);
function connectionOpenInit(MsgConnectionOpenInit calldata msg_) external returns (string memory connectionId);
function connectionOpenTry(MsgConnectionOpenTry calldata msg_) external returns (string memory);
function connectionOpenAck(MsgConnectionOpenAck calldata msg_) external;
function connectionOpenConfirm(MsgConnectionOpenConfirm calldata msg_) external;
}
文件 27 的 43:IIBCConnectionErrors.sol
pragma solidity ^0.8.20;
import {Height} from "../../proto/Client.sol";
import {ConnectionEnd} from "../../proto/Connection.sol";
interface IIBCConnectionErrors {
error IBCConnectionAlreadyConnectionExists();
error IBCConnectionInvalidCounterpartyConnectionIdentifier(string counterpartyConnectionId);
error IBCConnectionEmptyConnectionCounterpartyVersions();
error IBCConnectionNoMatchingVersionFound();
error IBCConnectionVersionsAlreadySet();
error IBCConnectionIBCVersionNotSupported();
error IBCConnectionInvalidSelfClientState();
error IBCConnectionInvalidHostConsensusStateProof();
error IBCConnectionUnexpectedConnectionState(ConnectionEnd.State state);
error IBCConnectionFailedVerifyConnectionState(
string clientId, bytes path, bytes value, bytes proof, Height.Data height
);
error IBCConnectionFailedVerifyClientState(
string clientId, bytes path, bytes value, bytes proof, Height.Data height
);
error IBCConnectionFailedVerifyClientConsensusState(
string clientId, bytes path, bytes value, bytes proof, Height.Data height
);
}
文件 28 的 43:IIBCHandler.sol
pragma solidity ^0.8.20;
import {IIBCClient} from "../02-client/IIBCClient.sol";
import {IIBCClientErrors} from "../02-client/IIBCClientErrors.sol";
import {IIBCConnection} from "../03-connection/IIBCConnection.sol";
import {IIBCConnectionErrors} from "../03-connection/IIBCConnectionErrors.sol";
import {IIBCChannelHandshake, IIBCChannelPacket} from "../04-channel/IIBCChannel.sol";
import {IIBCChannelErrors} from "../04-channel/IIBCChannelErrors.sol";
import {IIBCChannelUpgrade} from "../04-channel/IIBCChannelUpgrade.sol";
import {IIBCChannelUpgradeErrors} from "../04-channel/IIBCChannelUpgradeErrors.sol";
import {IIBCHostConfigurator} from "../24-host/IIBCHostConfigurator.sol";
import {IIBCHostErrors} from "../24-host/IIBCHostErrors.sol";
import {IIBCModuleManager} from "../26-router/IIBCModuleManager.sol";
import {IIBCQuerier} from "./IIBCQuerier.sol";
interface IIBCHandler is
IIBCClient,
IIBCClientErrors,
IIBCConnection,
IIBCConnectionErrors,
IIBCChannelHandshake,
IIBCChannelPacket,
IIBCChannelErrors,
IIBCChannelUpgrade,
IIBCChannelUpgradeErrors,
IIBCHostConfigurator,
IIBCHostErrors,
IIBCModuleManager,
IIBCQuerier
{}
文件 29 的 43:IIBCHostConfigurator.sol
pragma solidity ^0.8.20;
import {ILightClient} from "../02-client/ILightClient.sol";
import {IIBCModuleInitializer} from "../26-router/IIBCModule.sol";
interface IIBCHostConfigurator {
function setExpectedTimePerBlock(uint64 expectedTimePerBlock_) external;
function registerClient(string calldata clientType, ILightClient client) external;
function bindPort(string calldata portId, IIBCModuleInitializer moduleAddress) external;
}
文件 30 的 43:IIBCHostErrors.sol
pragma solidity ^0.8.20;
interface IIBCHostErrors {
error IBCHostInvalidClientType(string clientType);
error IBCHostClientTypeAlreadyExists(string clientType);
error IBCHostInvalidPortIdentifier(string portId);
error IBCHostInvalidLightClientAddress(address lcAddress);
error IBCHostInvalidModuleAddress(address moduleAddress);
error IBCHostModulePortNotFound(string portId);
error IBCHostModuleChannelNotFound(string portId, string channelId);
error IBCHostModuleDoesNotSupportERC165();
error IBCHostModuleDoesNotSupportIIBCModule(address module, bytes4 interfaceId);
error IBCHostModuleDoesNotSupportIIBCModuleInitializer(address module, bytes4 interfaceId);
error IBCHostModuleDoesNotSupportIIBCModuleUpgrade(address module);
error IBCHostPortCapabilityAlreadyClaimed(string portId);
error IBCHostChannelCapabilityAlreadyClaimed(string portId, string channelId);
error IBCHostFailedAuthenticateChannelCapability(string portId, string channelId, address caller);
}
文件 31 的 43:IIBCModule.sol
pragma solidity ^0.8.20;
import {Channel, ChannelCounterparty} from "../../proto/Channel.sol";
import {Packet} from "../04-channel/IIBCChannel.sol";
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
interface IIBCModuleInitializer is IERC165 {
struct MsgOnChanOpenInit {
Channel.Order order;
string[] connectionHops;
string portId;
string channelId;
ChannelCounterparty.Data counterparty;
string version;
}
struct MsgOnChanOpenTry {
Channel.Order order;
string[] connectionHops;
string portId;
string channelId;
ChannelCounterparty.Data counterparty;
string counterpartyVersion;
}
function onChanOpenInit(MsgOnChanOpenInit calldata msg_) external returns (address, string memory);
function onChanOpenTry(MsgOnChanOpenTry calldata msg_) external returns (address, string memory);
}
interface IIBCModule is IIBCModuleInitializer {
struct MsgOnChanOpenAck {
string portId;
string channelId;
string counterpartyVersion;
}
struct MsgOnChanOpenConfirm {
string portId;
string channelId;
}
struct MsgOnChanCloseInit {
string portId;
string channelId;
}
struct MsgOnChanCloseConfirm {
string portId;
string channelId;
}
function onChanOpenAck(MsgOnChanOpenAck calldata msd_) external;
function onChanOpenConfirm(MsgOnChanOpenConfirm calldata msg_) external;
function onChanCloseInit(MsgOnChanCloseInit calldata msg_) external;
function onChanCloseConfirm(MsgOnChanCloseConfirm calldata msg_) external;
function onRecvPacket(Packet calldata, address relayer) external returns (bytes memory);
function onAcknowledgementPacket(Packet calldata, bytes calldata acknowledgement, address relayer) external;
function onTimeoutPacket(Packet calldata, address relayer) external;
}
文件 32 的 43:IIBCModuleManager.sol
pragma solidity ^0.8.20;
interface IIBCModuleManager {
event IBCModuleManagerPortCapabilityClaimed(string portId, address module);
event IBCModuleManagerChannelCapabilityClaimed(string portId, string channelId, address module);
}
文件 33 的 43:IIBCModuleUpgrade.sol
pragma solidity ^0.8.12;
import {UpgradeFields, Timeout} from "../../proto/Channel.sol";
interface IIBCModuleUpgrade {
function getUpgradeTimeout(string calldata portId, string calldata channelId)
external
view
returns (Timeout.Data memory);
function isAuthorizedUpgrader(string calldata portId, string calldata channelId, address msgSender)
external
view
returns (bool);
function canTransitionToFlushComplete(
string calldata portId,
string calldata channelId,
uint64 upgradeSequence,
address msgSender
) external view returns (bool);
function onChanUpgradeInit(
string calldata portId,
string calldata channelId,
uint64 upgradeSequence,
UpgradeFields.Data calldata proposedUpgradeFields
) external view returns (string memory version);
function onChanUpgradeTry(
string calldata portId,
string calldata channelId,
uint64 upgradeSequence,
UpgradeFields.Data calldata proposedUpgradeFields
) external view returns (string memory version);
function onChanUpgradeAck(
string calldata portId,
string calldata channelId,
uint64 upgradeSequence,
string calldata counterpartyVersion
) external view;
function onChanUpgradeOpen(string calldata portId, string calldata channelId, uint64 upgradeSequence) external;
}
文件 34 的 43:IIBCQuerier.sol
pragma solidity ^0.8.20;
import {Height} from "../../proto/Client.sol";
import {ConnectionEnd} from "../../proto/Connection.sol";
import {Channel, Upgrade} from "../../proto/Channel.sol";
import {IBCChannelLib} from "../04-channel/IBCChannelLib.sol";
import {IIBCModule, IIBCModuleInitializer} from "../26-router/IIBCModule.sol";
interface IIBCQuerier {
function getCommitmentPrefix() external view returns (bytes memory);
function getCommitmentsSlot() external pure returns (bytes32);
function getCommitment(bytes32 hashedPath) external view returns (bytes32);
function getExpectedTimePerBlock() external view returns (uint64);
function getIBCModuleByPort(string calldata portId) external view returns (IIBCModuleInitializer);
function getIBCModuleByChannel(string calldata portId, string calldata channelId)
external
view
returns (IIBCModule);
function getClientByType(string calldata clientType) external view returns (address);
function getClientType(string calldata clientId) external view returns (string memory);
function getClient(string calldata clientId) external view returns (address);
function getClientState(string calldata clientId) external view returns (bytes memory, bool);
function getConsensusState(string calldata clientId, Height.Data calldata height)
external
view
returns (bytes memory, bool);
function getConnection(string calldata connectionId) external view returns (ConnectionEnd.Data memory, bool);
function getChannel(string calldata portId, string calldata channelId)
external
view
returns (Channel.Data memory, bool);
function getNextSequenceSend(string calldata portId, string calldata channelId) external view returns (uint64);
function getNextSequenceRecv(string calldata portId, string calldata channelId) external view returns (uint64);
function getNextSequenceAck(string calldata portId, string calldata channelId) external view returns (uint64);
function getPacketReceipt(string calldata portId, string calldata channelId, uint64 sequence)
external
view
returns (IBCChannelLib.PacketReceipt);
function getChannelUpgrade(string calldata portId, string calldata channelId)
external
view
returns (Upgrade.Data memory, bool);
function getCanTransitionToFlushComplete(string calldata portId, string calldata channelId)
external
view
returns (bool);
}
文件 35 的 43:ILightClient.sol
pragma solidity ^0.8.20;
import {Height} from "../../proto/Client.sol";
interface ILightClient {
struct ConsensusStateUpdate {
bytes32 consensusStateCommitment;
Height.Data height;
}
enum ClientStatus {
Active,
Expired,
Frozen
}
function initializeClient(
string calldata clientId,
bytes calldata protoClientState,
bytes calldata protoConsensusState
) external returns (Height.Data memory height);
function routeUpdateClient(string calldata clientId, bytes calldata protoClientMessage)
external
pure
returns (bytes4 selector, bytes memory args);
function getTimestampAtHeight(string calldata clientId, Height.Data calldata height)
external
view
returns (uint64);
function getLatestHeight(string calldata clientId) external view returns (Height.Data memory);
function getStatus(string calldata clientId) external view returns (ClientStatus);
function getLatestInfo(string calldata clientId)
external
view
returns (Height.Data memory latestHeight, uint64 latestTimestamp, ClientStatus status);
function verifyMembership(
string calldata clientId,
Height.Data calldata height,
uint64 delayTimePeriod,
uint64 delayBlockPeriod,
bytes calldata proof,
bytes calldata prefix,
bytes calldata path,
bytes calldata value
) external returns (bool);
function verifyNonMembership(
string calldata clientId,
Height.Data calldata height,
uint64 delayTimePeriod,
uint64 delayBlockPeriod,
bytes calldata proof,
bytes calldata prefix,
bytes calldata path
) external returns (bool);
function getClientState(string calldata clientId) external view returns (bytes memory, bool);
function getConsensusState(string calldata clientId, Height.Data calldata height)
external
view
returns (bytes memory, bool);
}
文件 36 的 43:Math.sol
pragma solidity ^0.8.20;
import {Panic} from "../Panic.sol";
import {SafeCast} from "./SafeCast.sol";
library Math {
enum Rounding {
Floor,
Ceil,
Trunc,
Expand
}
function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function ternary(bool condition, uint256 a, uint256 b) internal pure returns (uint256) {
unchecked {
return b ^ ((a ^ b) * SafeCast.toUint(condition));
}
}
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return ternary(a > b, a, b);
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return ternary(a < b, a, b);
}
function average(uint256 a, uint256 b) internal pure returns (uint256) {
return (a & b) + (a ^ b) / 2;
}
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
if (b == 0) {
Panic.panic(Panic.DIVISION_BY_ZERO);
}
unchecked {
return SafeCast.toUint(a > 0) * ((a - 1) / b + 1);
}
}
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
uint256 prod0 = x * y;
uint256 prod1;
assembly {
let mm := mulmod(x, y, not(0))
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
if (prod1 == 0) {
return prod0 / denominator;
}
if (denominator <= prod1) {
Panic.panic(ternary(denominator == 0, Panic.DIVISION_BY_ZERO, Panic.UNDER_OVERFLOW));
}
uint256 remainder;
assembly {
remainder := mulmod(x, y, denominator)
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
uint256 twos = denominator & (0 - denominator);
assembly {
denominator := div(denominator, twos)
prod0 := div(prod0, twos)
twos := add(div(sub(0, twos), twos), 1)
}
prod0 |= prod1 * twos;
uint256 inverse = (3 * denominator) ^ 2;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
result = prod0 * inverse;
return result;
}
}
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
return mulDiv(x, y, denominator) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0);
}
function invMod(uint256 a, uint256 n) internal pure returns (uint256) {
unchecked {
if (n == 0) return 0;
uint256 remainder = a % n;
uint256 gcd = n;
int256 x = 0;
int256 y = 1;
while (remainder != 0) {
uint256 quotient = gcd / remainder;
(gcd, remainder) = (
remainder,
gcd - remainder * quotient
);
(x, y) = (
y,
x - y * int256(quotient)
);
}
if (gcd != 1) return 0;
return ternary(x < 0, n - uint256(-x), uint256(x));
}
}
function invModPrime(uint256 a, uint256 p) internal view returns (uint256) {
unchecked {
return Math.modExp(a, p - 2, p);
}
}
function modExp(uint256 b, uint256 e, uint256 m) internal view returns (uint256) {
(bool success, uint256 result) = tryModExp(b, e, m);
if (!success) {
Panic.panic(Panic.DIVISION_BY_ZERO);
}
return result;
}
function tryModExp(uint256 b, uint256 e, uint256 m) internal view returns (bool success, uint256 result) {
if (m == 0) return (false, 0);
assembly ("memory-safe") {
let ptr := mload(0x40)
mstore(ptr, 0x20)
mstore(add(ptr, 0x20), 0x20)
mstore(add(ptr, 0x40), 0x20)
mstore(add(ptr, 0x60), b)
mstore(add(ptr, 0x80), e)
mstore(add(ptr, 0xa0), m)
success := staticcall(gas(), 0x05, ptr, 0xc0, 0x00, 0x20)
result := mload(0x00)
}
}
function modExp(bytes memory b, bytes memory e, bytes memory m) internal view returns (bytes memory) {
(bool success, bytes memory result) = tryModExp(b, e, m);
if (!success) {
Panic.panic(Panic.DIVISION_BY_ZERO);
}
return result;
}
function tryModExp(
bytes memory b,
bytes memory e,
bytes memory m
) internal view returns (bool success, bytes memory result) {
if (_zeroBytes(m)) return (false, new bytes(0));
uint256 mLen = m.length;
result = abi.encodePacked(b.length, e.length, mLen, b, e, m);
assembly ("memory-safe") {
let dataPtr := add(result, 0x20)
success := staticcall(gas(), 0x05, dataPtr, mload(result), dataPtr, mLen)
mstore(result, mLen)
mstore(0x40, add(dataPtr, mLen))
}
}
function _zeroBytes(bytes memory byteArray) private pure returns (bool) {
for (uint256 i = 0; i < byteArray.length; ++i) {
if (byteArray[i] != 0) {
return false;
}
}
return true;
}
function sqrt(uint256 a) internal pure returns (uint256) {
unchecked {
if (a <= 1) {
return a;
}
uint256 aa = a;
uint256 xn = 1;
if (aa >= (1 << 128)) {
aa >>= 128;
xn <<= 64;
}
if (aa >= (1 << 64)) {
aa >>= 64;
xn <<= 32;
}
if (aa >= (1 << 32)) {
aa >>= 32;
xn <<= 16;
}
if (aa >= (1 << 16)) {
aa >>= 16;
xn <<= 8;
}
if (aa >= (1 << 8)) {
aa >>= 8;
xn <<= 4;
}
if (aa >= (1 << 4)) {
aa >>= 4;
xn <<= 2;
}
if (aa >= (1 << 2)) {
xn <<= 1;
}
xn = (3 * xn) >> 1;
xn = (xn + a / xn) >> 1;
xn = (xn + a / xn) >> 1;
xn = (xn + a / xn) >> 1;
xn = (xn + a / xn) >> 1;
xn = (xn + a / xn) >> 1;
xn = (xn + a / xn) >> 1;
return xn - SafeCast.toUint(xn > a / xn);
}
}
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + SafeCast.toUint(unsignedRoundsUp(rounding) && result * result < a);
}
}
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
uint256 exp;
unchecked {
exp = 128 * SafeCast.toUint(value > (1 << 128) - 1);
value >>= exp;
result += exp;
exp = 64 * SafeCast.toUint(value > (1 << 64) - 1);
value >>= exp;
result += exp;
exp = 32 * SafeCast.toUint(value > (1 << 32) - 1);
value >>= exp;
result += exp;
exp = 16 * SafeCast.toUint(value > (1 << 16) - 1);
value >>= exp;
result += exp;
exp = 8 * SafeCast.toUint(value > (1 << 8) - 1);
value >>= exp;
result += exp;
exp = 4 * SafeCast.toUint(value > (1 << 4) - 1);
value >>= exp;
result += exp;
exp = 2 * SafeCast.toUint(value > (1 << 2) - 1);
value >>= exp;
result += exp;
result += SafeCast.toUint(value > 1);
}
return result;
}
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << result < value);
}
}
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 10 ** result < value);
}
}
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
uint256 isGt;
unchecked {
isGt = SafeCast.toUint(value > (1 << 128) - 1);
value >>= isGt * 128;
result += isGt * 16;
isGt = SafeCast.toUint(value > (1 << 64) - 1);
value >>= isGt * 64;
result += isGt * 8;
isGt = SafeCast.toUint(value > (1 << 32) - 1);
value >>= isGt * 32;
result += isGt * 4;
isGt = SafeCast.toUint(value > (1 << 16) - 1);
value >>= isGt * 16;
result += isGt * 2;
result += SafeCast.toUint(value > (1 << 8) - 1);
}
return result;
}
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << (result << 3) < value);
}
}
function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
return uint8(rounding) % 2 == 1;
}
}
文件 37 的 43:Ownable.sol
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
abstract contract Ownable is Context {
address private _owner;
error OwnableUnauthorizedAccount(address account);
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
modifier onlyOwner() {
_checkOwner();
_;
}
function owner() public view virtual returns (address) {
return _owner;
}
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
文件 38 的 43:OwnableIBCHandler.sol
pragma solidity ^0.8.20;
import {ILightClient} from "../02-client/ILightClient.sol";
import {IIBCClient} from "../02-client/IIBCClient.sol";
import {IIBCConnection} from "../03-connection/IIBCConnection.sol";
import {
IIBCChannelHandshake, IIBCChannelPacketSendRecv, IIBCChannelPacketTimeout
} from "../04-channel/IIBCChannel.sol";
import {
IIBCChannelUpgradeInitTryAck,
IIBCChannelUpgradeConfirmOpenTimeoutCancel
} from "../04-channel/IIBCChannelUpgrade.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {IIBCModuleInitializer} from "../26-router/IIBCModule.sol";
import {IBCHandler} from "./IBCHandler.sol";
contract OwnableIBCHandler is IBCHandler, Ownable {
constructor(
IIBCClient ibcClient_,
IIBCConnection ibcConnection_,
IIBCChannelHandshake ibcChannelHandshake_,
IIBCChannelPacketSendRecv ibcChannelPacketSendRecv_,
IIBCChannelPacketTimeout ibcChannelPacketTimeout_,
IIBCChannelUpgradeInitTryAck ibcChannelUpgradeInitTryAck_,
IIBCChannelUpgradeConfirmOpenTimeoutCancel ibcChannelUpgradeConfirmOpenTimeoutCancel_
)
IBCHandler(
ibcClient_,
ibcConnection_,
ibcChannelHandshake_,
ibcChannelPacketSendRecv_,
ibcChannelPacketTimeout_,
ibcChannelUpgradeInitTryAck_,
ibcChannelUpgradeConfirmOpenTimeoutCancel_
)
Ownable(msg.sender)
{}
function registerClient(string calldata clientType, ILightClient client) public onlyOwner {
super._registerClient(clientType, client);
}
function bindPort(string calldata portId, IIBCModuleInitializer moduleAddress) public onlyOwner {
super._bindPort(portId, moduleAddress);
}
function setExpectedTimePerBlock(uint64 expectedTimePerBlock_) public onlyOwner {
super._setExpectedTimePerBlock(expectedTimePerBlock_);
}
}
文件 39 的 43:Panic.sol
pragma solidity ^0.8.20;
library Panic {
uint256 internal constant GENERIC = 0x00;
uint256 internal constant ASSERT = 0x01;
uint256 internal constant UNDER_OVERFLOW = 0x11;
uint256 internal constant DIVISION_BY_ZERO = 0x12;
uint256 internal constant ENUM_CONVERSION_ERROR = 0x21;
uint256 internal constant STORAGE_ENCODING_ERROR = 0x22;
uint256 internal constant EMPTY_ARRAY_POP = 0x31;
uint256 internal constant ARRAY_OUT_OF_BOUNDS = 0x32;
uint256 internal constant RESOURCE_ERROR = 0x41;
uint256 internal constant INVALID_INTERNAL_FUNCTION = 0x51;
function panic(uint256 code) internal pure {
assembly ("memory-safe") {
mstore(0x00, 0x4e487b71)
mstore(0x20, code)
revert(0x1c, 0x24)
}
}
}
文件 40 的 43:ProtoBufRuntime.sol
pragma solidity ^0.8.20;
library ProtoBufRuntime {
enum WireType { Varint, Fixed64, LengthDelim, StartGroup, EndGroup, Fixed32 }
uint256 constant WORD_LENGTH = 32;
uint256 constant HEADER_SIZE_LENGTH_IN_BYTES = 4;
uint256 constant BYTE_SIZE = 8;
uint256 constant REMAINING_LENGTH = WORD_LENGTH - HEADER_SIZE_LENGTH_IN_BYTES;
string constant OVERFLOW_MESSAGE = "length overflow";
function encodeStorage(bytes storage location, bytes memory encoded)
internal
{
uint256 length = encoded.length;
uint256 firstWord;
uint256 wordLength = WORD_LENGTH;
uint256 remainingLength = REMAINING_LENGTH;
assembly {
firstWord := mload(add(encoded, wordLength))
}
firstWord =
(firstWord >> (BYTE_SIZE * HEADER_SIZE_LENGTH_IN_BYTES)) |
(length << (BYTE_SIZE * REMAINING_LENGTH));
assembly {
sstore(location.slot, firstWord)
}
if (length > REMAINING_LENGTH) {
length -= REMAINING_LENGTH;
for (uint256 i = 0; i < ceil(length, WORD_LENGTH); i++) {
assembly {
let offset := add(mul(i, wordLength), remainingLength)
let slotIndex := add(i, 1)
sstore(
add(location.slot, slotIndex),
mload(add(add(encoded, wordLength), offset))
)
}
}
}
}
function decodeStorage(bytes storage location)
internal
view
returns (bytes memory)
{
uint256 firstWord;
uint256 remainingLength = REMAINING_LENGTH;
uint256 wordLength = WORD_LENGTH;
assembly {
firstWord := sload(location.slot)
}
uint256 length = firstWord >> (BYTE_SIZE * REMAINING_LENGTH);
bytes memory encoded = new bytes(length);
assembly {
mstore(add(encoded, remainingLength), firstWord)
}
if (length > REMAINING_LENGTH) {
length -= REMAINING_LENGTH;
for (uint256 i = 0; i < ceil(length, WORD_LENGTH); i++) {
assembly {
let offset := add(mul(i, wordLength), remainingLength)
let slotIndex := add(i, 1)
mstore(
add(add(encoded, wordLength), offset),
sload(add(location.slot, slotIndex))
)
}
}
}
return encoded;
}
function copyBytes(uint256 src, uint256 dest, uint256 len) internal pure {
if (len == 0) {
return;
}
for (; len > WORD_LENGTH; len -= WORD_LENGTH) {
assembly {
mstore(dest, mload(src))
}
dest += WORD_LENGTH;
src += WORD_LENGTH;
}
uint256 mask = 256**(WORD_LENGTH - len) - 1;
assembly {
let srcpart := and(mload(src), not(mask))
let destpart := and(mload(dest), mask)
mstore(dest, or(destpart, srcpart))
}
}
function getMemoryAddress(bytes memory r) internal pure returns (uint256) {
uint256 addr;
assembly {
addr := r
}
return addr;
}
function ceil(uint256 a, uint256 m) internal pure returns (uint256 r) {
return (a + m - 1) / m;
}
function _decode_uint32(uint256 p, bytes memory bs)
internal
pure
returns (uint32, uint256)
{
(uint256 varint, uint256 sz) = _decode_varint(p, bs);
return (uint32(varint), sz);
}
function _decode_uint64(uint256 p, bytes memory bs)
internal
pure
returns (uint64, uint256)
{
(uint256 varint, uint256 sz) = _decode_varint(p, bs);
return (uint64(varint), sz);
}
function _decode_int32(uint256 p, bytes memory bs)
internal
pure
returns (int32, uint256)
{
(uint256 varint, uint256 sz) = _decode_varint(p, bs);
int32 r;
assembly {
r := varint
}
return (r, sz);
}
function _decode_int64(uint256 p, bytes memory bs)
internal
pure
returns (int64, uint256)
{
(uint256 varint, uint256 sz) = _decode_varint(p, bs);
int64 r;
assembly {
r := varint
}
return (r, sz);
}
function _decode_enum(uint256 p, bytes memory bs)
internal
pure
returns (int64, uint256)
{
return _decode_int64(p, bs);
}
function _decode_bool(uint256 p, bytes memory bs)
internal
pure
returns (bool, uint256)
{
(uint256 varint, uint256 sz) = _decode_varint(p, bs);
if (varint == 0) {
return (false, sz);
}
return (true, sz);
}
function _decode_sint32(uint256 p, bytes memory bs)
internal
pure
returns (int32, uint256)
{
(int256 varint, uint256 sz) = _decode_varints(p, bs);
return (int32(varint), sz);
}
function _decode_sint64(uint256 p, bytes memory bs)
internal
pure
returns (int64, uint256)
{
(int256 varint, uint256 sz) = _decode_varints(p, bs);
return (int64(varint), sz);
}
function _decode_string(uint256 p, bytes memory bs)
internal
pure
returns (string memory, uint256)
{
(bytes memory x, uint256 sz) = _decode_lendelim(p, bs);
return (string(x), sz);
}
function _decode_bytes(uint256 p, bytes memory bs)
internal
pure
returns (bytes memory, uint256)
{
return _decode_lendelim(p, bs);
}
function _decode_key(uint256 p, bytes memory bs)
internal
pure
returns (uint256, WireType, uint256)
{
(uint256 x, uint256 n) = _decode_varint(p, bs);
WireType typeId = WireType(x & 7);
uint256 fieldId = x / 8;
return (fieldId, typeId, n);
}
function _decode_varint(uint256 p, bytes memory bs)
internal
pure
returns (uint256, uint256)
{
uint256 x = 0;
uint256 sz = 0;
uint256 length = bs.length + WORD_LENGTH;
assembly {
let b := 0x80
p := add(bs, p)
for {
} eq(0x80, and(b, 0x80)) {
} {
if eq(lt(sub(p, bs), length), 0) {
mstore(
0,
0x08c379a000000000000000000000000000000000000000000000000000000000
)
mstore(4, 32)
mstore(36, 15)
mstore(
68,
0x6c656e677468206f766572666c6f770000000000000000000000000000000000
)
revert(0, 83)
}
let tmp := mload(p)
let pos := 0
for {
} and(eq(0x80, and(b, 0x80)), lt(pos, 32)) {
} {
if eq(lt(sub(p, bs), length), 0) {
mstore(
0,
0x08c379a000000000000000000000000000000000000000000000000000000000
)
mstore(4, 32)
mstore(36, 15)
mstore(
68,
0x6c656e677468206f766572666c6f770000000000000000000000000000000000
)
revert(0, 83)
}
b := byte(pos, tmp)
x := or(x, shl(mul(7, sz), and(0x7f, b)))
sz := add(sz, 1)
pos := add(pos, 1)
p := add(p, 0x01)
}
}
}
return (x, sz);
}
function _decode_varints(uint256 p, bytes memory bs)
internal
pure
returns (int256, uint256)
{
(uint256 u, uint256 sz) = _decode_varint(p, bs);
int256 s;
assembly {
s := xor(shr(1, u), add(not(and(u, 1)), 1))
}
return (s, sz);
}
function _decode_uintf(uint256 p, bytes memory bs, uint256 sz)
internal
pure
returns (uint256, uint256)
{
uint256 x = 0;
uint256 length = bs.length + WORD_LENGTH;
assert(p + sz <= length);
assembly {
let i := 0
p := add(bs, p)
let tmp := mload(p)
for {
} lt(i, sz) {
} {
x := or(x, shl(mul(8, i), byte(i, tmp)))
p := add(p, 0x01)
i := add(i, 1)
}
}
return (x, sz);
}
function _decode_fixed32(uint256 p, bytes memory bs)
internal
pure
returns (uint32, uint256)
{
(uint256 x, uint256 sz) = _decode_uintf(p, bs, 4);
return (uint32(x), sz);
}
function _decode_fixed64(uint256 p, bytes memory bs)
internal
pure
returns (uint64, uint256)
{
(uint256 x, uint256 sz) = _decode_uintf(p, bs, 8);
return (uint64(x), sz);
}
function _decode_sfixed32(uint256 p, bytes memory bs)
internal
pure
returns (int32, uint256)
{
(uint256 x, uint256 sz) = _decode_uintf(p, bs, 4);
int256 r;
assembly {
r := x
}
return (int32(r), sz);
}
function _decode_sfixed64(uint256 p, bytes memory bs)
internal
pure
returns (int64, uint256)
{
(uint256 x, uint256 sz) = _decode_uintf(p, bs, 8);
int256 r;
assembly {
r := x
}
return (int64(r), sz);
}
function _decode_lendelim(uint256 p, bytes memory bs)
internal
pure
returns (bytes memory, uint256)
{
(uint256 len, uint256 sz) = _decode_varint(p, bs);
bytes memory b = new bytes(len);
uint256 length = bs.length + WORD_LENGTH;
assert(p + sz + len <= length);
uint256 sourcePtr;
uint256 destPtr;
assembly {
destPtr := add(b, 32)
sourcePtr := add(add(bs, p), sz)
}
copyBytes(sourcePtr, destPtr, len);
return (b, sz + len);
}
function _skip_field_decode(WireType wt, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
if (wt == ProtoBufRuntime.WireType.Fixed64) {
return 8;
} else if (wt == ProtoBufRuntime.WireType.Fixed32) {
return 4;
} else if (wt == ProtoBufRuntime.WireType.Varint) {
(, uint256 size) = ProtoBufRuntime._decode_varint(p, bs);
return size;
} else {
require(wt == ProtoBufRuntime.WireType.LengthDelim);
(uint256 len, uint256 size) = ProtoBufRuntime._decode_varint(p, bs);
return size + len;
}
}
function _encode_key(uint256 x, WireType wt, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
uint256 i;
assembly {
i := or(mul(x, 8), mod(wt, 8))
}
return _encode_varint(i, p, bs);
}
function _encode_varint(uint256 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
uint256 sz = 0;
assembly {
let bsptr := add(bs, p)
let byt := and(x, 0x7f)
for {
} gt(shr(7, x), 0) {
} {
mstore8(bsptr, or(0x80, byt))
bsptr := add(bsptr, 1)
sz := add(sz, 1)
x := shr(7, x)
byt := and(x, 0x7f)
}
mstore8(bsptr, byt)
sz := add(sz, 1)
}
return sz;
}
function _encode_varints(int256 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
uint256 encodedInt = _encode_zigzag(x);
return _encode_varint(encodedInt, p, bs);
}
function _encode_bytes(bytes memory xs, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
uint256 xsLength = xs.length;
uint256 sz = _encode_varint(xsLength, p, bs);
uint256 count = 0;
assembly {
let bsptr := add(bs, add(p, sz))
let xsptr := add(xs, 32)
for {
} lt(count, xsLength) {
} {
mstore8(bsptr, byte(0, mload(xsptr)))
bsptr := add(bsptr, 1)
xsptr := add(xsptr, 1)
count := add(count, 1)
}
}
return sz + count;
}
function _encode_string(string memory xs, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_bytes(bytes(xs), p, bs);
}
function _encode_uint32(uint32 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_varint(x, p, bs);
}
function _encode_uint64(uint64 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_varint(x, p, bs);
}
function _encode_int32(int32 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
uint64 twosComplement;
assembly {
twosComplement := x
}
return _encode_varint(twosComplement, p, bs);
}
function _encode_int64(int64 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
uint64 twosComplement;
assembly {
twosComplement := x
}
return _encode_varint(twosComplement, p, bs);
}
function _encode_enum(int32 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_int32(x, p, bs);
}
function _encode_bool(bool x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
if (x) {
return _encode_varint(1, p, bs);
} else return _encode_varint(0, p, bs);
}
function _encode_sint32(int32 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_varints(x, p, bs);
}
function _encode_sint64(int64 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_varints(x, p, bs);
}
function _encode_fixed32(uint32 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_uintf(x, p, bs, 4);
}
function _encode_fixed64(uint64 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_uintf(x, p, bs, 8);
}
function _encode_sfixed32(int32 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
uint32 twosComplement;
assembly {
twosComplement := x
}
return _encode_uintf(twosComplement, p, bs, 4);
}
function _encode_sfixed64(int64 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
uint64 twosComplement;
assembly {
twosComplement := x
}
return _encode_uintf(twosComplement, p, bs, 8);
}
function _encode_uintf(uint256 x, uint256 p, bytes memory bs, uint256 sz)
internal
pure
returns (uint256)
{
assembly {
let bsptr := add(sz, add(bs, p))
let count := sz
for {
} gt(count, 0) {
} {
bsptr := sub(bsptr, 1)
mstore8(bsptr, byte(sub(32, count), x))
count := sub(count, 1)
}
}
return sz;
}
function _encode_zigzag(int256 i) internal pure returns (uint256) {
if (i >= 0) {
return uint256(i) * 2;
} else return uint256(i * -2) - 1;
}
function _sz_lendelim(uint256 i) internal pure returns (uint256) {
return i + _sz_varint(i);
}
function _sz_key(uint256 i) internal pure returns (uint256) {
if (i < 16) {
return 1;
} else if (i < 2048) {
return 2;
} else if (i < 262144) {
return 3;
} else {
revert("not supported");
}
}
function _sz_varint(uint256 i) internal pure returns (uint256) {
uint256 count = 1;
assembly {
i := shr(7, i)
for {
} gt(i, 0) {
} {
i := shr(7, i)
count := add(count, 1)
}
}
return count;
}
function _sz_uint32(uint32 i) internal pure returns (uint256) {
return _sz_varint(i);
}
function _sz_uint64(uint64 i) internal pure returns (uint256) {
return _sz_varint(i);
}
function _sz_int32(int32 i) internal pure returns (uint256) {
if (i < 0) {
return 10;
} else return _sz_varint(uint32(i));
}
function _sz_int64(int64 i) internal pure returns (uint256) {
if (i < 0) {
return 10;
} else return _sz_varint(uint64(i));
}
function _sz_enum(int64 i) internal pure returns (uint256) {
if (i < 0) {
return 10;
} else return _sz_varint(uint64(i));
}
function _sz_sint32(int32 i) internal pure returns (uint256) {
return _sz_varint(_encode_zigzag(i));
}
function _sz_sint64(int64 i) internal pure returns (uint256) {
return _sz_varint(_encode_zigzag(i));
}
function _estimate_packed_repeated_uint32(uint32[] memory a) internal pure returns (uint256) {
uint256 e = 0;
for (uint i = 0; i < a.length; i++) {
e += _sz_uint32(a[i]);
}
return e;
}
function _estimate_packed_repeated_uint64(uint64[] memory a) internal pure returns (uint256) {
uint256 e = 0;
for (uint i = 0; i < a.length; i++) {
e += _sz_uint64(a[i]);
}
return e;
}
function _estimate_packed_repeated_int32(int32[] memory a) internal pure returns (uint256) {
uint256 e = 0;
for (uint i = 0; i < a.length; i++) {
e += _sz_int32(a[i]);
}
return e;
}
function _estimate_packed_repeated_int64(int64[] memory a) internal pure returns (uint256) {
uint256 e = 0;
for (uint i = 0; i < a.length; i++) {
e += _sz_int64(a[i]);
}
return e;
}
function _estimate_packed_repeated_sint32(int32[] memory a) internal pure returns (uint256) {
uint256 e = 0;
for (uint i = 0; i < a.length; i++) {
e += _sz_sint32(a[i]);
}
return e;
}
function _estimate_packed_repeated_sint64(int64[] memory a) internal pure returns (uint256) {
uint256 e = 0;
for (uint i = 0; i < a.length; i++) {
e += _sz_sint64(a[i]);
}
return e;
}
function _count_packed_repeated_varint(uint256 p, uint256 len, bytes memory bs) internal pure returns (uint256) {
uint256 count = 0;
uint256 end = p + len;
while (p < end) {
uint256 sz;
(, sz) = _decode_varint(p, bs);
p += sz;
count += 1;
}
return count;
}
function _decode_sol_bytesN_lower(uint8 n, uint256 p, bytes memory bs)
internal
pure
returns (bytes32, uint256)
{
uint256 r;
(uint256 len, uint256 sz) = _decode_varint(p, bs);
if (len + sz > n + 3) {
revert(OVERFLOW_MESSAGE);
}
p += 3;
assert(p < bs.length + WORD_LENGTH);
assembly {
r := mload(add(p, bs))
}
for (uint256 i = len - 2; i < WORD_LENGTH; i++) {
r /= 256;
}
return (bytes32(r), len + sz);
}
function _decode_sol_bytesN(uint8 n, uint256 p, bytes memory bs)
internal
pure
returns (bytes32, uint256)
{
(uint256 len, uint256 sz) = _decode_varint(p, bs);
uint256 wordLength = WORD_LENGTH;
uint256 byteSize = BYTE_SIZE;
if (len + sz > n + 3) {
revert(OVERFLOW_MESSAGE);
}
p += 3;
bytes32 acc;
assert(p < bs.length + WORD_LENGTH);
assembly {
acc := mload(add(p, bs))
let difference := sub(wordLength, sub(len, 2))
let bits := mul(byteSize, difference)
acc := shl(bits, shr(bits, acc))
}
return (acc, len + sz);
}
function _decode_sol_address(uint256 p, bytes memory bs)
internal
pure
returns (address, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytesN(20, p, bs);
return (address(bytes20(r)), sz);
}
function _decode_sol_bool(uint256 p, bytes memory bs)
internal
pure
returns (bool, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(1, p, bs);
if (r == 0) {
return (false, sz);
}
return (true, sz);
}
function _decode_sol_uint(uint256 p, bytes memory bs)
internal
pure
returns (uint256, uint256)
{
return _decode_sol_uint256(p, bs);
}
function _decode_sol_uintN(uint8 n, uint256 p, bytes memory bs)
internal
pure
returns (uint256, uint256)
{
(bytes32 u, uint256 sz) = _decode_sol_bytesN_lower(n, p, bs);
uint256 r;
assembly {
r := u
}
return (r, sz);
}
function _decode_sol_uint8(uint256 p, bytes memory bs)
internal
pure
returns (uint8, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(1, p, bs);
return (uint8(r), sz);
}
function _decode_sol_uint16(uint256 p, bytes memory bs)
internal
pure
returns (uint16, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(2, p, bs);
return (uint16(r), sz);
}
function _decode_sol_uint24(uint256 p, bytes memory bs)
internal
pure
returns (uint24, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(3, p, bs);
return (uint24(r), sz);
}
function _decode_sol_uint32(uint256 p, bytes memory bs)
internal
pure
returns (uint32, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(4, p, bs);
return (uint32(r), sz);
}
function _decode_sol_uint40(uint256 p, bytes memory bs)
internal
pure
returns (uint40, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(5, p, bs);
return (uint40(r), sz);
}
function _decode_sol_uint48(uint256 p, bytes memory bs)
internal
pure
returns (uint48, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(6, p, bs);
return (uint48(r), sz);
}
function _decode_sol_uint56(uint256 p, bytes memory bs)
internal
pure
returns (uint56, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(7, p, bs);
return (uint56(r), sz);
}
function _decode_sol_uint64(uint256 p, bytes memory bs)
internal
pure
returns (uint64, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(8, p, bs);
return (uint64(r), sz);
}
function _decode_sol_uint72(uint256 p, bytes memory bs)
internal
pure
returns (uint72, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(9, p, bs);
return (uint72(r), sz);
}
function _decode_sol_uint80(uint256 p, bytes memory bs)
internal
pure
returns (uint80, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(10, p, bs);
return (uint80(r), sz);
}
function _decode_sol_uint88(uint256 p, bytes memory bs)
internal
pure
returns (uint88, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(11, p, bs);
return (uint88(r), sz);
}
function _decode_sol_uint96(uint256 p, bytes memory bs)
internal
pure
returns (uint96, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(12, p, bs);
return (uint96(r), sz);
}
function _decode_sol_uint104(uint256 p, bytes memory bs)
internal
pure
returns (uint104, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(13, p, bs);
return (uint104(r), sz);
}
function _decode_sol_uint112(uint256 p, bytes memory bs)
internal
pure
returns (uint112, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(14, p, bs);
return (uint112(r), sz);
}
function _decode_sol_uint120(uint256 p, bytes memory bs)
internal
pure
returns (uint120, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(15, p, bs);
return (uint120(r), sz);
}
function _decode_sol_uint128(uint256 p, bytes memory bs)
internal
pure
returns (uint128, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(16, p, bs);
return (uint128(r), sz);
}
function _decode_sol_uint136(uint256 p, bytes memory bs)
internal
pure
returns (uint136, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(17, p, bs);
return (uint136(r), sz);
}
function _decode_sol_uint144(uint256 p, bytes memory bs)
internal
pure
returns (uint144, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(18, p, bs);
return (uint144(r), sz);
}
function _decode_sol_uint152(uint256 p, bytes memory bs)
internal
pure
returns (uint152, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(19, p, bs);
return (uint152(r), sz);
}
function _decode_sol_uint160(uint256 p, bytes memory bs)
internal
pure
returns (uint160, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(20, p, bs);
return (uint160(r), sz);
}
function _decode_sol_uint168(uint256 p, bytes memory bs)
internal
pure
returns (uint168, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(21, p, bs);
return (uint168(r), sz);
}
function _decode_sol_uint176(uint256 p, bytes memory bs)
internal
pure
returns (uint176, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(22, p, bs);
return (uint176(r), sz);
}
function _decode_sol_uint184(uint256 p, bytes memory bs)
internal
pure
returns (uint184, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(23, p, bs);
return (uint184(r), sz);
}
function _decode_sol_uint192(uint256 p, bytes memory bs)
internal
pure
returns (uint192, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(24, p, bs);
return (uint192(r), sz);
}
function _decode_sol_uint200(uint256 p, bytes memory bs)
internal
pure
returns (uint200, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(25, p, bs);
return (uint200(r), sz);
}
function _decode_sol_uint208(uint256 p, bytes memory bs)
internal
pure
returns (uint208, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(26, p, bs);
return (uint208(r), sz);
}
function _decode_sol_uint216(uint256 p, bytes memory bs)
internal
pure
returns (uint216, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(27, p, bs);
return (uint216(r), sz);
}
function _decode_sol_uint224(uint256 p, bytes memory bs)
internal
pure
returns (uint224, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(28, p, bs);
return (uint224(r), sz);
}
function _decode_sol_uint232(uint256 p, bytes memory bs)
internal
pure
returns (uint232, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(29, p, bs);
return (uint232(r), sz);
}
function _decode_sol_uint240(uint256 p, bytes memory bs)
internal
pure
returns (uint240, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(30, p, bs);
return (uint240(r), sz);
}
function _decode_sol_uint248(uint256 p, bytes memory bs)
internal
pure
returns (uint248, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(31, p, bs);
return (uint248(r), sz);
}
function _decode_sol_uint256(uint256 p, bytes memory bs)
internal
pure
returns (uint256, uint256)
{
(uint256 r, uint256 sz) = _decode_sol_uintN(32, p, bs);
return (uint256(r), sz);
}
function _decode_sol_int(uint256 p, bytes memory bs)
internal
pure
returns (int256, uint256)
{
return _decode_sol_int256(p, bs);
}
function _decode_sol_intN(uint8 n, uint256 p, bytes memory bs)
internal
pure
returns (int256, uint256)
{
(bytes32 u, uint256 sz) = _decode_sol_bytesN_lower(n, p, bs);
int256 r;
assembly {
r := u
r := signextend(sub(sz, 4), r)
}
return (r, sz);
}
function _decode_sol_bytes(uint8 n, uint256 p, bytes memory bs)
internal
pure
returns (bytes32, uint256)
{
(bytes32 u, uint256 sz) = _decode_sol_bytesN(n, p, bs);
return (u, sz);
}
function _decode_sol_int8(uint256 p, bytes memory bs)
internal
pure
returns (int8, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(1, p, bs);
return (int8(r), sz);
}
function _decode_sol_int16(uint256 p, bytes memory bs)
internal
pure
returns (int16, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(2, p, bs);
return (int16(r), sz);
}
function _decode_sol_int24(uint256 p, bytes memory bs)
internal
pure
returns (int24, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(3, p, bs);
return (int24(r), sz);
}
function _decode_sol_int32(uint256 p, bytes memory bs)
internal
pure
returns (int32, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(4, p, bs);
return (int32(r), sz);
}
function _decode_sol_int40(uint256 p, bytes memory bs)
internal
pure
returns (int40, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(5, p, bs);
return (int40(r), sz);
}
function _decode_sol_int48(uint256 p, bytes memory bs)
internal
pure
returns (int48, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(6, p, bs);
return (int48(r), sz);
}
function _decode_sol_int56(uint256 p, bytes memory bs)
internal
pure
returns (int56, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(7, p, bs);
return (int56(r), sz);
}
function _decode_sol_int64(uint256 p, bytes memory bs)
internal
pure
returns (int64, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(8, p, bs);
return (int64(r), sz);
}
function _decode_sol_int72(uint256 p, bytes memory bs)
internal
pure
returns (int72, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(9, p, bs);
return (int72(r), sz);
}
function _decode_sol_int80(uint256 p, bytes memory bs)
internal
pure
returns (int80, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(10, p, bs);
return (int80(r), sz);
}
function _decode_sol_int88(uint256 p, bytes memory bs)
internal
pure
returns (int88, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(11, p, bs);
return (int88(r), sz);
}
function _decode_sol_int96(uint256 p, bytes memory bs)
internal
pure
returns (int96, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(12, p, bs);
return (int96(r), sz);
}
function _decode_sol_int104(uint256 p, bytes memory bs)
internal
pure
returns (int104, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(13, p, bs);
return (int104(r), sz);
}
function _decode_sol_int112(uint256 p, bytes memory bs)
internal
pure
returns (int112, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(14, p, bs);
return (int112(r), sz);
}
function _decode_sol_int120(uint256 p, bytes memory bs)
internal
pure
returns (int120, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(15, p, bs);
return (int120(r), sz);
}
function _decode_sol_int128(uint256 p, bytes memory bs)
internal
pure
returns (int128, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(16, p, bs);
return (int128(r), sz);
}
function _decode_sol_int136(uint256 p, bytes memory bs)
internal
pure
returns (int136, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(17, p, bs);
return (int136(r), sz);
}
function _decode_sol_int144(uint256 p, bytes memory bs)
internal
pure
returns (int144, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(18, p, bs);
return (int144(r), sz);
}
function _decode_sol_int152(uint256 p, bytes memory bs)
internal
pure
returns (int152, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(19, p, bs);
return (int152(r), sz);
}
function _decode_sol_int160(uint256 p, bytes memory bs)
internal
pure
returns (int160, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(20, p, bs);
return (int160(r), sz);
}
function _decode_sol_int168(uint256 p, bytes memory bs)
internal
pure
returns (int168, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(21, p, bs);
return (int168(r), sz);
}
function _decode_sol_int176(uint256 p, bytes memory bs)
internal
pure
returns (int176, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(22, p, bs);
return (int176(r), sz);
}
function _decode_sol_int184(uint256 p, bytes memory bs)
internal
pure
returns (int184, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(23, p, bs);
return (int184(r), sz);
}
function _decode_sol_int192(uint256 p, bytes memory bs)
internal
pure
returns (int192, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(24, p, bs);
return (int192(r), sz);
}
function _decode_sol_int200(uint256 p, bytes memory bs)
internal
pure
returns (int200, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(25, p, bs);
return (int200(r), sz);
}
function _decode_sol_int208(uint256 p, bytes memory bs)
internal
pure
returns (int208, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(26, p, bs);
return (int208(r), sz);
}
function _decode_sol_int216(uint256 p, bytes memory bs)
internal
pure
returns (int216, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(27, p, bs);
return (int216(r), sz);
}
function _decode_sol_int224(uint256 p, bytes memory bs)
internal
pure
returns (int224, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(28, p, bs);
return (int224(r), sz);
}
function _decode_sol_int232(uint256 p, bytes memory bs)
internal
pure
returns (int232, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(29, p, bs);
return (int232(r), sz);
}
function _decode_sol_int240(uint256 p, bytes memory bs)
internal
pure
returns (int240, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(30, p, bs);
return (int240(r), sz);
}
function _decode_sol_int248(uint256 p, bytes memory bs)
internal
pure
returns (int248, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(31, p, bs);
return (int248(r), sz);
}
function _decode_sol_int256(uint256 p, bytes memory bs)
internal
pure
returns (int256, uint256)
{
(int256 r, uint256 sz) = _decode_sol_intN(32, p, bs);
return (int256(r), sz);
}
function _decode_sol_bytes1(uint256 p, bytes memory bs)
internal
pure
returns (bytes1, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(1, p, bs);
return (bytes1(r), sz);
}
function _decode_sol_bytes2(uint256 p, bytes memory bs)
internal
pure
returns (bytes2, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(2, p, bs);
return (bytes2(r), sz);
}
function _decode_sol_bytes3(uint256 p, bytes memory bs)
internal
pure
returns (bytes3, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(3, p, bs);
return (bytes3(r), sz);
}
function _decode_sol_bytes4(uint256 p, bytes memory bs)
internal
pure
returns (bytes4, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(4, p, bs);
return (bytes4(r), sz);
}
function _decode_sol_bytes5(uint256 p, bytes memory bs)
internal
pure
returns (bytes5, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(5, p, bs);
return (bytes5(r), sz);
}
function _decode_sol_bytes6(uint256 p, bytes memory bs)
internal
pure
returns (bytes6, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(6, p, bs);
return (bytes6(r), sz);
}
function _decode_sol_bytes7(uint256 p, bytes memory bs)
internal
pure
returns (bytes7, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(7, p, bs);
return (bytes7(r), sz);
}
function _decode_sol_bytes8(uint256 p, bytes memory bs)
internal
pure
returns (bytes8, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(8, p, bs);
return (bytes8(r), sz);
}
function _decode_sol_bytes9(uint256 p, bytes memory bs)
internal
pure
returns (bytes9, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(9, p, bs);
return (bytes9(r), sz);
}
function _decode_sol_bytes10(uint256 p, bytes memory bs)
internal
pure
returns (bytes10, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(10, p, bs);
return (bytes10(r), sz);
}
function _decode_sol_bytes11(uint256 p, bytes memory bs)
internal
pure
returns (bytes11, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(11, p, bs);
return (bytes11(r), sz);
}
function _decode_sol_bytes12(uint256 p, bytes memory bs)
internal
pure
returns (bytes12, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(12, p, bs);
return (bytes12(r), sz);
}
function _decode_sol_bytes13(uint256 p, bytes memory bs)
internal
pure
returns (bytes13, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(13, p, bs);
return (bytes13(r), sz);
}
function _decode_sol_bytes14(uint256 p, bytes memory bs)
internal
pure
returns (bytes14, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(14, p, bs);
return (bytes14(r), sz);
}
function _decode_sol_bytes15(uint256 p, bytes memory bs)
internal
pure
returns (bytes15, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(15, p, bs);
return (bytes15(r), sz);
}
function _decode_sol_bytes16(uint256 p, bytes memory bs)
internal
pure
returns (bytes16, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(16, p, bs);
return (bytes16(r), sz);
}
function _decode_sol_bytes17(uint256 p, bytes memory bs)
internal
pure
returns (bytes17, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(17, p, bs);
return (bytes17(r), sz);
}
function _decode_sol_bytes18(uint256 p, bytes memory bs)
internal
pure
returns (bytes18, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(18, p, bs);
return (bytes18(r), sz);
}
function _decode_sol_bytes19(uint256 p, bytes memory bs)
internal
pure
returns (bytes19, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(19, p, bs);
return (bytes19(r), sz);
}
function _decode_sol_bytes20(uint256 p, bytes memory bs)
internal
pure
returns (bytes20, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(20, p, bs);
return (bytes20(r), sz);
}
function _decode_sol_bytes21(uint256 p, bytes memory bs)
internal
pure
returns (bytes21, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(21, p, bs);
return (bytes21(r), sz);
}
function _decode_sol_bytes22(uint256 p, bytes memory bs)
internal
pure
returns (bytes22, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(22, p, bs);
return (bytes22(r), sz);
}
function _decode_sol_bytes23(uint256 p, bytes memory bs)
internal
pure
returns (bytes23, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(23, p, bs);
return (bytes23(r), sz);
}
function _decode_sol_bytes24(uint256 p, bytes memory bs)
internal
pure
returns (bytes24, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(24, p, bs);
return (bytes24(r), sz);
}
function _decode_sol_bytes25(uint256 p, bytes memory bs)
internal
pure
returns (bytes25, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(25, p, bs);
return (bytes25(r), sz);
}
function _decode_sol_bytes26(uint256 p, bytes memory bs)
internal
pure
returns (bytes26, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(26, p, bs);
return (bytes26(r), sz);
}
function _decode_sol_bytes27(uint256 p, bytes memory bs)
internal
pure
returns (bytes27, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(27, p, bs);
return (bytes27(r), sz);
}
function _decode_sol_bytes28(uint256 p, bytes memory bs)
internal
pure
returns (bytes28, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(28, p, bs);
return (bytes28(r), sz);
}
function _decode_sol_bytes29(uint256 p, bytes memory bs)
internal
pure
returns (bytes29, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(29, p, bs);
return (bytes29(r), sz);
}
function _decode_sol_bytes30(uint256 p, bytes memory bs)
internal
pure
returns (bytes30, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(30, p, bs);
return (bytes30(r), sz);
}
function _decode_sol_bytes31(uint256 p, bytes memory bs)
internal
pure
returns (bytes31, uint256)
{
(bytes32 r, uint256 sz) = _decode_sol_bytes(31, p, bs);
return (bytes31(r), sz);
}
function _decode_sol_bytes32(uint256 p, bytes memory bs)
internal
pure
returns (bytes32, uint256)
{
return _decode_sol_bytes(32, p, bs);
}
function _encode_sol_address(address x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(uint160(x)), 20, p, bs);
}
function _encode_sol_uint(uint256 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 32, p, bs);
}
function _encode_sol_uint8(uint8 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 1, p, bs);
}
function _encode_sol_uint16(uint16 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 2, p, bs);
}
function _encode_sol_uint24(uint24 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 3, p, bs);
}
function _encode_sol_uint32(uint32 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 4, p, bs);
}
function _encode_sol_uint40(uint40 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 5, p, bs);
}
function _encode_sol_uint48(uint48 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 6, p, bs);
}
function _encode_sol_uint56(uint56 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 7, p, bs);
}
function _encode_sol_uint64(uint64 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 8, p, bs);
}
function _encode_sol_uint72(uint72 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 9, p, bs);
}
function _encode_sol_uint80(uint80 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 10, p, bs);
}
function _encode_sol_uint88(uint88 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 11, p, bs);
}
function _encode_sol_uint96(uint96 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 12, p, bs);
}
function _encode_sol_uint104(uint104 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 13, p, bs);
}
function _encode_sol_uint112(uint112 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 14, p, bs);
}
function _encode_sol_uint120(uint120 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 15, p, bs);
}
function _encode_sol_uint128(uint128 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 16, p, bs);
}
function _encode_sol_uint136(uint136 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 17, p, bs);
}
function _encode_sol_uint144(uint144 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 18, p, bs);
}
function _encode_sol_uint152(uint152 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 19, p, bs);
}
function _encode_sol_uint160(uint160 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 20, p, bs);
}
function _encode_sol_uint168(uint168 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 21, p, bs);
}
function _encode_sol_uint176(uint176 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 22, p, bs);
}
function _encode_sol_uint184(uint184 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 23, p, bs);
}
function _encode_sol_uint192(uint192 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 24, p, bs);
}
function _encode_sol_uint200(uint200 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 25, p, bs);
}
function _encode_sol_uint208(uint208 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 26, p, bs);
}
function _encode_sol_uint216(uint216 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 27, p, bs);
}
function _encode_sol_uint224(uint224 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 28, p, bs);
}
function _encode_sol_uint232(uint232 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 29, p, bs);
}
function _encode_sol_uint240(uint240 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 30, p, bs);
}
function _encode_sol_uint248(uint248 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 31, p, bs);
}
function _encode_sol_uint256(uint256 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(uint256(x), 32, p, bs);
}
function _encode_sol_int(int256 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(x, 32, p, bs);
}
function _encode_sol_int8(int8 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 1, p, bs);
}
function _encode_sol_int16(int16 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 2, p, bs);
}
function _encode_sol_int24(int24 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 3, p, bs);
}
function _encode_sol_int32(int32 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 4, p, bs);
}
function _encode_sol_int40(int40 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 5, p, bs);
}
function _encode_sol_int48(int48 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 6, p, bs);
}
function _encode_sol_int56(int56 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 7, p, bs);
}
function _encode_sol_int64(int64 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 8, p, bs);
}
function _encode_sol_int72(int72 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 9, p, bs);
}
function _encode_sol_int80(int80 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 10, p, bs);
}
function _encode_sol_int88(int88 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 11, p, bs);
}
function _encode_sol_int96(int96 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 12, p, bs);
}
function _encode_sol_int104(int104 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 13, p, bs);
}
function _encode_sol_int112(int112 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 14, p, bs);
}
function _encode_sol_int120(int120 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 15, p, bs);
}
function _encode_sol_int128(int128 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 16, p, bs);
}
function _encode_sol_int136(int136 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 17, p, bs);
}
function _encode_sol_int144(int144 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 18, p, bs);
}
function _encode_sol_int152(int152 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 19, p, bs);
}
function _encode_sol_int160(int160 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 20, p, bs);
}
function _encode_sol_int168(int168 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 21, p, bs);
}
function _encode_sol_int176(int176 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 22, p, bs);
}
function _encode_sol_int184(int184 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 23, p, bs);
}
function _encode_sol_int192(int192 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 24, p, bs);
}
function _encode_sol_int200(int200 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 25, p, bs);
}
function _encode_sol_int208(int208 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 26, p, bs);
}
function _encode_sol_int216(int216 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 27, p, bs);
}
function _encode_sol_int224(int224 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 28, p, bs);
}
function _encode_sol_int232(int232 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 29, p, bs);
}
function _encode_sol_int240(int240 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 30, p, bs);
}
function _encode_sol_int248(int248 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(int256(x), 31, p, bs);
}
function _encode_sol_int256(int256 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol(x, 32, p, bs);
}
function _encode_sol_bytes1(bytes1 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 1, p, bs);
}
function _encode_sol_bytes2(bytes2 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 2, p, bs);
}
function _encode_sol_bytes3(bytes3 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 3, p, bs);
}
function _encode_sol_bytes4(bytes4 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 4, p, bs);
}
function _encode_sol_bytes5(bytes5 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 5, p, bs);
}
function _encode_sol_bytes6(bytes6 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 6, p, bs);
}
function _encode_sol_bytes7(bytes7 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 7, p, bs);
}
function _encode_sol_bytes8(bytes8 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 8, p, bs);
}
function _encode_sol_bytes9(bytes9 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 9, p, bs);
}
function _encode_sol_bytes10(bytes10 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 10, p, bs);
}
function _encode_sol_bytes11(bytes11 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 11, p, bs);
}
function _encode_sol_bytes12(bytes12 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 12, p, bs);
}
function _encode_sol_bytes13(bytes13 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 13, p, bs);
}
function _encode_sol_bytes14(bytes14 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 14, p, bs);
}
function _encode_sol_bytes15(bytes15 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 15, p, bs);
}
function _encode_sol_bytes16(bytes16 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 16, p, bs);
}
function _encode_sol_bytes17(bytes17 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 17, p, bs);
}
function _encode_sol_bytes18(bytes18 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 18, p, bs);
}
function _encode_sol_bytes19(bytes19 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 19, p, bs);
}
function _encode_sol_bytes20(bytes20 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 20, p, bs);
}
function _encode_sol_bytes21(bytes21 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 21, p, bs);
}
function _encode_sol_bytes22(bytes22 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 22, p, bs);
}
function _encode_sol_bytes23(bytes23 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 23, p, bs);
}
function _encode_sol_bytes24(bytes24 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 24, p, bs);
}
function _encode_sol_bytes25(bytes25 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 25, p, bs);
}
function _encode_sol_bytes26(bytes26 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 26, p, bs);
}
function _encode_sol_bytes27(bytes27 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 27, p, bs);
}
function _encode_sol_bytes28(bytes28 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 28, p, bs);
}
function _encode_sol_bytes29(bytes29 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 29, p, bs);
}
function _encode_sol_bytes30(bytes30 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 30, p, bs);
}
function _encode_sol_bytes31(bytes31 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(bytes32(x), 31, p, bs);
}
function _encode_sol_bytes32(bytes32 x, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
return _encode_sol_bytes(x, 32, p, bs);
}
function _encode_sol_header(uint256 sz, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
uint256 offset = p;
p += _encode_varint(sz + 2, p, bs);
p += _encode_key(1, WireType.LengthDelim, p, bs);
p += _encode_varint(sz, p, bs);
return p - offset;
}
function _encode_sol(uint256 x, uint256 sz, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
uint256 offset = p;
uint256 size;
p += 3;
size = _encode_sol_raw_other(x, p, bs, sz);
p += size;
_encode_sol_header(size, offset, bs);
return p - offset;
}
function _encode_sol(int256 x, uint256 sz, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
uint256 offset = p;
uint256 size;
p += 3;
size = _encode_sol_raw_other(x, p, bs, sz);
p += size;
_encode_sol_header(size, offset, bs);
return p - offset;
}
function _encode_sol_bytes(bytes32 x, uint256 sz, uint256 p, bytes memory bs)
internal
pure
returns (uint256)
{
uint256 offset = p;
uint256 size;
p += 3;
size = _encode_sol_raw_bytes_array(x, p, bs, sz);
p += size;
_encode_sol_header(size, offset, bs);
return p - offset;
}
function _get_real_size(uint256 x, uint256 sz)
internal
pure
returns (uint256)
{
uint256 base = 0xff;
uint256 realSize = sz;
while (
x & (base << (realSize * BYTE_SIZE - BYTE_SIZE)) == 0 && realSize > 0
) {
realSize -= 1;
}
if (realSize == 0) {
realSize = 1;
}
return realSize;
}
function _get_real_size(int256 x, uint256 sz)
internal
pure
returns (uint256)
{
int256 base = 0xff;
if (x >= 0) {
uint256 tmp = _get_real_size(uint256(x), sz);
int256 remainder = (x & (base << (tmp * BYTE_SIZE - BYTE_SIZE))) >>
(tmp * BYTE_SIZE - BYTE_SIZE);
if (remainder >= 128) {
tmp += 1;
}
return tmp;
}
uint256 realSize = sz;
while (
x & (base << (realSize * BYTE_SIZE - BYTE_SIZE)) ==
(base << (realSize * BYTE_SIZE - BYTE_SIZE)) &&
realSize > 0
) {
realSize -= 1;
}
{
int256 remainder = (x & (base << (realSize * BYTE_SIZE - BYTE_SIZE))) >>
(realSize * BYTE_SIZE - BYTE_SIZE);
if (remainder < 128) {
realSize += 1;
}
}
return realSize;
}
function _encode_sol_raw_bytes_array(
bytes32 x,
uint256 p,
bytes memory bs,
uint256 sz
) internal pure returns (uint256) {
uint256 actualSize = sz;
for (uint256 i = 0; i < sz; i++) {
uint8 current = uint8(x[sz - 1 - i]);
if (current == 0 && actualSize > 1) {
actualSize--;
} else {
break;
}
}
assembly {
let bsptr := add(bs, p)
let count := actualSize
for {
} gt(count, 0) {
} {
mstore8(bsptr, byte(sub(actualSize, count), x))
bsptr := add(bsptr, 1)
count := sub(count, 1)
}
}
return actualSize;
}
function _encode_sol_raw_other(
int256 x,
uint256 p,
bytes memory bs,
uint256 sz
) internal pure returns (uint256) {
uint256 realSize = _get_real_size(x, sz);
assembly {
let bsptr := add(bs, p)
let count := realSize
for {
} gt(count, 0) {
} {
mstore8(bsptr, byte(sub(32, count), x))
bsptr := add(bsptr, 1)
count := sub(count, 1)
}
}
return realSize;
}
function _encode_sol_raw_other(
uint256 x,
uint256 p,
bytes memory bs,
uint256 sz
) internal pure returns (uint256) {
uint256 realSize = _get_real_size(x, sz);
assembly {
let bsptr := add(bs, p)
let count := realSize
for {
} gt(count, 0) {
} {
mstore8(bsptr, byte(sub(32, count), x))
bsptr := add(bsptr, 1)
count := sub(count, 1)
}
}
return realSize;
}
}
文件 41 的 43:SafeCast.sol
pragma solidity ^0.8.20;
library SafeCast {
error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);
error SafeCastOverflowedIntToUint(int256 value);
error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);
error SafeCastOverflowedUintToInt(uint256 value);
function toUint248(uint256 value) internal pure returns (uint248) {
if (value > type(uint248).max) {
revert SafeCastOverflowedUintDowncast(248, value);
}
return uint248(value);
}
function toUint240(uint256 value) internal pure returns (uint240) {
if (value > type(uint240).max) {
revert SafeCastOverflowedUintDowncast(240, value);
}
return uint240(value);
}
function toUint232(uint256 value) internal pure returns (uint232) {
if (value > type(uint232).max) {
revert SafeCastOverflowedUintDowncast(232, value);
}
return uint232(value);
}
function toUint224(uint256 value) internal pure returns (uint224) {
if (value > type(uint224).max) {
revert SafeCastOverflowedUintDowncast(224, value);
}
return uint224(value);
}
function toUint216(uint256 value) internal pure returns (uint216) {
if (value > type(uint216).max) {
revert SafeCastOverflowedUintDowncast(216, value);
}
return uint216(value);
}
function toUint208(uint256 value) internal pure returns (uint208) {
if (value > type(uint208).max) {
revert SafeCastOverflowedUintDowncast(208, value);
}
return uint208(value);
}
function toUint200(uint256 value) internal pure returns (uint200) {
if (value > type(uint200).max) {
revert SafeCastOverflowedUintDowncast(200, value);
}
return uint200(value);
}
function toUint192(uint256 value) internal pure returns (uint192) {
if (value > type(uint192).max) {
revert SafeCastOverflowedUintDowncast(192, value);
}
return uint192(value);
}
function toUint184(uint256 value) internal pure returns (uint184) {
if (value > type(uint184).max) {
revert SafeCastOverflowedUintDowncast(184, value);
}
return uint184(value);
}
function toUint176(uint256 value) internal pure returns (uint176) {
if (value > type(uint176).max) {
revert SafeCastOverflowedUintDowncast(176, value);
}
return uint176(value);
}
function toUint168(uint256 value) internal pure returns (uint168) {
if (value > type(uint168).max) {
revert SafeCastOverflowedUintDowncast(168, value);
}
return uint168(value);
}
function toUint160(uint256 value) internal pure returns (uint160) {
if (value > type(uint160).max) {
revert SafeCastOverflowedUintDowncast(160, value);
}
return uint160(value);
}
function toUint152(uint256 value) internal pure returns (uint152) {
if (value > type(uint152).max) {
revert SafeCastOverflowedUintDowncast(152, value);
}
return uint152(value);
}
function toUint144(uint256 value) internal pure returns (uint144) {
if (value > type(uint144).max) {
revert SafeCastOverflowedUintDowncast(144, value);
}
return uint144(value);
}
function toUint136(uint256 value) internal pure returns (uint136) {
if (value > type(uint136).max) {
revert SafeCastOverflowedUintDowncast(136, value);
}
return uint136(value);
}
function toUint128(uint256 value) internal pure returns (uint128) {
if (value > type(uint128).max) {
revert SafeCastOverflowedUintDowncast(128, value);
}
return uint128(value);
}
function toUint120(uint256 value) internal pure returns (uint120) {
if (value > type(uint120).max) {
revert SafeCastOverflowedUintDowncast(120, value);
}
return uint120(value);
}
function toUint112(uint256 value) internal pure returns (uint112) {
if (value > type(uint112).max) {
revert SafeCastOverflowedUintDowncast(112, value);
}
return uint112(value);
}
function toUint104(uint256 value) internal pure returns (uint104) {
if (value > type(uint104).max) {
revert SafeCastOverflowedUintDowncast(104, value);
}
return uint104(value);
}
function toUint96(uint256 value) internal pure returns (uint96) {
if (value > type(uint96).max) {
revert SafeCastOverflowedUintDowncast(96, value);
}
return uint96(value);
}
function toUint88(uint256 value) internal pure returns (uint88) {
if (value > type(uint88).max) {
revert SafeCastOverflowedUintDowncast(88, value);
}
return uint88(value);
}
function toUint80(uint256 value) internal pure returns (uint80) {
if (value > type(uint80).max) {
revert SafeCastOverflowedUintDowncast(80, value);
}
return uint80(value);
}
function toUint72(uint256 value) internal pure returns (uint72) {
if (value > type(uint72).max) {
revert SafeCastOverflowedUintDowncast(72, value);
}
return uint72(value);
}
function toUint64(uint256 value) internal pure returns (uint64) {
if (value > type(uint64).max) {
revert SafeCastOverflowedUintDowncast(64, value);
}
return uint64(value);
}
function toUint56(uint256 value) internal pure returns (uint56) {
if (value > type(uint56).max) {
revert SafeCastOverflowedUintDowncast(56, value);
}
return uint56(value);
}
function toUint48(uint256 value) internal pure returns (uint48) {
if (value > type(uint48).max) {
revert SafeCastOverflowedUintDowncast(48, value);
}
return uint48(value);
}
function toUint40(uint256 value) internal pure returns (uint40) {
if (value > type(uint40).max) {
revert SafeCastOverflowedUintDowncast(40, value);
}
return uint40(value);
}
function toUint32(uint256 value) internal pure returns (uint32) {
if (value > type(uint32).max) {
revert SafeCastOverflowedUintDowncast(32, value);
}
return uint32(value);
}
function toUint24(uint256 value) internal pure returns (uint24) {
if (value > type(uint24).max) {
revert SafeCastOverflowedUintDowncast(24, value);
}
return uint24(value);
}
function toUint16(uint256 value) internal pure returns (uint16) {
if (value > type(uint16).max) {
revert SafeCastOverflowedUintDowncast(16, value);
}
return uint16(value);
}
function toUint8(uint256 value) internal pure returns (uint8) {
if (value > type(uint8).max) {
revert SafeCastOverflowedUintDowncast(8, value);
}
return uint8(value);
}
function toUint256(int256 value) internal pure returns (uint256) {
if (value < 0) {
revert SafeCastOverflowedIntToUint(value);
}
return uint256(value);
}
function toInt248(int256 value) internal pure returns (int248 downcasted) {
downcasted = int248(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(248, value);
}
}
function toInt240(int256 value) internal pure returns (int240 downcasted) {
downcasted = int240(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(240, value);
}
}
function toInt232(int256 value) internal pure returns (int232 downcasted) {
downcasted = int232(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(232, value);
}
}
function toInt224(int256 value) internal pure returns (int224 downcasted) {
downcasted = int224(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(224, value);
}
}
function toInt216(int256 value) internal pure returns (int216 downcasted) {
downcasted = int216(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(216, value);
}
}
function toInt208(int256 value) internal pure returns (int208 downcasted) {
downcasted = int208(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(208, value);
}
}
function toInt200(int256 value) internal pure returns (int200 downcasted) {
downcasted = int200(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(200, value);
}
}
function toInt192(int256 value) internal pure returns (int192 downcasted) {
downcasted = int192(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(192, value);
}
}
function toInt184(int256 value) internal pure returns (int184 downcasted) {
downcasted = int184(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(184, value);
}
}
function toInt176(int256 value) internal pure returns (int176 downcasted) {
downcasted = int176(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(176, value);
}
}
function toInt168(int256 value) internal pure returns (int168 downcasted) {
downcasted = int168(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(168, value);
}
}
function toInt160(int256 value) internal pure returns (int160 downcasted) {
downcasted = int160(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(160, value);
}
}
function toInt152(int256 value) internal pure returns (int152 downcasted) {
downcasted = int152(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(152, value);
}
}
function toInt144(int256 value) internal pure returns (int144 downcasted) {
downcasted = int144(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(144, value);
}
}
function toInt136(int256 value) internal pure returns (int136 downcasted) {
downcasted = int136(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(136, value);
}
}
function toInt128(int256 value) internal pure returns (int128 downcasted) {
downcasted = int128(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(128, value);
}
}
function toInt120(int256 value) internal pure returns (int120 downcasted) {
downcasted = int120(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(120, value);
}
}
function toInt112(int256 value) internal pure returns (int112 downcasted) {
downcasted = int112(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(112, value);
}
}
function toInt104(int256 value) internal pure returns (int104 downcasted) {
downcasted = int104(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(104, value);
}
}
function toInt96(int256 value) internal pure returns (int96 downcasted) {
downcasted = int96(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(96, value);
}
}
function toInt88(int256 value) internal pure returns (int88 downcasted) {
downcasted = int88(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(88, value);
}
}
function toInt80(int256 value) internal pure returns (int80 downcasted) {
downcasted = int80(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(80, value);
}
}
function toInt72(int256 value) internal pure returns (int72 downcasted) {
downcasted = int72(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(72, value);
}
}
function toInt64(int256 value) internal pure returns (int64 downcasted) {
downcasted = int64(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(64, value);
}
}
function toInt56(int256 value) internal pure returns (int56 downcasted) {
downcasted = int56(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(56, value);
}
}
function toInt48(int256 value) internal pure returns (int48 downcasted) {
downcasted = int48(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(48, value);
}
}
function toInt40(int256 value) internal pure returns (int40 downcasted) {
downcasted = int40(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(40, value);
}
}
function toInt32(int256 value) internal pure returns (int32 downcasted) {
downcasted = int32(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(32, value);
}
}
function toInt24(int256 value) internal pure returns (int24 downcasted) {
downcasted = int24(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(24, value);
}
}
function toInt16(int256 value) internal pure returns (int16 downcasted) {
downcasted = int16(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(16, value);
}
}
function toInt8(int256 value) internal pure returns (int8 downcasted) {
downcasted = int8(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(8, value);
}
}
function toInt256(uint256 value) internal pure returns (int256) {
if (value > uint256(type(int256).max)) {
revert SafeCastOverflowedUintToInt(value);
}
return int256(value);
}
function toUint(bool b) internal pure returns (uint256 u) {
assembly ("memory-safe") {
u := iszero(iszero(b))
}
}
}
文件 42 的 43:SignedMath.sol
pragma solidity ^0.8.20;
import {SafeCast} from "./SafeCast.sol";
library SignedMath {
function ternary(bool condition, int256 a, int256 b) internal pure returns (int256) {
unchecked {
return b ^ ((a ^ b) * int256(SafeCast.toUint(condition)));
}
}
function max(int256 a, int256 b) internal pure returns (int256) {
return ternary(a > b, a, b);
}
function min(int256 a, int256 b) internal pure returns (int256) {
return ternary(a < b, a, b);
}
function average(int256 a, int256 b) internal pure returns (int256) {
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
function abs(int256 n) internal pure returns (uint256) {
unchecked {
int256 mask = n >> 255;
return uint256((n + mask) ^ mask);
}
}
}
文件 43 的 43:Strings.sol
pragma solidity ^0.8.20;
import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";
library Strings {
bytes16 private constant HEX_DIGITS = "0123456789abcdef";
uint8 private constant ADDRESS_LENGTH = 20;
error StringsInsufficientHexLength(uint256 value, uint256 length);
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
assembly ("memory-safe") {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
assembly ("memory-safe") {
mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
function toStringSigned(int256 value) internal pure returns (string memory) {
return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
}
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
uint256 localValue = value;
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = HEX_DIGITS[localValue & 0xf];
localValue >>= 4;
}
if (localValue != 0) {
revert StringsInsufficientHexLength(value, length);
}
return string(buffer);
}
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);
}
function toChecksumHexString(address addr) internal pure returns (string memory) {
bytes memory buffer = bytes(toHexString(addr));
uint256 hashValue;
assembly ("memory-safe") {
hashValue := shr(96, keccak256(add(buffer, 0x22), 40))
}
for (uint256 i = 41; i > 1; --i) {
if (hashValue & 0xf > 7 && uint8(buffer[i]) > 96) {
buffer[i] ^= 0x20;
}
hashValue >>= 4;
}
return string(buffer);
}
function equal(string memory a, string memory b) internal pure returns (bool) {
return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
}
}
{
"compilationTarget": {
"@hyperledger-labs/yui-ibc-solidity/contracts/core/25-handler/OwnableIBCHandler.sol": "OwnableIBCHandler"
},
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"contract IIBCClient","name":"ibcClient_","type":"address"},{"internalType":"contract IIBCConnection","name":"ibcConnection_","type":"address"},{"internalType":"contract IIBCChannelHandshake","name":"ibcChannelHandshake_","type":"address"},{"internalType":"contract IIBCChannelPacketSendRecv","name":"ibcChannelPacketSendRecv_","type":"address"},{"internalType":"contract IIBCChannelPacketTimeout","name":"ibcChannelPacketTimeout_","type":"address"},{"internalType":"contract IIBCChannelUpgradeInitTryAck","name":"ibcChannelUpgradeInitTryAck_","type":"address"},{"internalType":"contract IIBCChannelUpgradeConfirmOpenTimeoutCancel","name":"ibcChannelUpgradeConfirmOpenTimeoutCancel_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint64","name":"sequence","type":"uint64"},{"internalType":"uint64","name":"ackStartSequence","type":"uint64"}],"name":"IBCChannelAckAlreadyProcessedInPreviousUpgrade","type":"error"},{"inputs":[{"internalType":"string","name":"destinationPort","type":"string"},{"internalType":"string","name":"destinationChannel","type":"string"},{"internalType":"uint64","name":"sequence","type":"uint64"}],"name":"IBCChannelAcknowledgementAlreadyWritten","type":"error"},{"inputs":[{"internalType":"uint64","name":"sequence","type":"uint64"},{"internalType":"uint64","name":"counterpartyNextSequenceSend","type":"uint64"}],"name":"IBCChannelCannotRecvNextUpgradePacket","type":"error"},{"inputs":[{"internalType":"string","name":"portId","type":"string"},{"internalType":"string","name":"channelId","type":"string"}],"name":"IBCChannelChannelNotFound","type":"error"},{"inputs":[{"internalType":"enum Channel.Order","name":"ordering","type":"uint8"}],"name":"IBCChannelConnectionFeatureNotSupported","type":"error"},{"inputs":[{"internalType":"string","name":"connectionId","type":"string"},{"internalType":"uint256","name":"length","type":"uint256"}],"name":"IBCChannelConnectionMultipleVersionsFound","type":"error"},{"inputs":[{"internalType":"string","name":"connectionId","type":"string"}],"name":"IBCChannelConnectionNotOpened","type":"error"},{"inputs":[{"internalType":"string","name":"counterpartyChannelId","type":"string"}],"name":"IBCChannelCounterpartyChannelIdNotEmpty","type":"error"},{"inputs":[],"name":"IBCChannelEmptyAcknowledgement","type":"error"},{"inputs":[{"internalType":"string","name":"clientId","type":"string"},{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"bytes","name":"value","type":"bytes"},{"internalType":"bytes","name":"proof","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"height","type":"tuple"}],"name":"IBCChannelFailedVerifyChannelState","type":"error"},{"inputs":[{"internalType":"string","name":"clientId","type":"string"},{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"uint64","name":"nextSequenceRecv","type":"uint64"},{"internalType":"bytes","name":"proof","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"height","type":"tuple"}],"name":"IBCChannelFailedVerifyNextSequenceRecv","type":"error"},{"inputs":[{"internalType":"string","name":"clientId","type":"string"},{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"bytes32","name":"commitment","type":"bytes32"},{"internalType":"bytes","name":"proof","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"height","type":"tuple"}],"name":"IBCChannelFailedVerifyPacketAcknowledgement","type":"error"},{"inputs":[{"internalType":"string","name":"clientId","type":"string"},{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"bytes32","name":"commitment","type":"bytes32"},{"internalType":"bytes","name":"proof","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"height","type":"tuple"}],"name":"IBCChannelFailedVerifyPacketCommitment","type":"error"},{"inputs":[{"internalType":"string","name":"clientId","type":"string"},{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"bytes","name":"proof","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"height","type":"tuple"}],"name":"IBCChannelFailedVerifyPacketReceiptAbsence","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"IBCChannelInvalidConnectionHopsLength","type":"error"},{"inputs":[{"internalType":"uint64","name":"sequence","type":"uint64"},{"internalType":"uint64","name":"recvStartSequence","type":"uint64"}],"name":"IBCChannelPacketAlreadyProcessInPreviousUpgrade","type":"error"},{"inputs":[{"internalType":"bytes32","name":"expected","type":"bytes32"},{"internalType":"bytes32","name":"actual","type":"bytes32"}],"name":"IBCChannelPacketCommitmentMismatch","type":"error"},{"inputs":[{"internalType":"string","name":"portId","type":"string"},{"internalType":"string","name":"channelId","type":"string"},{"internalType":"uint64","name":"sequence","type":"uint64"}],"name":"IBCChannelPacketCommitmentNotFound","type":"error"},{"inputs":[{"internalType":"uint64","name":"sequence","type":"uint64"},{"internalType":"uint64","name":"nextSequenceRecv","type":"uint64"}],"name":"IBCChannelPacketMaybeAlreadyReceived","type":"error"},{"inputs":[{"internalType":"string","name":"destinationPort","type":"string"},{"internalType":"string","name":"destinationChannel","type":"string"},{"internalType":"uint64","name":"sequence","type":"uint64"}],"name":"IBCChannelPacketReceiptAlreadyExists","type":"error"},{"inputs":[{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"timeoutHeight","type":"tuple"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"latestHeight","type":"tuple"}],"name":"IBCChannelPastPacketTimeoutHeight","type":"error"},{"inputs":[{"internalType":"uint64","name":"timeoutTimestamp","type":"uint64"},{"internalType":"uint64","name":"latestTimestamp","type":"uint64"}],"name":"IBCChannelPastPacketTimeoutTimestamp","type":"error"},{"inputs":[],"name":"IBCChannelTimeoutNotReached","type":"error"},{"inputs":[{"internalType":"uint256","name":"currentBlockNumber","type":"uint256"},{"internalType":"uint64","name":"timeoutHeight","type":"uint64"}],"name":"IBCChannelTimeoutPacketHeight","type":"error"},{"inputs":[{"internalType":"uint256","name":"currentTimestamp","type":"uint256"},{"internalType":"uint64","name":"timeoutTimestamp","type":"uint64"}],"name":"IBCChannelTimeoutPacketTimestamp","type":"error"},{"inputs":[{"internalType":"enum Channel.State","name":"state","type":"uint8"}],"name":"IBCChannelUnexpectedChannelState","type":"error"},{"inputs":[{"internalType":"uint64","name":"expected","type":"uint64"}],"name":"IBCChannelUnexpectedNextSequenceAck","type":"error"},{"inputs":[{"internalType":"uint64","name":"expected","type":"uint64"}],"name":"IBCChannelUnexpectedNextSequenceRecv","type":"error"},{"inputs":[{"internalType":"string","name":"destinationPort","type":"string"},{"internalType":"string","name":"destinationChannel","type":"string"}],"name":"IBCChannelUnexpectedPacketDestination","type":"error"},{"inputs":[{"internalType":"string","name":"sourcePort","type":"string"},{"internalType":"string","name":"sourceChannel","type":"string"}],"name":"IBCChannelUnexpectedPacketSource","type":"error"},{"inputs":[{"internalType":"enum Channel.Order","name":"ordering","type":"uint8"}],"name":"IBCChannelUnknownChannelOrder","type":"error"},{"inputs":[{"internalType":"bytes32","name":"commitment","type":"bytes32"}],"name":"IBCChannelUnknownPacketReceiptCommitment","type":"error"},{"inputs":[],"name":"IBCChannelUpgradeCounterpartyAlreadyFlushCompleted","type":"error"},{"inputs":[],"name":"IBCChannelUpgradeCounterpartyAlreadyUpgraded","type":"error"},{"inputs":[{"internalType":"enum Channel.State","name":"state","type":"uint8"}],"name":"IBCChannelUpgradeCounterpartyNotFlushingOrFlushcomplete","type":"error"},{"inputs":[{"internalType":"enum Channel.State","name":"state","type":"uint8"}],"name":"IBCChannelUpgradeCounterpartyNotOpenOrFlushcomplete","type":"error"},{"inputs":[],"name":"IBCChannelUpgradeErrorReceiptEmpty","type":"error"},{"inputs":[{"internalType":"string","name":"clientId","type":"string"},{"internalType":"string","name":"path","type":"string"},{"internalType":"bytes","name":"value","type":"bytes"},{"internalType":"bytes","name":"proof","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"height","type":"tuple"}],"name":"IBCChannelUpgradeFailedVerifyMembership","type":"error"},{"inputs":[],"name":"IBCChannelUpgradeIncompatibleProposal","type":"error"},{"inputs":[],"name":"IBCChannelUpgradeInvalidErrorReceiptSequence","type":"error"},{"inputs":[],"name":"IBCChannelUpgradeInvalidTimeout","type":"error"},{"inputs":[],"name":"IBCChannelUpgradeInvalidUpgradeFields","type":"error"},{"inputs":[],"name":"IBCChannelUpgradeNoChanges","type":"error"},{"inputs":[],"name":"IBCChannelUpgradeNoExistingUpgrade","type":"error"},{"inputs":[{"internalType":"enum Channel.State","name":"state","type":"uint8"}],"name":"IBCChannelUpgradeNotFlushcomplete","type":"error"},{"inputs":[{"internalType":"enum Channel.State","name":"state","type":"uint8"}],"name":"IBCChannelUpgradeNotFlushing","type":"error"},{"inputs":[{"internalType":"enum Channel.State","name":"state","type":"uint8"}],"name":"IBCChannelUpgradeNotOpenOrFlushing","type":"error"},{"inputs":[],"name":"IBCChannelUpgradeOldCounterpartyUpgradeSequence","type":"error"},{"inputs":[],"name":"IBCChannelUpgradeOldErrorReceiptSequence","type":"error"},{"inputs":[],"name":"IBCChannelUpgradeTimeoutHeightNotReached","type":"error"},{"inputs":[],"name":"IBCChannelUpgradeTimeoutTimestampNotReached","type":"error"},{"inputs":[],"name":"IBCChannelUpgradeTimeoutUnallowedState","type":"error"},{"inputs":[],"name":"IBCChannelUpgradeTryProposedConnectionHopsEmpty","type":"error"},{"inputs":[],"name":"IBCChannelUpgradeTryProposedConnectionHopsMismatch","type":"error"},{"inputs":[{"internalType":"address","name":"upgrader","type":"address"}],"name":"IBCChannelUpgradeUnauthorizedChannelUpgrader","type":"error"},{"inputs":[{"internalType":"enum Channel.Order","name":"ordering","type":"uint8"}],"name":"IBCChannelUpgradeUnsupportedOrdering","type":"error"},{"inputs":[{"internalType":"uint64","name":"latestSequence","type":"uint64"},{"internalType":"uint64","name":"sequence","type":"uint64"}],"name":"IBCChannelUpgradeWriteOldErrorReceiptSequence","type":"error"},{"inputs":[],"name":"IBCChannelZeroPacketTimeout","type":"error"},{"inputs":[{"internalType":"string","name":"clientId","type":"string"}],"name":"IBCClientClientNotFound","type":"error"},{"inputs":[{"internalType":"string","name":"clientId","type":"string"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"consensusHeight","type":"tuple"}],"name":"IBCClientConsensusStateNotFound","type":"error"},{"inputs":[{"internalType":"bytes4","name":"selector","type":"bytes4"},{"internalType":"bytes","name":"args","type":"bytes"}],"name":"IBCClientFailedUpdateClient","type":"error"},{"inputs":[{"internalType":"string","name":"clientId","type":"string"}],"name":"IBCClientNotActiveClient","type":"error"},{"inputs":[{"internalType":"string","name":"clientType","type":"string"}],"name":"IBCClientUnregisteredClientType","type":"error"},{"inputs":[],"name":"IBCConnectionAlreadyConnectionExists","type":"error"},{"inputs":[],"name":"IBCConnectionEmptyConnectionCounterpartyVersions","type":"error"},{"inputs":[{"internalType":"string","name":"clientId","type":"string"},{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"bytes","name":"value","type":"bytes"},{"internalType":"bytes","name":"proof","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"height","type":"tuple"}],"name":"IBCConnectionFailedVerifyClientConsensusState","type":"error"},{"inputs":[{"internalType":"string","name":"clientId","type":"string"},{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"bytes","name":"value","type":"bytes"},{"internalType":"bytes","name":"proof","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"height","type":"tuple"}],"name":"IBCConnectionFailedVerifyClientState","type":"error"},{"inputs":[{"internalType":"string","name":"clientId","type":"string"},{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"bytes","name":"value","type":"bytes"},{"internalType":"bytes","name":"proof","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"height","type":"tuple"}],"name":"IBCConnectionFailedVerifyConnectionState","type":"error"},{"inputs":[],"name":"IBCConnectionIBCVersionNotSupported","type":"error"},{"inputs":[{"internalType":"string","name":"counterpartyConnectionId","type":"string"}],"name":"IBCConnectionInvalidCounterpartyConnectionIdentifier","type":"error"},{"inputs":[],"name":"IBCConnectionInvalidHostConsensusStateProof","type":"error"},{"inputs":[],"name":"IBCConnectionInvalidSelfClientState","type":"error"},{"inputs":[],"name":"IBCConnectionNoMatchingVersionFound","type":"error"},{"inputs":[{"internalType":"enum ConnectionEnd.State","name":"state","type":"uint8"}],"name":"IBCConnectionUnexpectedConnectionState","type":"error"},{"inputs":[],"name":"IBCConnectionVersionsAlreadySet","type":"error"},{"inputs":[{"internalType":"string","name":"portId","type":"string"},{"internalType":"string","name":"channelId","type":"string"}],"name":"IBCHostChannelCapabilityAlreadyClaimed","type":"error"},{"inputs":[{"internalType":"string","name":"clientType","type":"string"}],"name":"IBCHostClientTypeAlreadyExists","type":"error"},{"inputs":[{"internalType":"string","name":"portId","type":"string"},{"internalType":"string","name":"channelId","type":"string"},{"internalType":"address","name":"caller","type":"address"}],"name":"IBCHostFailedAuthenticateChannelCapability","type":"error"},{"inputs":[{"internalType":"string","name":"clientType","type":"string"}],"name":"IBCHostInvalidClientType","type":"error"},{"inputs":[{"internalType":"address","name":"lcAddress","type":"address"}],"name":"IBCHostInvalidLightClientAddress","type":"error"},{"inputs":[{"internalType":"address","name":"moduleAddress","type":"address"}],"name":"IBCHostInvalidModuleAddress","type":"error"},{"inputs":[{"internalType":"string","name":"portId","type":"string"}],"name":"IBCHostInvalidPortIdentifier","type":"error"},{"inputs":[{"internalType":"string","name":"portId","type":"string"},{"internalType":"string","name":"channelId","type":"string"}],"name":"IBCHostModuleChannelNotFound","type":"error"},{"inputs":[],"name":"IBCHostModuleDoesNotSupportERC165","type":"error"},{"inputs":[{"internalType":"address","name":"module","type":"address"},{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"IBCHostModuleDoesNotSupportIIBCModule","type":"error"},{"inputs":[{"internalType":"address","name":"module","type":"address"},{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"IBCHostModuleDoesNotSupportIIBCModuleInitializer","type":"error"},{"inputs":[{"internalType":"address","name":"module","type":"address"}],"name":"IBCHostModuleDoesNotSupportIIBCModuleUpgrade","type":"error"},{"inputs":[{"internalType":"string","name":"portId","type":"string"}],"name":"IBCHostModulePortNotFound","type":"error"},{"inputs":[{"internalType":"string","name":"portId","type":"string"}],"name":"IBCHostPortCapabilityAlreadyClaimed","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint64","name":"sequence","type":"uint64"},{"internalType":"string","name":"sourcePort","type":"string"},{"internalType":"string","name":"sourceChannel","type":"string"},{"internalType":"string","name":"destinationPort","type":"string"},{"internalType":"string","name":"destinationChannel","type":"string"},{"internalType":"bytes","name":"data","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"timeoutHeight","type":"tuple"},{"internalType":"uint64","name":"timeoutTimestamp","type":"uint64"}],"indexed":false,"internalType":"struct Packet","name":"packet","type":"tuple"},{"indexed":false,"internalType":"bytes","name":"acknowledgement","type":"bytes"}],"name":"AcknowledgePacket","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"portId","type":"string"},{"indexed":false,"internalType":"string","name":"channelId","type":"string"},{"indexed":false,"internalType":"uint64","name":"upgradeSequence","type":"uint64"},{"indexed":false,"internalType":"enum Channel.State","name":"channelState","type":"uint8"},{"components":[{"internalType":"enum Channel.Order","name":"ordering","type":"uint8"},{"internalType":"string[]","name":"connection_hops","type":"string[]"},{"internalType":"string","name":"version","type":"string"}],"indexed":false,"internalType":"struct UpgradeFields.Data","name":"upgradeFields","type":"tuple"},{"components":[{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"height","type":"tuple"},{"internalType":"uint64","name":"timestamp","type":"uint64"}],"indexed":false,"internalType":"struct Timeout.Data","name":"timeout","type":"tuple"},{"indexed":false,"internalType":"uint64","name":"nextSequenceSend","type":"uint64"}],"name":"ChannelUpgradeAck","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"portId","type":"string"},{"indexed":false,"internalType":"string","name":"channelId","type":"string"},{"indexed":false,"internalType":"uint64","name":"upgradeSequence","type":"uint64"},{"indexed":false,"internalType":"enum Channel.State","name":"channelState","type":"uint8"}],"name":"ChannelUpgradeConfirm","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"portId","type":"string"},{"indexed":false,"internalType":"string","name":"channelId","type":"string"},{"indexed":false,"internalType":"uint64","name":"upgradeSequence","type":"uint64"},{"components":[{"internalType":"enum Channel.Order","name":"ordering","type":"uint8"},{"internalType":"string[]","name":"connection_hops","type":"string[]"},{"internalType":"string","name":"version","type":"string"}],"indexed":false,"internalType":"struct UpgradeFields.Data","name":"proposedUpgradeFields","type":"tuple"}],"name":"ChannelUpgradeInit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"portId","type":"string"},{"indexed":false,"internalType":"string","name":"channelId","type":"string"},{"indexed":false,"internalType":"uint64","name":"upgradeSequence","type":"uint64"}],"name":"ChannelUpgradeOpen","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"portId","type":"string"},{"indexed":false,"internalType":"string","name":"channelId","type":"string"},{"indexed":false,"internalType":"uint64","name":"upgradeSequence","type":"uint64"},{"components":[{"internalType":"enum Channel.Order","name":"ordering","type":"uint8"},{"internalType":"string[]","name":"connection_hops","type":"string[]"},{"internalType":"string","name":"version","type":"string"}],"indexed":false,"internalType":"struct UpgradeFields.Data","name":"upgradeFields","type":"tuple"},{"components":[{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"height","type":"tuple"},{"internalType":"uint64","name":"timestamp","type":"uint64"}],"indexed":false,"internalType":"struct Timeout.Data","name":"timeout","type":"tuple"},{"indexed":false,"internalType":"uint64","name":"nextSequenceSend","type":"uint64"}],"name":"ChannelUpgradeTry","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"channelId","type":"string"}],"name":"GeneratedChannelIdentifier","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"clientId","type":"string"}],"name":"GeneratedClientIdentifier","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"connectionId","type":"string"}],"name":"GeneratedConnectionIdentifier","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"portId","type":"string"},{"indexed":false,"internalType":"string","name":"channelId","type":"string"},{"indexed":false,"internalType":"address","name":"module","type":"address"}],"name":"IBCModuleManagerChannelCapabilityClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"portId","type":"string"},{"indexed":false,"internalType":"address","name":"module","type":"address"}],"name":"IBCModuleManagerPortCapabilityClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint64","name":"sequence","type":"uint64"},{"internalType":"string","name":"sourcePort","type":"string"},{"internalType":"string","name":"sourceChannel","type":"string"},{"internalType":"string","name":"destinationPort","type":"string"},{"internalType":"string","name":"destinationChannel","type":"string"},{"internalType":"bytes","name":"data","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"timeoutHeight","type":"tuple"},{"internalType":"uint64","name":"timeoutTimestamp","type":"uint64"}],"indexed":false,"internalType":"struct Packet","name":"packet","type":"tuple"}],"name":"RecvPacket","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"sequence","type":"uint64"},{"indexed":false,"internalType":"string","name":"sourcePort","type":"string"},{"indexed":false,"internalType":"string","name":"sourceChannel","type":"string"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"indexed":false,"internalType":"struct Height.Data","name":"timeoutHeight","type":"tuple"},{"indexed":false,"internalType":"uint64","name":"timeoutTimestamp","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"SendPacket","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint64","name":"sequence","type":"uint64"},{"internalType":"string","name":"sourcePort","type":"string"},{"internalType":"string","name":"sourceChannel","type":"string"},{"internalType":"string","name":"destinationPort","type":"string"},{"internalType":"string","name":"destinationChannel","type":"string"},{"internalType":"bytes","name":"data","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"timeoutHeight","type":"tuple"},{"internalType":"uint64","name":"timeoutTimestamp","type":"uint64"}],"indexed":false,"internalType":"struct Packet","name":"packet","type":"tuple"}],"name":"TimeoutPacket","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"destinationPortId","type":"string"},{"indexed":false,"internalType":"string","name":"destinationChannel","type":"string"},{"indexed":false,"internalType":"uint64","name":"sequence","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"acknowledgement","type":"bytes"}],"name":"WriteAcknowledgement","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"portId","type":"string"},{"indexed":false,"internalType":"string","name":"channelId","type":"string"},{"indexed":false,"internalType":"uint64","name":"upgradeSequence","type":"uint64"},{"indexed":false,"internalType":"string","name":"message","type":"string"}],"name":"WriteErrorReceipt","type":"event"},{"inputs":[{"components":[{"components":[{"internalType":"uint64","name":"sequence","type":"uint64"},{"internalType":"string","name":"sourcePort","type":"string"},{"internalType":"string","name":"sourceChannel","type":"string"},{"internalType":"string","name":"destinationPort","type":"string"},{"internalType":"string","name":"destinationChannel","type":"string"},{"internalType":"bytes","name":"data","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"timeoutHeight","type":"tuple"},{"internalType":"uint64","name":"timeoutTimestamp","type":"uint64"}],"internalType":"struct Packet","name":"packet","type":"tuple"},{"internalType":"bytes","name":"acknowledgement","type":"bytes"},{"internalType":"bytes","name":"proof","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"proofHeight","type":"tuple"}],"internalType":"struct IIBCChannelAcknowledgePacket.MsgPacketAcknowledgement","name":"","type":"tuple"}],"name":"acknowledgePacket","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"portId","type":"string"},{"internalType":"contract IIBCModuleInitializer","name":"moduleAddress","type":"address"}],"name":"bindPort","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"portId","type":"string"},{"internalType":"string","name":"channelId","type":"string"},{"components":[{"internalType":"uint64","name":"sequence","type":"uint64"},{"internalType":"string","name":"message","type":"string"}],"internalType":"struct ErrorReceipt.Data","name":"errorReceipt","type":"tuple"},{"internalType":"bytes","name":"proofUpgradeError","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"proofHeight","type":"tuple"}],"internalType":"struct IIBCChannelUpgradeBase.MsgCancelChannelUpgrade","name":"","type":"tuple"}],"name":"cancelChannelUpgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"portId","type":"string"},{"internalType":"string","name":"channelId","type":"string"},{"internalType":"bytes","name":"proofInit","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"proofHeight","type":"tuple"}],"internalType":"struct IIBCChannelHandshake.MsgChannelCloseConfirm","name":"","type":"tuple"}],"name":"channelCloseConfirm","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"portId","type":"string"},{"internalType":"string","name":"channelId","type":"string"}],"internalType":"struct IIBCChannelHandshake.MsgChannelCloseInit","name":"","type":"tuple"}],"name":"channelCloseInit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"portId","type":"string"},{"internalType":"string","name":"channelId","type":"string"},{"internalType":"string","name":"counterpartyVersion","type":"string"},{"internalType":"string","name":"counterpartyChannelId","type":"string"},{"internalType":"bytes","name":"proofTry","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"proofHeight","type":"tuple"}],"internalType":"struct IIBCChannelHandshake.MsgChannelOpenAck","name":"","type":"tuple"}],"name":"channelOpenAck","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"portId","type":"string"},{"internalType":"string","name":"channelId","type":"string"},{"internalType":"bytes","name":"proofAck","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"proofHeight","type":"tuple"}],"internalType":"struct IIBCChannelHandshake.MsgChannelOpenConfirm","name":"","type":"tuple"}],"name":"channelOpenConfirm","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"portId","type":"string"},{"components":[{"internalType":"enum Channel.State","name":"state","type":"uint8"},{"internalType":"enum Channel.Order","name":"ordering","type":"uint8"},{"components":[{"internalType":"string","name":"port_id","type":"string"},{"internalType":"string","name":"channel_id","type":"string"}],"internalType":"struct ChannelCounterparty.Data","name":"counterparty","type":"tuple"},{"internalType":"string[]","name":"connection_hops","type":"string[]"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint64","name":"upgrade_sequence","type":"uint64"}],"internalType":"struct Channel.Data","name":"channel","type":"tuple"}],"internalType":"struct IIBCChannelHandshake.MsgChannelOpenInit","name":"","type":"tuple"}],"name":"channelOpenInit","outputs":[{"internalType":"string","name":"","type":"string"},{"internalType":"string","name":"","type":"string"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"portId","type":"string"},{"components":[{"internalType":"enum Channel.State","name":"state","type":"uint8"},{"internalType":"enum Channel.Order","name":"ordering","type":"uint8"},{"components":[{"internalType":"string","name":"port_id","type":"string"},{"internalType":"string","name":"channel_id","type":"string"}],"internalType":"struct ChannelCounterparty.Data","name":"counterparty","type":"tuple"},{"internalType":"string[]","name":"connection_hops","type":"string[]"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint64","name":"upgrade_sequence","type":"uint64"}],"internalType":"struct Channel.Data","name":"channel","type":"tuple"},{"internalType":"string","name":"counterpartyVersion","type":"string"},{"internalType":"bytes","name":"proofInit","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"proofHeight","type":"tuple"}],"internalType":"struct IIBCChannelHandshake.MsgChannelOpenTry","name":"","type":"tuple"}],"name":"channelOpenTry","outputs":[{"internalType":"string","name":"","type":"string"},{"internalType":"string","name":"","type":"string"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"portId","type":"string"},{"internalType":"string","name":"channelId","type":"string"},{"components":[{"components":[{"internalType":"enum Channel.Order","name":"ordering","type":"uint8"},{"internalType":"string[]","name":"connection_hops","type":"string[]"},{"internalType":"string","name":"version","type":"string"}],"internalType":"struct UpgradeFields.Data","name":"fields","type":"tuple"},{"components":[{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"height","type":"tuple"},{"internalType":"uint64","name":"timestamp","type":"uint64"}],"internalType":"struct Timeout.Data","name":"timeout","type":"tuple"},{"internalType":"uint64","name":"next_sequence_send","type":"uint64"}],"internalType":"struct Upgrade.Data","name":"counterpartyUpgrade","type":"tuple"},{"components":[{"internalType":"bytes","name":"proofChannel","type":"bytes"},{"internalType":"bytes","name":"proofUpgrade","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"proofHeight","type":"tuple"}],"internalType":"struct IIBCChannelUpgradeBase.ChannelUpgradeProofs","name":"proofs","type":"tuple"}],"internalType":"struct IIBCChannelUpgradeBase.MsgChannelUpgradeAck","name":"","type":"tuple"}],"name":"channelUpgradeAck","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"portId","type":"string"},{"internalType":"string","name":"channelId","type":"string"},{"internalType":"enum Channel.State","name":"counterpartyChannelState","type":"uint8"},{"components":[{"components":[{"internalType":"enum Channel.Order","name":"ordering","type":"uint8"},{"internalType":"string[]","name":"connection_hops","type":"string[]"},{"internalType":"string","name":"version","type":"string"}],"internalType":"struct UpgradeFields.Data","name":"fields","type":"tuple"},{"components":[{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"height","type":"tuple"},{"internalType":"uint64","name":"timestamp","type":"uint64"}],"internalType":"struct Timeout.Data","name":"timeout","type":"tuple"},{"internalType":"uint64","name":"next_sequence_send","type":"uint64"}],"internalType":"struct Upgrade.Data","name":"counterpartyUpgrade","type":"tuple"},{"components":[{"internalType":"bytes","name":"proofChannel","type":"bytes"},{"internalType":"bytes","name":"proofUpgrade","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"proofHeight","type":"tuple"}],"internalType":"struct IIBCChannelUpgradeBase.ChannelUpgradeProofs","name":"proofs","type":"tuple"}],"internalType":"struct IIBCChannelUpgradeBase.MsgChannelUpgradeConfirm","name":"","type":"tuple"}],"name":"channelUpgradeConfirm","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"portId","type":"string"},{"internalType":"string","name":"channelId","type":"string"},{"components":[{"internalType":"enum Channel.Order","name":"ordering","type":"uint8"},{"internalType":"string[]","name":"connection_hops","type":"string[]"},{"internalType":"string","name":"version","type":"string"}],"internalType":"struct UpgradeFields.Data","name":"proposedUpgradeFields","type":"tuple"}],"internalType":"struct IIBCChannelUpgradeBase.MsgChannelUpgradeInit","name":"","type":"tuple"}],"name":"channelUpgradeInit","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"portId","type":"string"},{"internalType":"string","name":"channelId","type":"string"},{"internalType":"enum Channel.State","name":"counterpartyChannelState","type":"uint8"},{"internalType":"uint64","name":"counterpartyUpgradeSequence","type":"uint64"},{"internalType":"bytes","name":"proofChannel","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"proofHeight","type":"tuple"}],"internalType":"struct IIBCChannelUpgradeBase.MsgChannelUpgradeOpen","name":"","type":"tuple"}],"name":"channelUpgradeOpen","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"portId","type":"string"},{"internalType":"string","name":"channelId","type":"string"},{"internalType":"uint64","name":"counterpartyUpgradeSequence","type":"uint64"},{"components":[{"internalType":"enum Channel.Order","name":"ordering","type":"uint8"},{"internalType":"string[]","name":"connection_hops","type":"string[]"},{"internalType":"string","name":"version","type":"string"}],"internalType":"struct UpgradeFields.Data","name":"counterpartyUpgradeFields","type":"tuple"},{"internalType":"string[]","name":"proposedConnectionHops","type":"string[]"},{"components":[{"internalType":"bytes","name":"proofChannel","type":"bytes"},{"internalType":"bytes","name":"proofUpgrade","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"proofHeight","type":"tuple"}],"internalType":"struct IIBCChannelUpgradeBase.ChannelUpgradeProofs","name":"proofs","type":"tuple"}],"internalType":"struct IIBCChannelUpgradeBase.MsgChannelUpgradeTry","name":"","type":"tuple"}],"name":"channelUpgradeTry","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"connectionId","type":"string"},{"internalType":"bytes","name":"clientStateBytes","type":"bytes"},{"components":[{"internalType":"string","name":"identifier","type":"string"},{"internalType":"string[]","name":"features","type":"string[]"}],"internalType":"struct Version.Data","name":"version","type":"tuple"},{"internalType":"string","name":"counterpartyConnectionId","type":"string"},{"internalType":"bytes","name":"proofTry","type":"bytes"},{"internalType":"bytes","name":"proofClient","type":"bytes"},{"internalType":"bytes","name":"proofConsensus","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"proofHeight","type":"tuple"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"consensusHeight","type":"tuple"},{"internalType":"bytes","name":"hostConsensusStateProof","type":"bytes"}],"internalType":"struct IIBCConnection.MsgConnectionOpenAck","name":"","type":"tuple"}],"name":"connectionOpenAck","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"connectionId","type":"string"},{"internalType":"bytes","name":"proofAck","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"proofHeight","type":"tuple"}],"internalType":"struct IIBCConnection.MsgConnectionOpenConfirm","name":"","type":"tuple"}],"name":"connectionOpenConfirm","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"clientId","type":"string"},{"components":[{"internalType":"string","name":"client_id","type":"string"},{"internalType":"string","name":"connection_id","type":"string"},{"components":[{"internalType":"bytes","name":"key_prefix","type":"bytes"}],"internalType":"struct MerklePrefix.Data","name":"prefix","type":"tuple"}],"internalType":"struct Counterparty.Data","name":"counterparty","type":"tuple"},{"components":[{"internalType":"string","name":"identifier","type":"string"},{"internalType":"string[]","name":"features","type":"string[]"}],"internalType":"struct Version.Data","name":"version","type":"tuple"},{"internalType":"uint64","name":"delayPeriod","type":"uint64"}],"internalType":"struct IIBCConnection.MsgConnectionOpenInit","name":"","type":"tuple"}],"name":"connectionOpenInit","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"string","name":"client_id","type":"string"},{"internalType":"string","name":"connection_id","type":"string"},{"components":[{"internalType":"bytes","name":"key_prefix","type":"bytes"}],"internalType":"struct MerklePrefix.Data","name":"prefix","type":"tuple"}],"internalType":"struct Counterparty.Data","name":"counterparty","type":"tuple"},{"internalType":"uint64","name":"delayPeriod","type":"uint64"},{"internalType":"string","name":"clientId","type":"string"},{"internalType":"bytes","name":"clientStateBytes","type":"bytes"},{"components":[{"internalType":"string","name":"identifier","type":"string"},{"internalType":"string[]","name":"features","type":"string[]"}],"internalType":"struct Version.Data[]","name":"counterpartyVersions","type":"tuple[]"},{"internalType":"bytes","name":"proofInit","type":"bytes"},{"internalType":"bytes","name":"proofClient","type":"bytes"},{"internalType":"bytes","name":"proofConsensus","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"proofHeight","type":"tuple"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"consensusHeight","type":"tuple"},{"internalType":"bytes","name":"hostConsensusStateProof","type":"bytes"}],"internalType":"struct IIBCConnection.MsgConnectionOpenTry","name":"","type":"tuple"}],"name":"connectionOpenTry","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"clientType","type":"string"},{"internalType":"bytes","name":"protoClientState","type":"bytes"},{"internalType":"bytes","name":"protoConsensusState","type":"bytes"}],"internalType":"struct IIBCClient.MsgCreateClient","name":"","type":"tuple"}],"name":"createClient","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"portId","type":"string"},{"internalType":"string","name":"channelId","type":"string"}],"name":"getCanTransitionToFlushComplete","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"portId","type":"string"},{"internalType":"string","name":"channelId","type":"string"}],"name":"getChannel","outputs":[{"components":[{"internalType":"enum Channel.State","name":"state","type":"uint8"},{"internalType":"enum Channel.Order","name":"ordering","type":"uint8"},{"components":[{"internalType":"string","name":"port_id","type":"string"},{"internalType":"string","name":"channel_id","type":"string"}],"internalType":"struct ChannelCounterparty.Data","name":"counterparty","type":"tuple"},{"internalType":"string[]","name":"connection_hops","type":"string[]"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint64","name":"upgrade_sequence","type":"uint64"}],"internalType":"struct Channel.Data","name":"","type":"tuple"},{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"portId","type":"string"},{"internalType":"string","name":"channelId","type":"string"}],"name":"getChannelUpgrade","outputs":[{"components":[{"components":[{"internalType":"enum Channel.Order","name":"ordering","type":"uint8"},{"internalType":"string[]","name":"connection_hops","type":"string[]"},{"internalType":"string","name":"version","type":"string"}],"internalType":"struct UpgradeFields.Data","name":"fields","type":"tuple"},{"components":[{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"height","type":"tuple"},{"internalType":"uint64","name":"timestamp","type":"uint64"}],"internalType":"struct Timeout.Data","name":"timeout","type":"tuple"},{"internalType":"uint64","name":"next_sequence_send","type":"uint64"}],"internalType":"struct Upgrade.Data","name":"","type":"tuple"},{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"clientId","type":"string"}],"name":"getClient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"clientType","type":"string"}],"name":"getClientByType","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"clientId","type":"string"}],"name":"getClientState","outputs":[{"internalType":"bytes","name":"","type":"bytes"},{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"clientId","type":"string"}],"name":"getClientType","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"hashedPath","type":"bytes32"}],"name":"getCommitment","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCommitmentPrefix","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCommitmentsSlot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"string","name":"connectionId","type":"string"}],"name":"getConnection","outputs":[{"components":[{"internalType":"string","name":"client_id","type":"string"},{"components":[{"internalType":"string","name":"identifier","type":"string"},{"internalType":"string[]","name":"features","type":"string[]"}],"internalType":"struct Version.Data[]","name":"versions","type":"tuple[]"},{"internalType":"enum ConnectionEnd.State","name":"state","type":"uint8"},{"components":[{"internalType":"string","name":"client_id","type":"string"},{"internalType":"string","name":"connection_id","type":"string"},{"components":[{"internalType":"bytes","name":"key_prefix","type":"bytes"}],"internalType":"struct MerklePrefix.Data","name":"prefix","type":"tuple"}],"internalType":"struct Counterparty.Data","name":"counterparty","type":"tuple"},{"internalType":"uint64","name":"delay_period","type":"uint64"}],"internalType":"struct ConnectionEnd.Data","name":"","type":"tuple"},{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"clientId","type":"string"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"height","type":"tuple"}],"name":"getConsensusState","outputs":[{"internalType":"bytes","name":"consensusStateBytes","type":"bytes"},{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getExpectedTimePerBlock","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"portId","type":"string"},{"internalType":"string","name":"channelId","type":"string"}],"name":"getIBCModuleByChannel","outputs":[{"internalType":"contract IIBCModule","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"portId","type":"string"}],"name":"getIBCModuleByPort","outputs":[{"internalType":"contract IIBCModuleInitializer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"portId","type":"string"},{"internalType":"string","name":"channelId","type":"string"}],"name":"getNextSequenceAck","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"portId","type":"string"},{"internalType":"string","name":"channelId","type":"string"}],"name":"getNextSequenceRecv","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"portId","type":"string"},{"internalType":"string","name":"channelId","type":"string"}],"name":"getNextSequenceSend","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"portId","type":"string"},{"internalType":"string","name":"channelId","type":"string"},{"internalType":"uint64","name":"sequence","type":"uint64"}],"name":"getPacketReceipt","outputs":[{"internalType":"enum IBCChannelLib.PacketReceipt","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"uint64","name":"sequence","type":"uint64"},{"internalType":"string","name":"sourcePort","type":"string"},{"internalType":"string","name":"sourceChannel","type":"string"},{"internalType":"string","name":"destinationPort","type":"string"},{"internalType":"string","name":"destinationChannel","type":"string"},{"internalType":"bytes","name":"data","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"timeoutHeight","type":"tuple"},{"internalType":"uint64","name":"timeoutTimestamp","type":"uint64"}],"internalType":"struct Packet","name":"packet","type":"tuple"},{"internalType":"bytes","name":"proof","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"proofHeight","type":"tuple"}],"internalType":"struct IIBCChannelRecvPacket.MsgPacketRecv","name":"","type":"tuple"}],"name":"recvPacket","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"clientType","type":"string"},{"internalType":"contract ILightClient","name":"client","type":"address"}],"name":"registerClient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"clientId","type":"string"},{"internalType":"bytes","name":"protoClientMessage","type":"bytes"}],"internalType":"struct IIBCClient.MsgUpdateClient","name":"msg_","type":"tuple"}],"name":"routeUpdateClient","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes4","name":"","type":"bytes4"},{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"},{"internalType":"string","name":"","type":"string"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"","type":"tuple"},{"internalType":"uint64","name":"","type":"uint64"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"sendPacket","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"expectedTimePerBlock_","type":"uint64"}],"name":"setExpectedTimePerBlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"portId","type":"string"},{"internalType":"string","name":"channelId","type":"string"},{"components":[{"internalType":"enum Channel.State","name":"state","type":"uint8"},{"internalType":"enum Channel.Order","name":"ordering","type":"uint8"},{"components":[{"internalType":"string","name":"port_id","type":"string"},{"internalType":"string","name":"channel_id","type":"string"}],"internalType":"struct ChannelCounterparty.Data","name":"counterparty","type":"tuple"},{"internalType":"string[]","name":"connection_hops","type":"string[]"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint64","name":"upgrade_sequence","type":"uint64"}],"internalType":"struct Channel.Data","name":"counterpartyChannel","type":"tuple"},{"internalType":"bytes","name":"proofChannel","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"proofHeight","type":"tuple"}],"internalType":"struct IIBCChannelUpgradeBase.MsgTimeoutChannelUpgrade","name":"","type":"tuple"}],"name":"timeoutChannelUpgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"uint64","name":"sequence","type":"uint64"},{"internalType":"string","name":"sourcePort","type":"string"},{"internalType":"string","name":"sourceChannel","type":"string"},{"internalType":"string","name":"destinationPort","type":"string"},{"internalType":"string","name":"destinationChannel","type":"string"},{"internalType":"bytes","name":"data","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"timeoutHeight","type":"tuple"},{"internalType":"uint64","name":"timeoutTimestamp","type":"uint64"}],"internalType":"struct Packet","name":"packet","type":"tuple"},{"internalType":"bytes","name":"proofUnreceived","type":"bytes"},{"internalType":"bytes","name":"proofClose","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"proofHeight","type":"tuple"},{"internalType":"uint64","name":"nextSequenceRecv","type":"uint64"},{"internalType":"uint64","name":"counterpartyUpgradeSequence","type":"uint64"}],"internalType":"struct IIBCChannelPacketTimeout.MsgTimeoutOnClose","name":"","type":"tuple"}],"name":"timeoutOnClose","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"uint64","name":"sequence","type":"uint64"},{"internalType":"string","name":"sourcePort","type":"string"},{"internalType":"string","name":"sourceChannel","type":"string"},{"internalType":"string","name":"destinationPort","type":"string"},{"internalType":"string","name":"destinationChannel","type":"string"},{"internalType":"bytes","name":"data","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"timeoutHeight","type":"tuple"},{"internalType":"uint64","name":"timeoutTimestamp","type":"uint64"}],"internalType":"struct Packet","name":"packet","type":"tuple"},{"internalType":"bytes","name":"proof","type":"bytes"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data","name":"proofHeight","type":"tuple"},{"internalType":"uint64","name":"nextSequenceRecv","type":"uint64"}],"internalType":"struct IIBCChannelPacketTimeout.MsgTimeoutPacket","name":"","type":"tuple"}],"name":"timeoutPacket","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"clientId","type":"string"},{"internalType":"bytes","name":"protoClientMessage","type":"bytes"}],"internalType":"struct IIBCClient.MsgUpdateClient","name":"","type":"tuple"}],"name":"updateClient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"},{"components":[{"internalType":"uint64","name":"revision_number","type":"uint64"},{"internalType":"uint64","name":"revision_height","type":"uint64"}],"internalType":"struct Height.Data[]","name":"","type":"tuple[]"}],"name":"updateClientCommitments","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"clientId","type":"string"},{"internalType":"bytes","name":"protoClientMessage","type":"bytes"}],"internalType":"struct IIBCClient.MsgUpdateClient","name":"msg_","type":"tuple"}],"name":"wrappedRouteUpdateClient","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes4","name":"","type":"bytes4"},{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"},{"internalType":"string","name":"","type":"string"},{"internalType":"uint64","name":"","type":"uint64"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"writeAcknowledgement","outputs":[],"stateMutability":"nonpayable","type":"function"}]