keeper

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 25, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxUint16            = 65535
	WithdrawalCounterKey = "withdrawal_counter"
	DepositCounterKey    = "deposit_counter"
)

Variables

This section is empty.

Functions

func CheckBtcTxAgainstSnapshot added in v0.0.2

func CheckBtcTxAgainstSnapshot(BtcTxHex string, snapshot map[string]int64) (bool, error)

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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 (Keeper) BtcWithdrawRequest added in v0.0.2

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

func (k Keeper) CheckBtcReserveExists(ctx sdk.Context, reserveId uint64) bool

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

func (k Keeper) CheckForNewSweepProposal(ctx sdk.Context) (bool, uint64, uint64)

CheckForNewSweepProposal checks if there is a new sweep proposal for a specific reserve and round

func (Keeper) CheckRefundTxSnapshot added in v0.0.2

func (k Keeper) CheckRefundTxSnapshot(ctx sdk.Context, btcTxHex string, reserveId uint64, roundId uint64) (bool, error)

func (Keeper) CheckReserveWithdrawSnapshot added in v0.0.2

func (k Keeper) CheckReserveWithdrawSnapshot(ctx sdk.Context, btcTxHex string, reserveId uint64, roundId uint64) (bool, error)

func (Keeper) ClearingAccount added in v0.0.2

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

func (k Keeper) GetAllClearingAccounts(ctx sdk.Context) ([]types.ClearingAccount, error)

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

func (k Keeper) GetBtcReserve(ctx sdk.Context, reserveId uint64) (*types.BtcReserve, error)

GetBtcReserve function that returns a reserve if passed a reserveId

func (Keeper) GetBtcReserveIdByAddress

func (k Keeper) GetBtcReserveIdByAddress(ctx sdk.Context, reserveAddress string) (uint64, error)

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 (k Keeper) GetCounter(ctx sdk.Context, counterKey string) uint32

func (Keeper) GetLastRegisteredBtcReserve

func (k Keeper) GetLastRegisteredBtcReserve(ctx sdk.Context) uint64

GetLastRegisteredBtcReserve returns the latest reserve id

func (Keeper) GetLastUnlockedReserve added in v0.0.2

func (k Keeper) GetLastUnlockedReserve(ctx sdk.Context) uint64

GetLastUnlockedReserve returns the latest unlocked reserve id

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) types.Params

GetParams get all parameters as types.Params

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) Hooks added in v0.0.2

func (k Keeper) Hooks() Hooks

Return the wrapper struct

func (Keeper) IncrementCounter added in v0.0.2

func (k Keeper) IncrementCounter(ctx sdk.Context, counterKey string) uint32

func (Keeper) InitCounter added in v0.0.2

func (k Keeper) InitCounter(ctx sdk.Context, counterKey string)

func (Keeper) InitCounters added in v0.0.2

func (k Keeper) InitCounters(ctx sdk.Context)

func (Keeper) IterateBtcReserves

func (k Keeper) IterateBtcReserves(ctx sdk.Context, cb func([]byte, types.BtcReserve) bool)

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) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

func (Keeper) Params

func (Keeper) PruneRefundTxSnapshot added in v0.0.2

func (k Keeper) PruneRefundTxSnapshot(ctx sdk.Context, reserveId uint64, roundId uint64)

PruneRefundTxSnapshot deletes the RefundTxSnapshot for a given reserveId and roundId

func (Keeper) PruneReserveWithdrawSnapshot added in v0.0.2

func (k Keeper) PruneReserveWithdrawSnapshot(ctx sdk.Context, reserveId uint64, roundId uint64)

PruneReserveWithdrawSnapshot deletes the ReserveWithdrawSnapshot for a given reserveId and roundId

func (Keeper) RefundTxSnapshot added in v0.0.2

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 (Keeper) ReserveWithdrawPool added in v0.0.2

func (Keeper) ReserveWithdrawSnapshot added in v0.0.2

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

func (k Keeper) SetBtcReserve(ctx sdk.Context, reserve *types.BtcReserve) error

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

func (k Keeper) SetNewSweepProposalReceived(ctx sdk.Context, reserveId uint64, roundId uint64)

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) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams set the params

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

func (k Keeper) Store(ctx sdk.Context) sdk.KVStore

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL