diff --git a/proto/exocore/oracle/v1/native_token.proto b/proto/exocore/oracle/v1/native_token.proto index e11274c90..eaca21cd6 100644 --- a/proto/exocore/oracle/v1/native_token.proto +++ b/proto/exocore/oracle/v1/native_token.proto @@ -8,7 +8,9 @@ option go_package = "github.com/ExocoreNetwork/exocore/x/oracle/types"; // BalanceInfo tells effective-balance for native-restaking asset message BalanceInfo { + // current round of price, this is updated based on tokenFeeder uint64 round_id = 1 [(gogoproto.customname)="RoundID"]; + // on which block the balance updated, deposit/withdraw will update this and round_id might not change uint64 block = 2; // index used to distinguish multiple balanceInfo for one same roundid uint64 index = 3; @@ -16,25 +18,36 @@ message BalanceInfo { // uint epoch = 3; int64 balance = 4; + // Action defines the reason the balance changed enum Action { - ACTION_ROUND = 0; + // balance updated when a new round generated + ACTION_ROUND_UNSPECIFIED = 0; + // balance updated when a deposit happened ACTION_DEPOSIT = 1; - ACTION_WITHDRAW = 2; - ACTION_SLASH_REFUND = 3; + // balance updated when a withdraw happened + ACTION_WITHDRAW = 2; + // balance updatd when a slah/refund on beacon chain happened + ACTION_SLASH_REFUND = 3; } + // change tells the reason balance changed Action change = 5; } // StakerInfo represents all related information for a staker of native-restaking message StakerInfo { + // staker's address string staker_addr = 1; + // the index of corresponding staker in staker list int64 staker_index = 2; + // list of validators that this staker corresponding to on beacon chain repeated uint64 validator_indexes = 3; + // list of balances to represets the history of this staker repeated BalanceInfo balance_list = 4; } // StakerList tells which stakers are active for one specific native-restaking asset message StakerList { + // staker's address repeated string staker_addrs = 1; } diff --git a/proto/exocore/oracle/v1/query.proto b/proto/exocore/oracle/v1/query.proto index 3ab0f89d6..344224479 100644 --- a/proto/exocore/oracle/v1/query.proto +++ b/proto/exocore/oracle/v1/query.proto @@ -20,10 +20,12 @@ option go_package = "github.com/ExocoreNetwork/exocore/x/oracle/types"; // Query defines the gRPC querier service. service Query { + // stakerList shows all stakers related to the specified asset under native-restaking context rpc StakerList (QueryStakerListRequest) returns (QueryStakerListResponse) { option (google.api.http).get = "/ExocoreNetwork/exocore/oracle/staker_list"; } + // StakerInfo shows the details for all stakers of the specified assets under native-restaking context rpc StakerInfos (QueryStakerInfosRequest) returns (QueryStakerInfosResponse) { option (google.api.http).get = "/ExocoreNetwork/exocore/oracle/staker_infos"; } diff --git a/x/oracle/types/native_token.pb.go b/x/oracle/types/native_token.pb.go index b69bee737..a870a0c7f 100644 --- a/x/oracle/types/native_token.pb.go +++ b/x/oracle/types/native_token.pb.go @@ -23,27 +23,32 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// Action defines the reason the balance changed type BalanceInfo_Action int32 const ( - BalanceInfo_ACTION_ROUND BalanceInfo_Action = 0 - BalanceInfo_ACTION_DEPOSIT BalanceInfo_Action = 1 - BalanceInfo_ACTION_WITHDRAW BalanceInfo_Action = 2 + // balance updated when a new round generated + BalanceInfo_ACTION_ROUND_UNSPECIFIED BalanceInfo_Action = 0 + // balance updated when a deposit happened + BalanceInfo_ACTION_DEPOSIT BalanceInfo_Action = 1 + // balance updated when a withdraw happened + BalanceInfo_ACTION_WITHDRAW BalanceInfo_Action = 2 + // balance updatd when a slah/refund on beacon chain happened BalanceInfo_ACTION_SLASH_REFUND BalanceInfo_Action = 3 ) var BalanceInfo_Action_name = map[int32]string{ - 0: "ACTION_ROUND", + 0: "ACTION_ROUND_UNSPECIFIED", 1: "ACTION_DEPOSIT", 2: "ACTION_WITHDRAW", 3: "ACTION_SLASH_REFUND", } var BalanceInfo_Action_value = map[string]int32{ - "ACTION_ROUND": 0, - "ACTION_DEPOSIT": 1, - "ACTION_WITHDRAW": 2, - "ACTION_SLASH_REFUND": 3, + "ACTION_ROUND_UNSPECIFIED": 0, + "ACTION_DEPOSIT": 1, + "ACTION_WITHDRAW": 2, + "ACTION_SLASH_REFUND": 3, } func (x BalanceInfo_Action) String() string { @@ -56,14 +61,17 @@ func (BalanceInfo_Action) EnumDescriptor() ([]byte, []int) { // BalanceInfo tells effective-balance for native-restaking asset type BalanceInfo struct { + // current round of price, this is updated based on tokenFeeder RoundID uint64 `protobuf:"varint,1,opt,name=round_id,json=roundId,proto3" json:"round_id,omitempty"` - Block uint64 `protobuf:"varint,2,opt,name=block,proto3" json:"block,omitempty"` + // on which block the balance updated, deposit/withdraw will update this and round_id might not change + Block uint64 `protobuf:"varint,2,opt,name=block,proto3" json:"block,omitempty"` // index used to distinguish multiple balanceInfo for one same roundid Index uint64 `protobuf:"varint,3,opt,name=index,proto3" json:"index,omitempty"` // beaconchain epoch related to slash_refund // uint epoch = 3; - Balance int64 `protobuf:"varint,4,opt,name=balance,proto3" json:"balance,omitempty"` - Change BalanceInfo_Action `protobuf:"varint,5,opt,name=change,proto3,enum=exocore.oracle.v1.BalanceInfo_Action" json:"change,omitempty"` + Balance int64 `protobuf:"varint,4,opt,name=balance,proto3" json:"balance,omitempty"` + // change tells the reason balance changed + Change BalanceInfo_Action `protobuf:"varint,5,opt,name=change,proto3,enum=exocore.oracle.v1.BalanceInfo_Action" json:"change,omitempty"` } func (m *BalanceInfo) Reset() { *m = BalanceInfo{} } @@ -131,15 +139,19 @@ func (m *BalanceInfo) GetChange() BalanceInfo_Action { if m != nil { return m.Change } - return BalanceInfo_ACTION_ROUND + return BalanceInfo_ACTION_ROUND_UNSPECIFIED } // StakerInfo represents all related information for a staker of native-restaking type StakerInfo struct { - StakerAddr string `protobuf:"bytes,1,opt,name=staker_addr,json=stakerAddr,proto3" json:"staker_addr,omitempty"` - StakerIndex int64 `protobuf:"varint,2,opt,name=staker_index,json=stakerIndex,proto3" json:"staker_index,omitempty"` - ValidatorIndexes []uint64 `protobuf:"varint,3,rep,packed,name=validator_indexes,json=validatorIndexes,proto3" json:"validator_indexes,omitempty"` - BalanceList []*BalanceInfo `protobuf:"bytes,4,rep,name=balance_list,json=balanceList,proto3" json:"balance_list,omitempty"` + // staker's address + StakerAddr string `protobuf:"bytes,1,opt,name=staker_addr,json=stakerAddr,proto3" json:"staker_addr,omitempty"` + // the index of corresponding staker in staker list + StakerIndex int64 `protobuf:"varint,2,opt,name=staker_index,json=stakerIndex,proto3" json:"staker_index,omitempty"` + // list of validators that this staker corresponding to on beacon chain + ValidatorIndexes []uint64 `protobuf:"varint,3,rep,packed,name=validator_indexes,json=validatorIndexes,proto3" json:"validator_indexes,omitempty"` + // list of balances to represets the history of this staker + BalanceList []*BalanceInfo `protobuf:"bytes,4,rep,name=balance_list,json=balanceList,proto3" json:"balance_list,omitempty"` } func (m *StakerInfo) Reset() { *m = StakerInfo{} } @@ -205,6 +217,7 @@ func (m *StakerInfo) GetBalanceList() []*BalanceInfo { // StakerList tells which stakers are active for one specific native-restaking asset type StakerList struct { + // staker's address StakerAddrs []string `protobuf:"bytes,1,rep,name=staker_addrs,json=stakerAddrs,proto3" json:"staker_addrs,omitempty"` } @@ -260,37 +273,37 @@ func init() { } var fileDescriptor_ed348d855b8fd9a8 = []byte{ - // 467 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x41, 0x8b, 0xd3, 0x40, - 0x14, 0xc7, 0x3b, 0x4d, 0xb7, 0x75, 0x5f, 0xca, 0x9a, 0x9d, 0x5d, 0x30, 0x78, 0xc8, 0xc6, 0xa2, - 0x12, 0x10, 0x12, 0x77, 0x3d, 0x7b, 0x48, 0x6d, 0x65, 0x23, 0x4b, 0x2b, 0xd3, 0xca, 0x82, 0x08, - 0x21, 0xcd, 0x8c, 0xdd, 0xd0, 0x98, 0x59, 0x92, 0xd9, 0x5a, 0xbf, 0x85, 0x47, 0x3f, 0x8e, 0x47, - 0x8f, 0x7b, 0xf4, 0x24, 0xd2, 0x7e, 0x11, 0xc9, 0xcc, 0x44, 0x16, 0x04, 0x6f, 0x79, 0xbf, 0xf7, - 0x7f, 0x99, 0xff, 0xfb, 0xf3, 0xe0, 0x31, 0xdb, 0xf0, 0x94, 0x97, 0x2c, 0xe0, 0x65, 0x92, 0xe6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 0x03, 0x38, 0xd2, 0x70, 0x76, 0x11, 0xce, 0xce, 0x63, 0x32, - 0x7e, 0x5d, 0xff, 0xc1, 0x18, 0x7c, 0x47, 0x00, 0x33, 0x91, 0xac, 0x58, 0x29, 0x93, 0x39, 0x01, - 0xb3, 0x92, 0x55, 0x9c, 0x50, 0x5a, 0xca, 0x70, 0xf6, 0x09, 0x28, 0x14, 0x52, 0x5a, 0xe2, 0x47, - 0xd0, 0xd7, 0x02, 0x95, 0x41, 0x5b, 0xee, 0xaa, 0x87, 0x22, 0x99, 0xc4, 0x33, 0x38, 0x5c, 0x27, - 0x79, 0x46, 0x13, 0xc1, 0xb5, 0x8a, 0x55, 0xb6, 0xe1, 0x1a, 0x5e, 0x87, 0x58, 0x7f, 0x1b, 0x91, - 0xe2, 0x38, 0x84, 0xbe, 0xce, 0x29, 0xce, 0xb3, 0x4a, 0xd8, 0x1d, 0xd7, 0xf0, 0xcc, 0x33, 0xe7, - 0xff, 0x11, 0x11, 0x53, 0xcf, 0x5c, 0x64, 0x95, 0x18, 0x04, 0xcd, 0x06, 0x75, 0x75, 0xc7, 0x60, - 0xbd, 0x41, 0x65, 0x23, 0xd7, 0xf0, 0xf6, 0x1b, 0x83, 0xf5, 0x0a, 0xd5, 0xf0, 0xcd, 0x8f, 0xad, - 0x83, 0x6e, 0xb7, 0x0e, 0xfa, 0xbd, 0x75, 0xd0, 0xd7, 0x9d, 0xd3, 0xba, 0xdd, 0x39, 0xad, 0x9f, - 0x3b, 0xa7, 0xf5, 0xfe, 0xf9, 0x32, 0x13, 0x57, 0x37, 0x0b, 0x3f, 0xe5, 0x9f, 0x82, 0xb1, 0x72, - 0x30, 0x61, 0xe2, 0x33, 0x2f, 0x57, 0x41, 0x73, 0x91, 0x9b, 0xe6, 0x26, 0xc5, 0x97, 0x6b, 0x56, - 0x2d, 0xba, 0xf2, 0xc2, 0x5e, 0xfc, 0x09, 0x00, 0x00, 0xff, 0xff, 0x3e, 0xbf, 0x55, 0xce, 0xb2, - 0x02, 0x00, 0x00, + // 478 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0x41, 0x6b, 0xdb, 0x30, + 0x18, 0x8d, 0xe2, 0xb4, 0x59, 0x95, 0xd2, 0xb9, 0x6a, 0x61, 0x62, 0x0c, 0xd7, 0x0b, 0xdb, 0x30, + 0x0c, 0xec, 0xb5, 0x3b, 0xef, 0xe0, 0xd4, 0x2e, 0xd5, 0x28, 0x4e, 0x91, 0x13, 0x0a, 0xbb, 0x18, + 0xc7, 0xd6, 0x12, 0x13, 0xcf, 0x2a, 0xb6, 0x9a, 0x65, 0xff, 0x62, 0x3f, 0x62, 0x3f, 0x64, 0xc7, + 0x1d, 0x7b, 0xdc, 0x69, 0x8c, 0xe4, 0x8f, 0x0c, 0x5b, 0xf2, 0x28, 0x0c, 0x76, 0xd3, 0x7b, 0xdf, + 0xfb, 0xd0, 0x7b, 0x8f, 0x0f, 0xbe, 0x60, 0x6b, 0x9e, 0xf0, 0x92, 0x39, 0xbc, 0x8c, 0x93, 0x9c, + 0x39, 0xab, 0x53, 0xa7, 0x88, 0x45, 0xb6, 0x62, 0x91, 0xe0, 0x4b, 0x56, 0xd8, 0xb7, 0x25, 0x17, + 0x1c, 0x1d, 0x2a, 0x95, 0x2d, 0x55, 0xf6, 0xea, 0xf4, 0xe9, 0xf1, 0x9c, 0xcf, 0x79, 0x33, 0x75, + 0xea, 0x97, 0x14, 0x0e, 0xbf, 0x75, 0xe1, 0x60, 0x14, 0xe7, 0x71, 0x91, 0x30, 0x52, 0x7c, 0xe4, + 0xe8, 0x15, 0x7c, 0x54, 0xf2, 0xbb, 0x22, 0x8d, 0xb2, 0x14, 0x03, 0x13, 0x58, 0xbd, 0xd1, 0x60, + 0xf3, 0xeb, 0xa4, 0x4f, 0x6b, 0x8e, 0x78, 0xb4, 0xdf, 0x0c, 0x49, 0x8a, 0x8e, 0xe1,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 0x35, 0x53, 0xb3, 0x7a, 0x54, 0xff, 0x3b, 0x20, 0x92, 0x47, 0x2e, 0xdc, 0x57, + 0x9d, 0x45, 0x79, 0x56, 0x09, 0xdc, 0x33, 0x35, 0x6b, 0x70, 0x66, 0xfc, 0xbf, 0x2e, 0x3a, 0x50, + 0x3b, 0x57, 0x59, 0x25, 0x86, 0x4e, 0x9b, 0xa0, 0x46, 0x0f, 0x0c, 0xd6, 0x09, 0x2a, 0x0c, 0x4c, + 0xcd, 0xda, 0x6b, 0x0d, 0xd6, 0x11, 0xaa, 0xd1, 0xfb, 0x1f, 0x1b, 0x03, 0xdc, 0x6f, 0x0c, 0xf0, + 0x7b, 0x63, 0x80, 0xaf, 0x5b, 0xa3, 0x73, 0xbf, 0x35, 0x3a, 0x3f, 0xb7, 0x46, 0xe7, 0xc3, 0x9b, + 0x79, 0x26, 0x16, 0x77, 0x33, 0x3b, 0xe1, 0x9f, 0x1c, 0x5f, 0x3a, 0x08, 0x98, 0xf8, 0xcc, 0xcb, + 0xa5, 0xd3, 0x5e, 0xe7, 0xba, 0xbd, 0x4f, 0xf1, 0xe5, 0x96, 0x55, 0xb3, 0xdd, 0xe6, 0xda, 0xde, + 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0x52, 0x33, 0xfd, 0xca, 0xbe, 0x02, 0x00, 0x00, } func (m *BalanceInfo) Marshal() (dAtA []byte, err error) { diff --git a/x/oracle/types/query.pb.go b/x/oracle/types/query.pb.go index d980f4de6..2874279e4 100644 --- a/x/oracle/types/query.pb.go +++ b/x/oracle/types/query.pb.go @@ -1334,7 +1334,9 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { + // stakerList shows all stakers related to the specified asset under native-restaking context StakerList(ctx context.Context, in *QueryStakerListRequest, opts ...grpc.CallOption) (*QueryStakerListResponse, error) + // StakerInfo shows the details for all stakers of the specified assets under native-restaking context StakerInfos(ctx context.Context, in *QueryStakerInfosRequest, opts ...grpc.CallOption) (*QueryStakerInfosResponse, error) // Parameters queries the parameters of the module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) @@ -1476,7 +1478,9 @@ func (c *queryClient) RecentParamsAll(ctx context.Context, in *QueryAllRecentPar // QueryServer is the server API for Query service. type QueryServer interface { + // stakerList shows all stakers related to the specified asset under native-restaking context StakerList(context.Context, *QueryStakerListRequest) (*QueryStakerListResponse, error) + // StakerInfo shows the details for all stakers of the specified assets under native-restaking context StakerInfos(context.Context, *QueryStakerInfosRequest) (*QueryStakerInfosResponse, error) // Parameters queries the parameters of the module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)