Documentation ¶
Index ¶
- Constants
- func CheckBtcTxAgainstSnapshot(BtcTxHex string, snapshot map[string]int64) (bool, error)
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- type Hooks
- type Keeper
- func (k Keeper) AddToReserveWithdrawPool(ctx sdk.Context, reserveId uint64, withdrawIdentifier uint32) error
- func (k Keeper) BtcReserve(goCtx context.Context, req *types.QueryBtcReserveRequest) (*types.QueryBtcReserveResponse, error)
- func (k Keeper) BtcWithdrawRequest(goCtx context.Context, req *types.QueryBtcWithdrawRequestRequest) (*types.QueryBtcWithdrawRequestResponse, error)
- func (k Keeper) CheckBtcAddress(ctx sdk.Context, twilightAddress sdk.Address, ...) bool
- func (k Keeper) CheckBtcReserveExists(ctx sdk.Context, reserveId uint64) bool
- func (k Keeper) CheckClearingAccountBalance(ctx sdk.Context, twilightAddress sdk.AccAddress, reserveId uint64, ...) error
- func (k Keeper) CheckForNewSweepProposal(ctx sdk.Context) (bool, uint64, uint64)
- func (k Keeper) CheckRefundTxSnapshot(ctx sdk.Context, btcTxHex string, reserveId uint64, roundId uint64) (bool, error)
- func (k Keeper) CheckReserveWithdrawSnapshot(ctx sdk.Context, btcTxHex string, reserveId uint64, roundId uint64) (bool, error)
- func (k Keeper) ClearingAccount(goCtx context.Context, req *types.QueryClearingAccountRequest) (*types.QueryClearingAccountResponse, error)
- func (k Keeper) Codec() codec.BinaryCodec
- func (k Keeper) ConfirmWithdrawRequestsAfterSweepConfirmation(ctx sdk.Context, reserveId uint64, roundId uint64) error
- func (k Keeper) DeductFromClearingAccount(ctx sdk.Context, twilightAddress sdk.AccAddress, reserveId uint64, ...) error
- func (k Keeper) GetAllBtcRegisteredDepositAddresses(ctx sdk.Context) (btcDepositAddresses []types.BtcDepositAddress)
- func (k Keeper) GetAllClearingAccounts(ctx sdk.Context) ([]types.ClearingAccount, error)
- func (k Keeper) GetAllClearingAccountsInaReserve(ctx sdk.Context, reserveId uint64) ([]types.ClearingAccount, bool)
- func (k Keeper) GetBtcClearingAddressByTwilightAddress(ctx sdk.Context, twilightAddress sdk.AccAddress) (btcAddress *bridgetypes.BtcAddress, found bool)
- func (k Keeper) GetBtcDepositAddressByTwilightAddress(ctx sdk.Context, twilightDepositAddress sdk.AccAddress) (btcDepositAddress *types.BtcDepositAddress, found bool)
- func (k Keeper) GetBtcReserve(ctx sdk.Context, reserveId uint64) (*types.BtcReserve, error)
- func (k Keeper) GetBtcReserveIdByAddress(ctx sdk.Context, reserveAddress string) (uint64, error)
- func (k Keeper) GetBtcWithdrawRequest(ctx sdk.Context, twilightAddress sdk.AccAddress, reserveId uint64, ...) (*types.BtcWithdrawRequestInternal, bool)
- func (k Keeper) GetBtcWithdrawRequestByIdentifier(ctx sdk.Context, withdrawIdentifier uint32) (*types.BtcWithdrawRequestInternal, bool)
- func (k Keeper) GetClearingAccount(ctx sdk.Context, twilightAddress sdk.AccAddress) (*types.ClearingAccount, bool)
- func (k Keeper) GetCounter(ctx sdk.Context, counterKey string) uint32
- func (k Keeper) GetLastRegisteredBtcReserve(ctx sdk.Context) uint64
- func (k Keeper) GetLastUnlockedReserve(ctx sdk.Context) uint64
- func (k Keeper) GetParams(ctx sdk.Context) types.Params
- func (k Keeper) GetRefundTxSnapshot(ctx sdk.Context, reserveId uint64, roundId uint64) (*types.RefundTxSnapshot, bool)
- func (k Keeper) GetReserveWithdrawPool(ctx sdk.Context, reserveId uint64) (*types.ReserveWithdrawPool, bool)
- func (k Keeper) GetReserveWithdrawSnapshot(ctx sdk.Context, reserveId uint64, roundId uint64) (*types.ReserveWithdrawSnapshot, bool)
- func (k Keeper) Hooks() Hooks
- func (k Keeper) IncrementCounter(ctx sdk.Context, counterKey string) uint32
- func (k Keeper) InitCounter(ctx sdk.Context, counterKey string)
- func (k Keeper) InitCounters(ctx sdk.Context)
- func (k Keeper) IterateBtcReserves(ctx sdk.Context, cb func([]byte, types.BtcReserve) bool)
- func (k Keeper) IterateBtcWithdrawRequests(ctx sdk.Context, cb func([]byte, *types.BtcWithdrawRequestInternal) bool)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) PruneRefundTxSnapshot(ctx sdk.Context, reserveId uint64, roundId uint64)
- func (k Keeper) PruneReserveWithdrawSnapshot(ctx sdk.Context, reserveId uint64, roundId uint64)
- func (k Keeper) RefundTxSnapshot(goCtx context.Context, req *types.QueryRefundTxSnapshotRequest) (*types.QueryRefundTxSnapshotResponse, error)
- func (k Keeper) RegisterNewBtcReserve(ctx sdk.Context, judgeAddress sdk.AccAddress, reserveAddress string) (uint64, error)
- func (k Keeper) ReserveClearingAccountsAll(goCtx context.Context, req *types.QueryReserveClearingAccountsAllRequest) (*types.QueryReserveClearingAccountsAllResponse, error)
- func (k Keeper) ReserveWithdrawPool(goCtx context.Context, req *types.QueryReserveWithdrawPoolRequest) (*types.QueryReserveWithdrawPoolResponse, error)
- func (k Keeper) ReserveWithdrawSnapshot(goCtx context.Context, req *types.QueryReserveWithdrawSnapshotRequest) (*types.QueryReserveWithdrawSnapshotResponse, error)
- func (k Keeper) SetBtcAddressForClearingAccount(ctx sdk.Context, twilightAddress sdk.AccAddress, btcAddr string, ...) (*types.ClearingAccount, error)
- func (k Keeper) SetBtcAddressForExistingClearingAccount(ctx sdk.Context, twilightAddress sdk.AccAddress, btcAddr string, ...) (*types.ClearingAccount, error)
- func (k Keeper) SetBtcDeposit(ctx sdk.Context, btcDepositAddress bridgetypes.BtcAddress, ...) error
- func (k Keeper) SetBtcDepositConfirmed(ctx sdk.Context, twilightDepositAddress sdk.AccAddress) error
- func (k Keeper) SetBtcReserve(ctx sdk.Context, reserve *types.BtcReserve) error
- func (k Keeper) SetBtcWithdrawRequest(ctx sdk.Context, twilightAddress sdk.AccAddress, reserveId uint64, ...) (*uint32, error)
- func (k Keeper) SetBtcWithdrawRequestAfterSweepConfirmation(ctx sdk.Context, withdrawRequest *types.BtcWithdrawRequestInternal) error
- func (k Keeper) SetClearingAccount(ctx sdk.Context, twilightAddress sdk.AccAddress, ...) error
- func (k Keeper) SetNewSweepProposalReceived(ctx sdk.Context, reserveId uint64, roundId uint64)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetReserveWithdrawPool(ctx sdk.Context, withdrawPool *types.ReserveWithdrawPool) error
- func (k Keeper) Store(ctx sdk.Context) sdk.KVStore
- func (k Keeper) TrackBeforeSend(ctx sdk.Context, from sdk.AccAddress, to sdk.AccAddress, amount sdk.Coins) error
- func (k Keeper) UpdateBtcReserveAfterMint(ctx sdk.Context, mintedValue uint64, twilightAddress sdk.AccAddress, ...) error
- func (k Keeper) UpdateBtcReserveAfterSweepProposal(ctx sdk.Context, reserveId uint64, reserveAddress string, judgeAddress string, ...) error
- func (k Keeper) UpdateTransfersInClearing(ctx sdk.Context, from, to sdk.AccAddress, amount sdk.Coins) error
Constants ¶
const ( MaxUint16 = 65535 WithdrawalCounterKey = "withdrawal_counter" DepositCounterKey = "deposit_counter" )
Variables ¶
This section is empty.
Functions ¶
func CheckBtcTxAgainstSnapshot ¶ added in v0.0.2
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.
Types ¶
type Hooks ¶ added in v0.0.2
type Hooks struct {
// contains filtered or unexported fields
}
Hooks wrapper struct for slashing keeper
func (Hooks) BlockBeforeSend ¶ added in v0.0.2
func (h Hooks) BlockBeforeSend(ctx sdk.Context, from sdk.AccAddress, to sdk.AccAddress, amount sdk.Coins) error
func (Hooks) TrackBeforeSend ¶ added in v0.0.2
func (h Hooks) TrackBeforeSend(ctx sdk.Context, from sdk.AccAddress, to sdk.AccAddress, amount sdk.Coins) error
type Keeper ¶
type Keeper struct { BankKeeper types.BankKeeper BridgeKeeper types.BridgeKeeper // contains filtered or unexported fields }
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeKey, memKey sdk.StoreKey, ps paramtypes.Subspace, accountKeeper types.AccountKeeper, BankKeeper types.BankKeeper, BridgeKeeper types.BridgeKeeper, ) *Keeper
func (Keeper) AddToReserveWithdrawPool ¶ added in v0.0.2
func (k Keeper) AddToReserveWithdrawPool(ctx sdk.Context, reserveId uint64, withdrawIdentifier uint32) error
AddToReserveWithdrawPool adds a new withdrawIdentifier to the queue of a specific reserve in the store
func (Keeper) BtcReserve ¶
func (k Keeper) BtcReserve(goCtx context.Context, req *types.QueryBtcReserveRequest) (*types.QueryBtcReserveResponse, error)
func (Keeper) BtcWithdrawRequest ¶ added in v0.0.2
func (k Keeper) BtcWithdrawRequest(goCtx context.Context, req *types.QueryBtcWithdrawRequestRequest) (*types.QueryBtcWithdrawRequestResponse, error)
func (Keeper) CheckBtcAddress ¶ added in v0.0.2
func (k Keeper) CheckBtcAddress(ctx sdk.Context, twilightAddress sdk.Address, btcAddress bridgetypes.BtcAddress, newSatoshiTestAmount uint64) bool
Check a btcAddress against all registered btcAddresses
func (Keeper) CheckBtcReserveExists ¶ added in v0.0.2
CheckBtcReserveExists checks if a Btc reserve exists for the given reserveId
func (Keeper) CheckClearingAccountBalance ¶ added in v0.0.2
func (k Keeper) CheckClearingAccountBalance(ctx sdk.Context, twilightAddress sdk.AccAddress, reserveId uint64, amount uint64) error
CheckClearingAccountBalance checks if the clearing account has enough balance in the reserve
func (Keeper) CheckForNewSweepProposal ¶ added in v0.0.2
CheckForNewSweepProposal checks if there is a new sweep proposal for a specific reserve and round
func (Keeper) CheckRefundTxSnapshot ¶ added in v0.0.2
func (Keeper) CheckReserveWithdrawSnapshot ¶ added in v0.0.2
func (Keeper) ClearingAccount ¶ added in v0.0.2
func (k Keeper) ClearingAccount(goCtx context.Context, req *types.QueryClearingAccountRequest) (*types.QueryClearingAccountResponse, error)
func (Keeper) Codec ¶ added in v0.0.2
func (k Keeper) Codec() codec.BinaryCodec
Codec returns the codec for the volt module
func (Keeper) ConfirmWithdrawRequestsAfterSweepConfirmation ¶ added in v0.0.2
func (k Keeper) ConfirmWithdrawRequestsAfterSweepConfirmation(ctx sdk.Context, reserveId uint64, roundId uint64) error
ConfirmWithdrawRequestsAfterSweepConfirmation confirms the withdraw requests after sweep confirmation
func (Keeper) DeductFromClearingAccount ¶ added in v0.0.2
func (k Keeper) DeductFromClearingAccount(ctx sdk.Context, twilightAddress sdk.AccAddress, reserveId uint64, amount uint64) error
DeductFromClearingAccount deducts the amount from the clearing account during processing of a withdrawal request
func (Keeper) GetAllBtcRegisteredDepositAddresses ¶ added in v0.0.2
func (k Keeper) GetAllBtcRegisteredDepositAddresses(ctx sdk.Context) (btcDepositAddresses []types.BtcDepositAddress)
GetAllBtcRegisteredDepositAddresses returns all the btc deposit addresses
func (Keeper) GetAllClearingAccounts ¶ added in v0.0.2
GetAllClearingAccounts returns the all clearing accounts
func (Keeper) GetAllClearingAccountsInaReserve ¶ added in v0.0.2
func (k Keeper) GetAllClearingAccountsInaReserve(ctx sdk.Context, reserveId uint64) ([]types.ClearingAccount, bool)
GetAllClearingAccountsInaReserve returns all clearing accounts for a given reserve
func (Keeper) GetBtcClearingAddressByTwilightAddress ¶ added in v0.0.2
func (k Keeper) GetBtcClearingAddressByTwilightAddress(ctx sdk.Context, twilightAddress sdk.AccAddress) (btcAddress *bridgetypes.BtcAddress, found bool)
GetBtcClearingAddressByTwilightAddress returns the btc address for a given twilight address
func (Keeper) GetBtcDepositAddressByTwilightAddress ¶ added in v0.0.2
func (k Keeper) GetBtcDepositAddressByTwilightAddress(ctx sdk.Context, twilightDepositAddress sdk.AccAddress) (btcDepositAddress *types.BtcDepositAddress, found bool)
GetBtcDepositAddressByTwilightAddress returns the btc address for a given twilight address
func (Keeper) GetBtcReserve ¶
GetBtcReserve function that returns a reserve if passed a reserveId
func (Keeper) GetBtcReserveIdByAddress ¶
GetBtcReserveIdByAddress returns a reserve id if passed an reserve address
func (Keeper) GetBtcWithdrawRequest ¶ added in v0.0.2
func (k Keeper) GetBtcWithdrawRequest(ctx sdk.Context, twilightAddress sdk.AccAddress, reserveId uint64, withdrawAddress string, withdrawAmount uint64) (*types.BtcWithdrawRequestInternal, bool)
GetBtcWithdrawRequest returns the btc withdraw request for a given twilight address, reserve address, withdraw address, and withdraw amount
func (Keeper) GetBtcWithdrawRequestByIdentifier ¶ added in v0.0.2
func (k Keeper) GetBtcWithdrawRequestByIdentifier(ctx sdk.Context, withdrawIdentifier uint32) (*types.BtcWithdrawRequestInternal, bool)
GetBtcWithdrawRequestByIdentifier returns the btc withdraw request for a given withdraw identifier
func (Keeper) GetClearingAccount ¶
func (k Keeper) GetClearingAccount(ctx sdk.Context, twilightAddress sdk.AccAddress) (*types.ClearingAccount, bool)
GetClearingAccount returns the clearing account for a given twilight address
func (Keeper) GetCounter ¶ added in v0.0.2
func (Keeper) GetLastRegisteredBtcReserve ¶
GetLastRegisteredBtcReserve returns the latest reserve id
func (Keeper) GetLastUnlockedReserve ¶ added in v0.0.2
GetLastUnlockedReserve returns the latest unlocked reserve id
func (Keeper) GetRefundTxSnapshot ¶ added in v0.0.2
func (k Keeper) GetRefundTxSnapshot(ctx sdk.Context, reserveId uint64, roundId uint64) (*types.RefundTxSnapshot, bool)
GetRefundTxSnapshot returns the refund tx snapshot for a given reserveId and roundId
func (Keeper) GetReserveWithdrawPool ¶ added in v0.0.2
func (k Keeper) GetReserveWithdrawPool(ctx sdk.Context, reserveId uint64) (*types.ReserveWithdrawPool, bool)
GetWithdrawPool returns the withdrawal pool for a specific reserve from the store
func (Keeper) GetReserveWithdrawSnapshot ¶ added in v0.0.2
func (k Keeper) GetReserveWithdrawSnapshot(ctx sdk.Context, reserveId uint64, roundId uint64) (*types.ReserveWithdrawSnapshot, bool)
GetReserveWithdrawSnapshot returns the last withdraw snapshot for a specific reserve
func (Keeper) IncrementCounter ¶ added in v0.0.2
func (Keeper) InitCounter ¶ added in v0.0.2
func (Keeper) InitCounters ¶ added in v0.0.2
func (Keeper) IterateBtcReserves ¶
IterateBtcReserves iterates through all of the reserves
func (Keeper) IterateBtcWithdrawRequests ¶ added in v0.0.2
func (k Keeper) IterateBtcWithdrawRequests(ctx sdk.Context, cb func([]byte, *types.BtcWithdrawRequestInternal) bool)
IterateBtcWithdrawRequests iterates through all the registered withdraw requests
func (Keeper) Params ¶
func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
func (Keeper) PruneRefundTxSnapshot ¶ added in v0.0.2
PruneRefundTxSnapshot deletes the RefundTxSnapshot for a given reserveId and roundId
func (Keeper) PruneReserveWithdrawSnapshot ¶ added in v0.0.2
PruneReserveWithdrawSnapshot deletes the ReserveWithdrawSnapshot for a given reserveId and roundId
func (Keeper) RefundTxSnapshot ¶ added in v0.0.2
func (k Keeper) RefundTxSnapshot(goCtx context.Context, req *types.QueryRefundTxSnapshotRequest) (*types.QueryRefundTxSnapshotResponse, error)
func (Keeper) RegisterNewBtcReserve ¶ added in v0.0.2
func (k Keeper) RegisterNewBtcReserve(ctx sdk.Context, judgeAddress sdk.AccAddress, reserveAddress string) (uint64, error)
RegisterNewBtcReserve sets a reserve in the store
func (Keeper) ReserveClearingAccountsAll ¶ added in v0.0.2
func (k Keeper) ReserveClearingAccountsAll(goCtx context.Context, req *types.QueryReserveClearingAccountsAllRequest) (*types.QueryReserveClearingAccountsAllResponse, error)
func (Keeper) ReserveWithdrawPool ¶ added in v0.0.2
func (k Keeper) ReserveWithdrawPool(goCtx context.Context, req *types.QueryReserveWithdrawPoolRequest) (*types.QueryReserveWithdrawPoolResponse, error)
func (Keeper) ReserveWithdrawSnapshot ¶ added in v0.0.2
func (k Keeper) ReserveWithdrawSnapshot(goCtx context.Context, req *types.QueryReserveWithdrawSnapshotRequest) (*types.QueryReserveWithdrawSnapshotResponse, error)
func (Keeper) SetBtcAddressForClearingAccount ¶
func (k Keeper) SetBtcAddressForClearingAccount(ctx sdk.Context, twilightAddress sdk.AccAddress, btcAddr string, depositIdentifer uint32) (*types.ClearingAccount, error)
SetBtcAddressForClearingAccount sets the btc address for a given twilight address
func (Keeper) SetBtcAddressForExistingClearingAccount ¶ added in v0.0.2
func (k Keeper) SetBtcAddressForExistingClearingAccount(ctx sdk.Context, twilightAddress sdk.AccAddress, btcAddr string, depositIdentifer uint32) (*types.ClearingAccount, error)
SetBtcAddressForExistingClearingAccount sets the btc address for a given twilight address
func (Keeper) SetBtcDeposit ¶ added in v0.0.2
func (k Keeper) SetBtcDeposit(ctx sdk.Context, btcDepositAddress bridgetypes.BtcAddress, twilightAddress sdk.AccAddress, twilightStakingAmount uint64, btcSatoshiTestAmount uint64) error
SetBtcDeposit sets a btc deposit address given the BtcDepositAddress type
func (Keeper) SetBtcDepositConfirmed ¶ added in v0.0.2
func (k Keeper) SetBtcDepositConfirmed(ctx sdk.Context, twilightDepositAddress sdk.AccAddress) error
SetBtcDepositConfirmed sets a btc deposit address as confirmed
func (Keeper) SetBtcReserve ¶
SetBtcReserve sets a reserve in the store
func (Keeper) SetBtcWithdrawRequest ¶ added in v0.0.2
func (k Keeper) SetBtcWithdrawRequest(ctx sdk.Context, twilightAddress sdk.AccAddress, reserveId uint64, withdrawAddress string, withdrawAmount uint64) (*uint32, error)
SetBtcWithdrawRequest sets the btc withdraw request for a given twilight address, reserve address, withdraw address, and withdraw amount This is to track the btc requests, once user sends a request, we add additional parameters in it such as withdrawIdentifier that is essentially a counter and a isConfirmed boolean along with the creation block height
func (Keeper) SetBtcWithdrawRequestAfterSweepConfirmation ¶ added in v0.0.2
func (k Keeper) SetBtcWithdrawRequestAfterSweepConfirmation(ctx sdk.Context, withdrawRequest *types.BtcWithdrawRequestInternal) error
SetBtcWithdrawRequestAfterSweepConfirmation sets the btc withdraw request after sweep confirmation
func (Keeper) SetClearingAccount ¶ added in v0.0.2
func (k Keeper) SetClearingAccount(ctx sdk.Context, twilightAddress sdk.AccAddress, account *types.ClearingAccount) error
SetClearingAccount sets a clearing account given the ClearingAccount type
func (Keeper) SetNewSweepProposalReceived ¶ added in v0.0.2
SetNewSweepProposalReceived indicates a new sweep proposal has been received for a specific reserve and round We store the block height to indicate when the proposal was made
func (Keeper) SetReserveWithdrawPool ¶ added in v0.0.2
func (k Keeper) SetReserveWithdrawPool(ctx sdk.Context, withdrawPool *types.ReserveWithdrawPool) error
SetReserveWithdrawPool sets a withdrawal pool for a specific reserve in the store
func (Keeper) Store ¶ added in v0.0.2
Store and Codec are used to access keeper in EndBlocker Store returns the KVStore for the volt module
func (Keeper) TrackBeforeSend ¶ added in v0.0.2
func (k Keeper) TrackBeforeSend(ctx sdk.Context, from sdk.AccAddress, to sdk.AccAddress, amount sdk.Coins) error
TrackBeforeSend tracks the transfers
func (Keeper) UpdateBtcReserveAfterMint ¶ added in v0.0.2
func (k Keeper) UpdateBtcReserveAfterMint(ctx sdk.Context, mintedValue uint64, twilightAddress sdk.AccAddress, reserveAddress string) error
UpdateBtcReserve updates a reserve in the store
func (Keeper) UpdateBtcReserveAfterSweepProposal ¶
func (k Keeper) UpdateBtcReserveAfterSweepProposal(ctx sdk.Context, reserveId uint64, reserveAddress string, judgeAddress string, btcBlockNumber uint64, btcRelayCapacityValue uint64, btcTxHash string, unlockHeight uint64, roundId uint64) error
UpdateBtcReserveAfterSweepProposal based on the passed reserveId, the operation happens after a successful attestation of MsgSweepProposal
func (Keeper) UpdateTransfersInClearing ¶
func (k Keeper) UpdateTransfersInClearing(ctx sdk.Context, from, to sdk.AccAddress, amount sdk.Coins) error
UpdateTransfersInClearing updates a clearing after a successful transfer of tokens from Send and Multisend in the bank module This function is called from the bank module through hooks.go This function blocks the transfers that are happening with mint as we are directly handling mint in UpdateBtcReserveAfterMint
Source Files ¶
- grpc_query.go
- grpc_query_btc_reserve.go
- grpc_query_params.go
- hooks.go
- keeper.go
- keeper_clearing.go
- keeper_deposit.go
- keeper_identifiers_key.go
- keeper_reserve.go
- keeper_withdrawal.go
- msg_server.go
- params.go
- query_btc_withdraw_request.go
- query_clearing_account.go
- query_refund_tx_snapshot.go
- query_reserve_clearing_accounts_all.go
- query_reserve_withdraw_pool.go
- query_reserve_withdraw_snapshot.go