Documentation ¶
Index ¶
- Constants
- Variables
- func BytesToSymbol(symbolBytes [32]byte) string
- func ConvertBCAmountToBSCAmount(contractDecimals int8, bcAmount int64) (sdk.Int, sdk.Error)
- func ConvertBSCAmountToBCAmount(contractDecimals int8, bscAmount sdk.Int) (int64, sdk.Error)
- func ConvertBSCAmountToBCAmountBigInt(contractDecimals int8, bscAmount sdk.Int) (sdk.Int, sdk.Error)
- func ErrBindRequestExists(msg string) sdk.Error
- func ErrBindRequestNotExists(msg string) sdk.Error
- func ErrDeserializePackageFailed(msg string) sdk.Error
- func ErrFeeNotFound(msg string) sdk.Error
- func ErrInvalidAmount(msg string) sdk.Error
- func ErrInvalidClaim(msg string) sdk.Error
- func ErrInvalidContractAddress(msg string) sdk.Error
- func ErrInvalidDecimals(msg string) sdk.Error
- func ErrInvalidEthereumAddress(msg string) sdk.Error
- func ErrInvalidExpireTime(msg string) sdk.Error
- func ErrInvalidLength(msg string) sdk.Error
- func ErrInvalidMirror(msg string) sdk.Error
- func ErrInvalidMirrorSync(msg string) sdk.Error
- func ErrInvalidSymbol(msg string) sdk.Error
- func ErrMirrorSymbolExists(msg string) sdk.Error
- func ErrMirrorSyncInvalidSupply(msg string) sdk.Error
- func ErrNotBoundByMirror(msg string) sdk.Error
- func ErrScriptsExecutionError(msg string) sdk.Error
- func ErrTokenBindRelationChanged(msg string) sdk.Error
- func ErrTokenBound(msg string) sdk.Error
- func ErrTokenNotBound(msg string) sdk.Error
- func ErrTransferInExpire(msg string) sdk.Error
- func GenerateTransferInTags(receiverAddresses []sdk.AccAddress, symbol string, amounts []*big.Int, ...) sdk.Tags
- func GetBindRequestKey(symbol string) []byte
- func GetContractDecimalsKey(contractAddr []byte) []byte
- func GetFee(feeName string) (sdk.Fee, sdk.Error)
- func SymbolToBytes(symbol string) [32]byte
- type ApproveBindAckPackage
- type ApproveBindSynPackage
- type BindAckPackage
- type BindMsg
- type BindPackageType
- type BindRequest
- type BindStatus
- type BindSynPackage
- type MirrorAckPackage
- type MirrorSynPackage
- type MirrorSyncAckPackage
- type MirrorSyncSynPackage
- type RefundReason
- type TransferInRefundPackage
- type TransferInSynPackage
- type TransferOutMsg
- func (msg TransferOutMsg) GetInvolvedAddresses() []sdk.AccAddress
- func (msg TransferOutMsg) GetSignBytes() []byte
- func (msg TransferOutMsg) GetSigners() []sdk.AccAddress
- func (msg TransferOutMsg) Route() string
- func (msg TransferOutMsg) String() string
- func (msg TransferOutMsg) Type() string
- func (msg TransferOutMsg) ValidateBasic() sdk.Error
- type TransferOutRefundPackage
- type TransferOutSynPackage
- type UnbindMsg
- func (msg UnbindMsg) GetInvolvedAddresses() []sdk.AccAddress
- func (msg UnbindMsg) GetSignBytes() []byte
- func (msg UnbindMsg) GetSigners() []sdk.AccAddress
- func (msg UnbindMsg) Route() string
- func (msg UnbindMsg) String() string
- func (msg UnbindMsg) Type() string
- func (msg UnbindMsg) ValidateBasic() sdk.Error
Constants ¶
View Source
const ( BSCBNBDecimals int8 = 18 BindChannel = "bind" TransferOutChannel = "transferOut" TransferInChannel = "transferIn" MirrorChannel = "mirror" MirrorSyncChannel = "mirrorSync" BindChannelID sdk.ChannelID = 1 TransferOutChannelID sdk.ChannelID = 2 TransferInChannelID sdk.ChannelID = 3 MirrorChannelID sdk.ChannelID = 4 MirrorSyncChannelID sdk.ChannelID = 5 MinTransferOutExpireTimeGap = 60 * time.Second MinBindExpireTimeGap = 600 * time.Second BNBContractAddr = "0x0000000000000000000000000000000000000000" BNBContractDecimals = 18 )
View Source
const ( DefaultCodespace sdk.CodespaceType = 12 CodeInvalidAmount sdk.CodeType = 1 CodeInvalidEthereumAddress sdk.CodeType = 2 CodeInvalidDecimals sdk.CodeType = 3 CodeInvalidContractAddress sdk.CodeType = 4 CodeTokenNotBound sdk.CodeType = 5 CodeInvalidSymbol sdk.CodeType = 6 CodeInvalidExpireTime sdk.CodeType = 7 CodeBindRequestExists sdk.CodeType = 8 CodeBindRequestNotExists sdk.CodeType = 9 CodeTokenBound sdk.CodeType = 10 CodeInvalidLength sdk.CodeType = 11 CodeFeeNotFound sdk.CodeType = 12 CodeInvalidClaim sdk.CodeType = 13 CodeDeserializePackageFailed sdk.CodeType = 14 CodeTokenBindRelationChanged sdk.CodeType = 15 CodeTransferInExpire sdk.CodeType = 16 CodeScriptsExecutionError sdk.CodeType = 17 CodeInvalidMirror sdk.CodeType = 18 CodeMirrorSymbolExists sdk.CodeType = 19 CodeInvalidMirrorSync sdk.CodeType = 20 CodeNotBoundByMirror sdk.CodeType = 21 CodeMirrorSyncInvalidSupply sdk.CodeType = 22 )
View Source
const ( BindRelayFeeName = "crossBindRelayFee" UnbindRelayFeeName = "crossUnbindRelayFee" TransferOutRelayFeeName = "crossTransferOutRelayFee" )
View Source
const ( RouteBridge = "bridge" BindMsgType = "crossBind" UnbindMsgType = "crossUnbind" TransferOutMsgType = "crossTransferOut" )
View Source
const ( MirrorErrCodeExpired uint8 = 1 MirrorErrCodeBEP2SymbolExists uint8 = 2 MirrorErrCodeDecimalOverflow uint8 = 3 MirrorErrCodeInvalidSymbol uint8 = 4 MirrorErrCodeInvalidSupply uint8 = 5 )
View Source
const ( MirrorSyncErrCodeExpired uint8 = 1 MirrorSyncErrNotBoundByMirror uint8 = 2 MirrorSyncErrInvalidSupply uint8 = 3 )
View Source
const ( TagSendSequence = "SendSequence" TagChannel = "Channel" TagRelayerFee = "relayerFee" TagMirrorContract = "contract" TagMirrorSymbol = "symbol" TagMirrorSupply = "supply" TagMirrorErrorCode = "errCode" )
View Source
const (
MaxSymbolLength = 32
)
Variables ¶
View Source
var ( // bnb prefix address: bnb1v8vkkymvhe2sf7gd2092ujc6hweta38xadu2pj // tbnb prefix address: tbnb1v8vkkymvhe2sf7gd2092ujc6hweta38xnc4wpr PegAccount = sdk.AccAddress(crypto.AddressHash([]byte("BinanceChainPegAccount"))) )
Functions ¶
func BytesToSymbol ¶
func ErrBindRequestExists ¶
func ErrBindRequestNotExists ¶
func ErrFeeNotFound ¶
func ErrInvalidAmount ¶
func ErrInvalidClaim ¶
func ErrInvalidDecimals ¶
func ErrInvalidExpireTime ¶
func ErrInvalidLength ¶
func ErrInvalidMirror ¶
func ErrInvalidMirrorSync ¶
func ErrInvalidSymbol ¶
func ErrMirrorSymbolExists ¶
func ErrNotBoundByMirror ¶
func ErrTokenBound ¶
func ErrTokenNotBound ¶
func ErrTransferInExpire ¶
func GenerateTransferInTags ¶
func GetBindRequestKey ¶
func GetContractDecimalsKey ¶
func SymbolToBytes ¶
Types ¶
type ApproveBindAckPackage ¶
type ApproveBindAckPackage struct {
TokenSymbol [32]byte
}
type ApproveBindSynPackage ¶
type ApproveBindSynPackage struct { Status BindStatus TokenSymbol [32]byte }
func DeserializeApproveBindSynPackage ¶
func DeserializeApproveBindSynPackage(serializedPackage []byte) (*ApproveBindSynPackage, sdk.Error)
type BindAckPackage ¶
type BindAckPackage struct {
TokenSymbol [32]byte
}
type BindMsg ¶
type BindMsg struct { From sdk.AccAddress `json:"from"` Symbol string `json:"symbol"` Amount int64 `json:"amount"` ContractAddress sdk.SmartChainAddress `json:"contract_address"` ContractDecimals int8 `json:"contract_decimals"` ExpireTime int64 `json:"expire_time"` }
func NewBindMsg ¶
func NewBindMsg(from sdk.AccAddress, symbol string, amount int64, contractAddress sdk.SmartChainAddress, contractDecimals int8, expireTime int64) BindMsg
func (BindMsg) GetInvolvedAddresses ¶
func (msg BindMsg) GetInvolvedAddresses() []sdk.AccAddress
func (BindMsg) GetSignBytes ¶
func (BindMsg) GetSigners ¶
func (msg BindMsg) GetSigners() []sdk.AccAddress
func (BindMsg) ValidateBasic ¶
type BindPackageType ¶
type BindPackageType uint8
const ( BindTypeBind BindPackageType = 0 BindTypeUnbind BindPackageType = 1 )
type BindRequest ¶
type BindRequest struct { From sdk.AccAddress `json:"from"` Symbol string `json:"symbol"` Amount int64 `json:"amount"` DeductedAmount int64 `json:"deducted_amount"` ContractAddress sdk.SmartChainAddress `json:"contract_address"` ContractDecimals int8 `json:"contract_decimals"` ExpireTime int64 `json:"expire_time"` }
type BindStatus ¶
type BindStatus uint32
const ( BindStatusSuccess BindStatus = 0 BindStatusRejected BindStatus = 1 BindStatusTimeout BindStatus = 2 BindStatusInvalidParameter BindStatus = 3 )
func ParseBindStatus ¶
func ParseBindStatus(input string) (BindStatus, error)
func (BindStatus) String ¶
func (status BindStatus) String() string
type BindSynPackage ¶
type BindSynPackage struct { PackageType BindPackageType TokenSymbol [32]byte ContractAddr sdk.SmartChainAddress TotalSupply *big.Int PeggyAmount *big.Int Decimals uint8 ExpireTime uint64 }
func DeserializeBindSynPackage ¶
func DeserializeBindSynPackage(serializedPackage []byte) (*BindSynPackage, sdk.Error)
type MirrorAckPackage ¶
type MirrorAckPackage struct { MirrorSender sdk.SmartChainAddress ContractAddr sdk.SmartChainAddress Decimals uint8 BEP2Symbol [32]byte MirrorFee *big.Int ErrorCode uint8 }
type MirrorSynPackage ¶
type MirrorSynPackage struct { MirrorSender sdk.SmartChainAddress ContractAddr sdk.SmartChainAddress BEP20Name [32]byte BEP20Symbol [32]byte BEP20TotalSupply *big.Int BEP20Decimals uint8 MirrorFee *big.Int ExpireTime uint64 }
func DeserializeMirrorSynPackage ¶
func DeserializeMirrorSynPackage(serializedPackage []byte) (*MirrorSynPackage, sdk.Error)
type MirrorSyncAckPackage ¶
type MirrorSyncAckPackage struct { SyncSender sdk.SmartChainAddress ContractAddr sdk.SmartChainAddress SyncFee *big.Int ErrorCode uint8 }
type MirrorSyncSynPackage ¶
type MirrorSyncSynPackage struct { SyncSender sdk.SmartChainAddress ContractAddr sdk.SmartChainAddress BEP2Symbol [32]byte BEP20TotalSupply *big.Int SyncFee *big.Int ExpireTime uint64 }
func DeserializeMirrorSyncSynPackage ¶
func DeserializeMirrorSyncSynPackage(serializedPackage []byte) (*MirrorSyncSynPackage, sdk.Error)
type RefundReason ¶
type RefundReason uint32
const ( UnboundToken RefundReason = 1 Timeout RefundReason = 2 InsufficientBalance RefundReason = 3 Unknown RefundReason = 4 ForbidTransferToBPE12Addr RefundReason = 5 )
type TransferInRefundPackage ¶
type TransferInRefundPackage struct { ContractAddr sdk.SmartChainAddress RefundAmounts []*big.Int RefundAddresses []sdk.SmartChainAddress RefundReason RefundReason }
type TransferInSynPackage ¶
type TransferInSynPackage struct { TokenSymbol [32]byte ContractAddress sdk.SmartChainAddress Amounts []*big.Int ReceiverAddresses []sdk.AccAddress RefundAddresses []sdk.SmartChainAddress ExpireTime uint64 }
func DeserializeTransferInSynPackage ¶
func DeserializeTransferInSynPackage(serializedPackage []byte) (*TransferInSynPackage, sdk.Error)
type TransferOutMsg ¶
type TransferOutMsg struct { From sdk.AccAddress `json:"from"` To sdk.SmartChainAddress `json:"to"` Amount sdk.Coin `json:"amount"` ExpireTime int64 `json:"expire_time"` }
func NewTransferOutMsg ¶
func NewTransferOutMsg(from sdk.AccAddress, to sdk.SmartChainAddress, amount sdk.Coin, expireTime int64) TransferOutMsg
func (TransferOutMsg) GetInvolvedAddresses ¶
func (msg TransferOutMsg) GetInvolvedAddresses() []sdk.AccAddress
func (TransferOutMsg) GetSignBytes ¶
func (msg TransferOutMsg) GetSignBytes() []byte
func (TransferOutMsg) GetSigners ¶
func (msg TransferOutMsg) GetSigners() []sdk.AccAddress
func (TransferOutMsg) Route ¶
func (msg TransferOutMsg) Route() string
func (TransferOutMsg) String ¶
func (msg TransferOutMsg) String() string
func (TransferOutMsg) Type ¶
func (msg TransferOutMsg) Type() string
func (TransferOutMsg) ValidateBasic ¶
func (msg TransferOutMsg) ValidateBasic() sdk.Error
type TransferOutRefundPackage ¶
type TransferOutRefundPackage struct { TokenSymbol [32]byte RefundAmount *big.Int RefundAddr sdk.AccAddress RefundReason RefundReason }
func DeserializeTransferOutRefundPackage ¶
func DeserializeTransferOutRefundPackage(serializedPackage []byte) (*TransferOutRefundPackage, sdk.Error)
type TransferOutSynPackage ¶
type TransferOutSynPackage struct { TokenSymbol [32]byte ContractAddress sdk.SmartChainAddress Amount *big.Int Recipient sdk.SmartChainAddress RefundAddress sdk.AccAddress ExpireTime uint64 }
func DeserializeTransferOutSynPackage ¶
func DeserializeTransferOutSynPackage(serializedPackage []byte) (*TransferOutSynPackage, sdk.Error)
type UnbindMsg ¶
type UnbindMsg struct { From sdk.AccAddress `json:"from"` Symbol string `json:"symbol"` }
func NewUnbindMsg ¶
func NewUnbindMsg(from sdk.AccAddress, symbol string) UnbindMsg
func (UnbindMsg) GetInvolvedAddresses ¶
func (msg UnbindMsg) GetInvolvedAddresses() []sdk.AccAddress
func (UnbindMsg) GetSignBytes ¶
func (UnbindMsg) GetSigners ¶
func (msg UnbindMsg) GetSigners() []sdk.AccAddress
func (UnbindMsg) ValidateBasic ¶
Click to show internal directories.
Click to hide internal directories.