mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-25 15:55:18 +00:00
6c68e41758
* most audit revisions * remove expected income * update begin block spec * filter queryAtomicSwaps, add queryAssetSupplies * update old address * update test * Remove legacy method * remove legacy comment * address PR comments * IsValid for SwapDirection, SwapStatus * fix rng logging * query asset supplies * return [64]byte from rng * remove cross chain field from MsgCreateAtomicSwap * move swap filtering to querier * rename Limit field to SupplyLimit
135 lines
6.5 KiB
Go
135 lines
6.5 KiB
Go
package bep3
|
|
|
|
import (
|
|
"github.com/kava-labs/kava/x/bep3/client/rest"
|
|
"github.com/kava-labs/kava/x/bep3/keeper"
|
|
"github.com/kava-labs/kava/x/bep3/types"
|
|
)
|
|
|
|
const (
|
|
AddrByteCount = types.AddrByteCount
|
|
AttributeKeyAmount = types.AttributeKeyAmount
|
|
AttributeKeyAtomicSwapID = types.AttributeKeyAtomicSwapID
|
|
AttributeKeyAtomicSwapIDs = types.AttributeKeyAtomicSwapIDs
|
|
AttributeKeyClaimSender = types.AttributeKeyClaimSender
|
|
AttributeKeyDirection = types.AttributeKeyDirection
|
|
AttributeKeyExpireHeight = types.AttributeKeyExpireHeight
|
|
AttributeKeyRandomNumber = types.AttributeKeyRandomNumber
|
|
AttributeKeyRandomNumberHash = types.AttributeKeyRandomNumberHash
|
|
AttributeKeyRecipient = types.AttributeKeyRecipient
|
|
AttributeKeyRefundSender = types.AttributeKeyRefundSender
|
|
AttributeKeySender = types.AttributeKeySender
|
|
AttributeKeySenderOtherChain = types.AttributeKeySenderOtherChain
|
|
AttributeKeyTimestamp = types.AttributeKeyTimestamp
|
|
AttributeValueCategory = types.AttributeValueCategory
|
|
CalcSwapID = types.CalcSwapID
|
|
ClaimAtomicSwap = types.ClaimAtomicSwap
|
|
Completed = types.Completed
|
|
CreateAtomicSwap = types.CreateAtomicSwap
|
|
DefaultLongtermStorageDuration = types.DefaultLongtermStorageDuration
|
|
DefaultParamspace = types.DefaultParamspace
|
|
EventTypeClaimAtomicSwap = types.EventTypeClaimAtomicSwap
|
|
EventTypeCreateAtomicSwap = types.EventTypeCreateAtomicSwap
|
|
EventTypeRefundAtomicSwap = types.EventTypeRefundAtomicSwap
|
|
EventTypeSwapsExpired = types.EventTypeSwapsExpired
|
|
Expired = types.Expired
|
|
INVALID = types.INVALID
|
|
Incoming = types.Incoming
|
|
Int64Size = types.Int64Size
|
|
MaxExpectedIncomeLength = types.MaxExpectedIncomeLength
|
|
MaxOtherChainAddrLength = types.MaxOtherChainAddrLength
|
|
ModuleName = types.ModuleName
|
|
NULL = types.NULL
|
|
Open = types.Open
|
|
Outgoing = types.Outgoing
|
|
QuerierRoute = types.QuerierRoute
|
|
QueryGetAssetSupply = types.QueryGetAssetSupply
|
|
QueryGetAtomicSwap = types.QueryGetAtomicSwap
|
|
QueryGetAtomicSwaps = types.QueryGetAtomicSwaps
|
|
QueryGetParams = types.QueryGetParams
|
|
RandomNumberHashLength = types.RandomNumberHashLength
|
|
RandomNumberLength = types.RandomNumberLength
|
|
RefundAtomicSwap = types.RefundAtomicSwap
|
|
RouterKey = types.RouterKey
|
|
StoreKey = types.StoreKey
|
|
SwapIDLength = types.SwapIDLength
|
|
)
|
|
|
|
var (
|
|
NewKeeper = keeper.NewKeeper
|
|
NewQuerier = keeper.NewQuerier
|
|
RegisterRoutes = rest.RegisterRoutes
|
|
CalculateRandomHash = types.CalculateRandomHash
|
|
CalculateSwapID = types.CalculateSwapID
|
|
DefaultGenesisState = types.DefaultGenesisState
|
|
DefaultParams = types.DefaultParams
|
|
ErrAssetNotActive = types.ErrAssetNotActive
|
|
ErrAssetNotSupported = types.ErrAssetNotSupported
|
|
ErrAssetSupplyNotFound = types.ErrAssetSupplyNotFound
|
|
ErrAtomicSwapAlreadyExists = types.ErrAtomicSwapAlreadyExists
|
|
ErrAtomicSwapNotFound = types.ErrAtomicSwapNotFound
|
|
ErrExceedsAvailableSupply = types.ErrExceedsAvailableSupply
|
|
ErrExceedsSupplyLimit = types.ErrExceedsSupplyLimit
|
|
ErrInvalidClaimSecret = types.ErrInvalidClaimSecret
|
|
ErrInvalidCurrentSupply = types.ErrInvalidCurrentSupply
|
|
ErrInvalidHeightSpan = types.ErrInvalidHeightSpan
|
|
ErrInvalidIncomingSupply = types.ErrInvalidIncomingSupply
|
|
ErrInvalidOutgoingSupply = types.ErrInvalidOutgoingSupply
|
|
ErrInvalidTimestamp = types.ErrInvalidTimestamp
|
|
ErrSwapNotClaimable = types.ErrSwapNotClaimable
|
|
ErrSwapNotRefundable = types.ErrSwapNotRefundable
|
|
GenerateSecureRandomNumber = types.GenerateSecureRandomNumber
|
|
GetAtomicSwapByHeightKey = types.GetAtomicSwapByHeightKey
|
|
NewAssetSupply = types.NewAssetSupply
|
|
NewAtomicSwap = types.NewAtomicSwap
|
|
NewGenesisState = types.NewGenesisState
|
|
NewMsgClaimAtomicSwap = types.NewMsgClaimAtomicSwap
|
|
NewMsgCreateAtomicSwap = types.NewMsgCreateAtomicSwap
|
|
NewMsgRefundAtomicSwap = types.NewMsgRefundAtomicSwap
|
|
NewParams = types.NewParams
|
|
NewQueryAssetSupply = types.NewQueryAssetSupply
|
|
NewQueryAtomicSwapByID = types.NewQueryAtomicSwapByID
|
|
NewQueryAtomicSwaps = types.NewQueryAtomicSwaps
|
|
NewSwapDirectionFromString = types.NewSwapDirectionFromString
|
|
NewSwapStatusFromString = types.NewSwapStatusFromString
|
|
ParamKeyTable = types.ParamKeyTable
|
|
RegisterCodec = types.RegisterCodec
|
|
|
|
// variable aliases
|
|
AbsoluteMaximumBlockLock = types.AbsoluteMaximumBlockLock
|
|
AbsoluteMinimumBlockLock = types.AbsoluteMinimumBlockLock
|
|
AssetSupplyKeyPrefix = types.AssetSupplyKeyPrefix
|
|
AtomicSwapByBlockPrefix = types.AtomicSwapByBlockPrefix
|
|
AtomicSwapCoinsAccAddr = types.AtomicSwapCoinsAccAddr
|
|
AtomicSwapKeyPrefix = types.AtomicSwapKeyPrefix
|
|
AtomicSwapLongtermStoragePrefix = types.AtomicSwapLongtermStoragePrefix
|
|
DefaultMaxBlockLock = types.DefaultMaxBlockLock
|
|
DefaultMinBlockLock = types.DefaultMinBlockLock
|
|
DefaultSupportedAssets = types.DefaultSupportedAssets
|
|
KeyBnbDeputyAddress = types.KeyBnbDeputyAddress
|
|
KeyMaxBlockLock = types.KeyMaxBlockLock
|
|
KeyMinBlockLock = types.KeyMinBlockLock
|
|
KeySupportedAssets = types.KeySupportedAssets
|
|
ModuleCdc = types.ModuleCdc
|
|
)
|
|
|
|
type (
|
|
Keeper = keeper.Keeper
|
|
AssetParam = types.AssetParam
|
|
AssetParams = types.AssetParams
|
|
AssetSupplies = types.AssetSupplies
|
|
AssetSupply = types.AssetSupply
|
|
AtomicSwap = types.AtomicSwap
|
|
AtomicSwaps = types.AtomicSwaps
|
|
GenesisState = types.GenesisState
|
|
MsgClaimAtomicSwap = types.MsgClaimAtomicSwap
|
|
MsgCreateAtomicSwap = types.MsgCreateAtomicSwap
|
|
MsgRefundAtomicSwap = types.MsgRefundAtomicSwap
|
|
Params = types.Params
|
|
QueryAssetSupply = types.QueryAssetSupply
|
|
QueryAtomicSwapByID = types.QueryAtomicSwapByID
|
|
QueryAtomicSwaps = types.QueryAtomicSwaps
|
|
SwapDirection = types.SwapDirection
|
|
SwapStatus = types.SwapStatus
|
|
)
|