Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterWebServer(s grpc.ServiceRegistrar, srv WebServer)
- type Allowed
- type ErrCode
- type ErrMsg
- type ExecuteMsg
- type ExecuteMsgTxFunc
- type ExecuteMsgWithXfer
- type ExecuteMsgWithXferRefund
- type ExecuteMsgWithXferRefundTxFunc
- type ExecuteMsgWithXferTxFunc
- type ExecuteRefund
- type ExecutionStatus
- type InitPegRefundRequest
- func (*InitPegRefundRequest) Descriptor() ([]byte, []int)deprecated
- func (x *InitPegRefundRequest) GetRefId() []byte
- func (*InitPegRefundRequest) ProtoMessage()
- func (x *InitPegRefundRequest) ProtoReflect() protoreflect.Message
- func (x *InitPegRefundRequest) Reset()
- func (x *InitPegRefundRequest) String() string
- type InitPegRefundResponse
- func (*InitPegRefundResponse) Descriptor() ([]byte, []int)deprecated
- func (x *InitPegRefundResponse) GetErr() *ErrMsg
- func (*InitPegRefundResponse) ProtoMessage()
- func (x *InitPegRefundResponse) ProtoReflect() protoreflect.Message
- func (x *InitPegRefundResponse) Reset()
- func (x *InitPegRefundResponse) String() string
- type InitWithdrawRequest
- func (*InitWithdrawRequest) Descriptor() ([]byte, []int)deprecated
- func (x *InitWithdrawRequest) GetSig() []byte
- func (x *InitWithdrawRequest) GetWithdrawReq() []byte
- func (*InitWithdrawRequest) ProtoMessage()
- func (x *InitWithdrawRequest) ProtoReflect() protoreflect.Message
- func (x *InitWithdrawRequest) Reset()
- func (x *InitWithdrawRequest) String() string
- type InitWithdrawResponse
- func (*InitWithdrawResponse) Descriptor() ([]byte, []int)deprecated
- func (x *InitWithdrawResponse) GetErr() *ErrMsg
- func (*InitWithdrawResponse) ProtoMessage()
- func (x *InitWithdrawResponse) ProtoReflect() protoreflect.Message
- func (x *InitWithdrawResponse) Reset()
- func (x *InitWithdrawResponse) String() string
- type MessageRoute
- type RefundTxFunc
- type RetryConfig
- func (c *RetryConfig) ApplyDefaults()
- func (c *RetryConfig) GetInitialBackoff() time.Duration
- func (c *RetryConfig) GetIntervalSeconds() time.Duration
- func (c *RetryConfig) PrettyLog()
- func (c *RetryConfig) ShouldBackoff(attempts uint64, lastTryTime time.Time) bool
- func (c *RetryConfig) String() string
- type UnimplementedWebServer
- type UnsafeWebServer
- type WebClient
- type WebServer
Constants ¶
const ( KeyService = "service" KeyEnableAutoRefund = "executor.enable_auto_refund" KeyExecutorRetry = "executor.retry" KeyGatewayGrpcUrl = "sgnd.gateway_grpc" KeySgnGrpcUrl = "sgnd.sgn_grpc" KeyDbUrl = "db.url" KeyAlert = "alert" KeyServerEnable = "server.enable" KeyServerPort = "server.port" )
config keys
const ( MessageBusEventExecuted = "Executed" LiqBridgeEventRelay = "Relay" PegBridgeEventMint = "Mint" PegVaultEventWithdrawn = "Withdrawn" )
monitor event names
const ( MaxPollingRetries = 10 PollingInterval = 6 * time.Second GatewayTimeout = 5 * time.Second MaxExecuteRetry = 15 // TODO use types.DEFAULT_MAX_ATTEMPTS instead of this BalanceCheckInterval = 15 * time.Minute )
const ( DEFAULT_INITIAL_BACKOFF_SECONDS = 30 DEFAULT_INTERVAL_SECONDS = 30 DEFAULT_SCALING_FACTOR = 1 // linear backoff DEFAULT_MAX_ATTEMPTS = 15 // TODO remove types.MaxExecuteRetry and implement retry max attempts )
Variables ¶
var ( ErrCode_name = map[int32]string{ 0: "ERROR_CODE_UNDEFINED", 500: "ERROR_CODE_COMMON", 1001: "ERROR_NO_TOKEN_ON_DST_CHAIN", 1002: "ERROR_NO_TOKEN_ON_SRC_CHAIN", 1003: "ERROR_INIT_WITHDRAW_FAILED", 1004: "ERROR_CODE_NO_ENOUGH_TOKEN_ON_DST_CHAIN", 1005: "ERROR_CODE_INBOUND_LIQUIDITY_LIMIT", 1006: "ERROR_CODE_DB_ERR", 1007: "ERROR_CODE_INVALID_TIME_PARAM", 1008: "ERROR_CODE_TRANSFER_REF_ID_NOT_FOUND", 1009: "ERROR_CODE_TRANSFER_DISABLED", 1010: "ERROR_CODE_LIQ_RM_DISABLED", 1011: "ERROR_CODE_LIQ_AGG_RM_SRC_DISABLED", 1012: "ERROR_CODE_BAD_LIQ_SLIPPAGE", } ErrCode_value = map[string]int32{ "ERROR_CODE_UNDEFINED": 0, "ERROR_CODE_COMMON": 500, "ERROR_NO_TOKEN_ON_DST_CHAIN": 1001, "ERROR_NO_TOKEN_ON_SRC_CHAIN": 1002, "ERROR_INIT_WITHDRAW_FAILED": 1003, "ERROR_CODE_NO_ENOUGH_TOKEN_ON_DST_CHAIN": 1004, "ERROR_CODE_INBOUND_LIQUIDITY_LIMIT": 1005, "ERROR_CODE_DB_ERR": 1006, "ERROR_CODE_INVALID_TIME_PARAM": 1007, "ERROR_CODE_TRANSFER_REF_ID_NOT_FOUND": 1008, "ERROR_CODE_TRANSFER_DISABLED": 1009, "ERROR_CODE_LIQ_RM_DISABLED": 1010, "ERROR_CODE_LIQ_AGG_RM_SRC_DISABLED": 1011, "ERROR_CODE_BAD_LIQ_SLIPPAGE": 1012, } )
Enum value maps for ErrCode.
var ExecutionStatusMap = map[ExecutionStatus]string{
0: "Unknown",
1: "Unexecuted",
2: "Init_Refund_Executing",
3: "Init_Refund_Executed",
4: "Init_Refund_Failed",
5: "Executing",
6: "Succeeded",
7: "Fallback",
8: "Failed",
9: "Ignored",
10: "Delayed",
11: "Delay_Executing",
12: "Delay_Executed",
13: "Delay_Execution_Failed",
}
var File_gateway_min_proto protoreflect.FileDescriptor
var Web_ServiceDesc = grpc.ServiceDesc{ ServiceName: "sgn.gateway.v1.Web", HandlerType: (*WebServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "InitWithdraw", Handler: _Web_InitWithdraw_Handler, }, { MethodName: "InitPegRefund", Handler: _Web_InitPegRefund_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "gateway_min.proto", }
Web_ServiceDesc is the grpc.ServiceDesc for Web service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterWebServer ¶
func RegisterWebServer(s grpc.ServiceRegistrar, srv WebServer)
Types ¶
type ErrCode ¶
type ErrCode int32
const ( ErrCode_ERROR_CODE_UNDEFINED ErrCode = 0 ErrCode_ERROR_CODE_COMMON ErrCode = 500 ErrCode_ERROR_NO_TOKEN_ON_DST_CHAIN ErrCode = 1001 ErrCode_ERROR_NO_TOKEN_ON_SRC_CHAIN ErrCode = 1002 ErrCode_ERROR_INIT_WITHDRAW_FAILED ErrCode = 1003 ErrCode_ERROR_CODE_NO_ENOUGH_TOKEN_ON_DST_CHAIN ErrCode = 1004 ErrCode_ERROR_CODE_INBOUND_LIQUIDITY_LIMIT ErrCode = 1005 ErrCode_ERROR_CODE_DB_ERR ErrCode = 1006 ErrCode_ERROR_CODE_INVALID_TIME_PARAM ErrCode = 1007 ErrCode_ERROR_CODE_TRANSFER_REF_ID_NOT_FOUND ErrCode = 1008 ErrCode_ERROR_CODE_TRANSFER_DISABLED ErrCode = 1009 ErrCode_ERROR_CODE_LIQ_RM_DISABLED ErrCode = 1010 ErrCode_ERROR_CODE_LIQ_AGG_RM_SRC_DISABLED ErrCode = 1011 ErrCode_ERROR_CODE_BAD_LIQ_SLIPPAGE ErrCode = 1012 )
func (ErrCode) Descriptor ¶
func (ErrCode) Descriptor() protoreflect.EnumDescriptor
func (ErrCode) EnumDescriptor
deprecated
func (ErrCode) Number ¶
func (x ErrCode) Number() protoreflect.EnumNumber
func (ErrCode) Type ¶
func (ErrCode) Type() protoreflect.EnumType
type ErrMsg ¶
type ErrMsg struct { Code ErrCode `protobuf:"varint,1,opt,name=code,proto3,enum=sgn.gateway.v1.ErrCode" json:"code,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` // contains filtered or unexported fields }
func (*ErrMsg) Descriptor
deprecated
func (*ErrMsg) ProtoMessage ¶
func (*ErrMsg) ProtoMessage()
func (*ErrMsg) ProtoReflect ¶
func (x *ErrMsg) ProtoReflect() protoreflect.Message
type ExecuteMsg ¶
type ExecuteMsg func(execute ExecuteMsgTxFunc, messageId []byte, msg []byte, route MessageRoute, sortedSigs [][]byte, signers []eth.Addr, powers []*big.Int) error
type ExecuteMsgTxFunc ¶
type ExecuteMsgTxFunc func(opts *bind.TransactOpts, msg []byte, route MessageRoute, sortedSigs [][]byte, signers []eth.Addr, powers []*big.Int) (*ethtypes.Transaction, error)
type ExecuteMsgWithXfer ¶
type ExecuteMsgWithXferRefundTxFunc ¶
type ExecuteMsgWithXferRefundTxFunc func(opts *bind.TransactOpts, msg []byte, xfer eth.MsgDataTypesTransferInfo, sortedSigs [][]byte, signers []eth.Addr, powers []*big.Int) (*ethtypes.Transaction, error)
type ExecuteMsgWithXferTxFunc ¶
type ExecuteMsgWithXferTxFunc func(opts *bind.TransactOpts, msg []byte, xfer eth.MsgDataTypesTransferInfo, sortedSigs [][]byte, signers []eth.Addr, powers []*big.Int) (*ethtypes.Transaction, error)
type ExecuteRefund ¶
type ExecutionStatus ¶
type ExecutionStatus uint64
const ( ExecutionStatus_Unknown ExecutionStatus = iota // initial default status ExecutionStatus_Unexecuted // status branch: if the msg is the "refund" kind of message // executor needs to do InitWithdraw (if liq bridge) or ClaimRefund (if peg bridge) first before executing the message ExecutionStatus_Init_Refund_Executing // executor only executes the "refund" message at msgbus if the message is in this status ExecutionStatus_Init_Refund_Executed ExecutionStatus_Init_Refund_Failed ExecutionStatus_Executing // statuses after execution at msgbus ExecutionStatus_Succeeded ExecutionStatus_Fallback ExecutionStatus_Failed // ignored due to failed sender verification ExecutionStatus_Ignored // statuses related to delay message ExecutionStatus_Delayed ExecutionStatus_Delay_Executing ExecutionStatus_Delay_Executed ExecutionStatus_Delay_Execution_Failed )
func NewExecutionStatus ¶
func NewExecutionStatus(msgbusStatus uint8) (ExecutionStatus, error)
txStatus is MessageReceiver's enum TxStatus
func (ExecutionStatus) IsFinal ¶
func (s ExecutionStatus) IsFinal() bool
func (ExecutionStatus) String ¶
func (s ExecutionStatus) String() string
type InitPegRefundRequest ¶
type InitPegRefundRequest struct { RefId []byte `protobuf:"bytes,1,opt,name=ref_id,json=refId,proto3" json:"ref_id,omitempty"` // contains filtered or unexported fields }
func (*InitPegRefundRequest) Descriptor
deprecated
func (*InitPegRefundRequest) Descriptor() ([]byte, []int)
Deprecated: Use InitPegRefundRequest.ProtoReflect.Descriptor instead.
func (*InitPegRefundRequest) GetRefId ¶
func (x *InitPegRefundRequest) GetRefId() []byte
func (*InitPegRefundRequest) ProtoMessage ¶
func (*InitPegRefundRequest) ProtoMessage()
func (*InitPegRefundRequest) ProtoReflect ¶
func (x *InitPegRefundRequest) ProtoReflect() protoreflect.Message
func (*InitPegRefundRequest) Reset ¶
func (x *InitPegRefundRequest) Reset()
func (*InitPegRefundRequest) String ¶
func (x *InitPegRefundRequest) String() string
type InitPegRefundResponse ¶
type InitPegRefundResponse struct { Err *ErrMsg `protobuf:"bytes,1,opt,name=err,proto3" json:"err,omitempty"` // contains filtered or unexported fields }
func (*InitPegRefundResponse) Descriptor
deprecated
func (*InitPegRefundResponse) Descriptor() ([]byte, []int)
Deprecated: Use InitPegRefundResponse.ProtoReflect.Descriptor instead.
func (*InitPegRefundResponse) GetErr ¶
func (x *InitPegRefundResponse) GetErr() *ErrMsg
func (*InitPegRefundResponse) ProtoMessage ¶
func (*InitPegRefundResponse) ProtoMessage()
func (*InitPegRefundResponse) ProtoReflect ¶
func (x *InitPegRefundResponse) ProtoReflect() protoreflect.Message
func (*InitPegRefundResponse) Reset ¶
func (x *InitPegRefundResponse) Reset()
func (*InitPegRefundResponse) String ¶
func (x *InitPegRefundResponse) String() string
type InitWithdrawRequest ¶
type InitWithdrawRequest struct { WithdrawReq []byte `protobuf:"bytes,1,opt,name=withdraw_req,json=withdrawReq,proto3" json:"withdraw_req,omitempty"` // serialized WithdrawReq in sgn/cbridge/v1/tx.proto Sig []byte `protobuf:"bytes,2,opt,name=sig,proto3" json:"sig,omitempty"` // empty if for contract // contains filtered or unexported fields }
func (*InitWithdrawRequest) Descriptor
deprecated
func (*InitWithdrawRequest) Descriptor() ([]byte, []int)
Deprecated: Use InitWithdrawRequest.ProtoReflect.Descriptor instead.
func (*InitWithdrawRequest) GetSig ¶
func (x *InitWithdrawRequest) GetSig() []byte
func (*InitWithdrawRequest) GetWithdrawReq ¶
func (x *InitWithdrawRequest) GetWithdrawReq() []byte
func (*InitWithdrawRequest) ProtoMessage ¶
func (*InitWithdrawRequest) ProtoMessage()
func (*InitWithdrawRequest) ProtoReflect ¶
func (x *InitWithdrawRequest) ProtoReflect() protoreflect.Message
func (*InitWithdrawRequest) Reset ¶
func (x *InitWithdrawRequest) Reset()
func (*InitWithdrawRequest) String ¶
func (x *InitWithdrawRequest) String() string
type InitWithdrawResponse ¶
type InitWithdrawResponse struct { Err *ErrMsg `protobuf:"bytes,1,opt,name=err,proto3" json:"err,omitempty"` // contains filtered or unexported fields }
func (*InitWithdrawResponse) Descriptor
deprecated
func (*InitWithdrawResponse) Descriptor() ([]byte, []int)
Deprecated: Use InitWithdrawResponse.ProtoReflect.Descriptor instead.
func (*InitWithdrawResponse) GetErr ¶
func (x *InitWithdrawResponse) GetErr() *ErrMsg
func (*InitWithdrawResponse) ProtoMessage ¶
func (*InitWithdrawResponse) ProtoMessage()
func (*InitWithdrawResponse) ProtoReflect ¶
func (x *InitWithdrawResponse) ProtoReflect() protoreflect.Message
func (*InitWithdrawResponse) Reset ¶
func (x *InitWithdrawResponse) Reset()
func (*InitWithdrawResponse) String ¶
func (x *InitWithdrawResponse) String() string
type MessageRoute ¶
type RefundTxFunc ¶
type RetryConfig ¶
type RetryConfig struct { // the initial amount of seconds to wait before the first retry InitialBackoffSeconds uint64 `mapstructure:"initial_backoff_seconds"` // amount of seconds in between retries, affected by scaling factor IntervalSeconds uint64 `mapstructure:"interval_seconds"` // for any retry count n, x = scaling factor, s = interval seconds, // actual retry interval = s * n^x // e.g. set x = 0 for constant backoff, 1 for linear backoff, 2 for quadratic backoff, etc... ScalingFactor float64 `mapstructure:"scaling_factor"` // number of retries before giving up MaxAttempts int `mapstructure:"max_attempts"` }
func (*RetryConfig) ApplyDefaults ¶
func (c *RetryConfig) ApplyDefaults()
func (*RetryConfig) GetInitialBackoff ¶
func (c *RetryConfig) GetInitialBackoff() time.Duration
func (*RetryConfig) GetIntervalSeconds ¶
func (c *RetryConfig) GetIntervalSeconds() time.Duration
func (*RetryConfig) PrettyLog ¶
func (c *RetryConfig) PrettyLog()
func (*RetryConfig) ShouldBackoff ¶
func (c *RetryConfig) ShouldBackoff(attempts uint64, lastTryTime time.Time) bool
func (*RetryConfig) String ¶
func (c *RetryConfig) String() string
type UnimplementedWebServer ¶
type UnimplementedWebServer struct { }
UnimplementedWebServer must be embedded to have forward compatible implementations.
func (UnimplementedWebServer) InitPegRefund ¶
func (UnimplementedWebServer) InitPegRefund(context.Context, *InitPegRefundRequest) (*InitPegRefundResponse, error)
func (UnimplementedWebServer) InitWithdraw ¶
func (UnimplementedWebServer) InitWithdraw(context.Context, *InitWithdrawRequest) (*InitWithdrawResponse, error)
type UnsafeWebServer ¶
type UnsafeWebServer interface {
// contains filtered or unexported methods
}
UnsafeWebServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to WebServer will result in compilation errors.
type WebClient ¶
type WebClient interface { InitWithdraw(ctx context.Context, in *InitWithdrawRequest, opts ...grpc.CallOption) (*InitWithdrawResponse, error) InitPegRefund(ctx context.Context, in *InitPegRefundRequest, opts ...grpc.CallOption) (*InitPegRefundResponse, error) }
WebClient is the client API for Web service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewWebClient ¶
func NewWebClient(cc grpc.ClientConnInterface) WebClient
type WebServer ¶
type WebServer interface { InitWithdraw(context.Context, *InitWithdrawRequest) (*InitWithdrawResponse, error) InitPegRefund(context.Context, *InitPegRefundRequest) (*InitPegRefundResponse, error) // contains filtered or unexported methods }
WebServer is the server API for Web service. All implementations must embed UnimplementedWebServer for forward compatibility