Documentation
¶
Index ¶
- Constants
- type Deposit
- func (deposit *Deposit) ClaimableReward(offer *Offer, claimTime uint64) uint64
- func (deposit *Deposit) EndTime() time.Time
- func (deposit *Deposit) IsExpired(timestamp uint64) bool
- func (deposit *Deposit) StartTime() time.Time
- func (deposit *Deposit) TotalReward(offer *Offer) uint64
- func (deposit *Deposit) UnlockableAmount(offer *Offer, unlockTime uint64) uint64
- type Offer
- func (o *Offer) EndTime() time.Time
- func (o *Offer) InterestRateFloat64() float64
- func (o *Offer) IsActiveAt(timestamp uint64) bool
- func (o *Offer) MaxRemainingAmountByReward() uint64
- func (o *Offer) MaxRemainingRewardByTotalMaxAmount() uint64
- func (o *Offer) PermissionMsg(depositCreatorAddres ids.ShortID) []byte
- func (o *Offer) RemainingAmount() uint64
- func (o *Offer) RemainingReward() uint64
- func (o *Offer) StartTime() time.Time
- func (o *Offer) Verify() error
- type OfferFlag
Constants ¶
View Source
const ( InterestRateDenominator uint64 = 1_000_000 * interestRateBase OfferMinDepositAmount uint64 = 1 * units.MilliAvax )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deposit ¶
type Deposit struct { DepositOfferID ids.ID `serialize:"true"` // ID of deposit offer that was used to create this deposit UnlockedAmount uint64 `serialize:"true"` // How many tokens have already been unlocked from this deposit ClaimedRewardAmount uint64 `serialize:"true"` // How many reward tokens have already been claimed for this deposit Start uint64 `serialize:"true"` // Timestamp of time, when this deposit was created Duration uint32 `serialize:"true"` // Duration of this deposit in seconds Amount uint64 `serialize:"true"` // How many tokens were locked with this deposit RewardOwner fx.Owner `serialize:"true"` // The owner who has right to claim rewards for this deposit }
func (*Deposit) ClaimableReward ¶
Returns amount of tokens that can be claimed as reward for deposit at [claimetime] (seconds).
Precondition: all args are valid in conjunction.
func (*Deposit) TotalReward ¶
Returns amount of tokens that can be claimed as reward for [depositAmount].
Precondition: all args are valid in conjunction.
type Offer ¶
type Offer struct { UpgradeVersionID codec.UpgradeVersionID ID ids.ID InterestRateNominator uint64 `serialize:"true" json:"interestRateNominator"` // deposit.Amount * (interestRateNominator / interestRateDenominator) == reward for deposit with 1 year duration Start uint64 `serialize:"true" json:"start"` // Unix time in seconds, when this offer becomes active (can be used to create new deposits) End uint64 `serialize:"true" json:"end"` // Unix time in seconds, when this offer becomes inactive (can't be used to create new deposits) MinAmount uint64 `serialize:"true" json:"minAmount"` // Minimum amount that can be deposited with this offer TotalMaxAmount uint64 `serialize:"true" json:"totalMaxAmount"` // Maximum amount that can be deposited with this offer in total (across all deposits) DepositedAmount uint64 `serialize:"true" json:"depositedAmount"` // Amount that was already deposited with this offer MinDuration uint32 `serialize:"true" json:"minDuration"` // Minimum duration of deposit created with this offer MaxDuration uint32 `serialize:"true" json:"maxDuration"` // Maximum duration of deposit created with this offer UnlockPeriodDuration uint32 `serialize:"true" json:"unlockPeriodDuration"` // Duration of period during which tokens deposited with this offer will be unlocked. The unlock period starts at the end of deposit minus unlockPeriodDuration NoRewardsPeriodDuration uint32 `serialize:"true" json:"noRewardsPeriodDuration"` // Duration of period during which rewards won't be accumulated. No rewards period starts at the end of deposit minus unlockPeriodDuration Memo types.JSONByteSlice `serialize:"true" json:"memo"` // Arbitrary offer memo Flags OfferFlag `serialize:"true" json:"flags"` // Bitfield with flags TotalMaxRewardAmount uint64 `serialize:"true" json:"totalMaxRewardAmount" upgradeVersion:"1"` // Maximum amount that can be rewarded for all deposits created with this offer in total RewardedAmount uint64 `serialize:"true" json:"rewardedAmount" upgradeVersion:"1"` // Amount that was already rewarded (including potential rewards) for deposits created with this offer OwnerAddress ids.ShortID `serialize:"true" json:"ownerAddress" upgradeVersion:"1"` // Address that can sign deposit-creator permission }
func (*Offer) InterestRateFloat64 ¶
func (*Offer) IsActiveAt ¶
func (*Offer) MaxRemainingAmountByReward ¶
Returns maximum possible amount that could be deposited with this offer. Return 0 if o.TotalMaxRewardAmount is 0.
func (*Offer) MaxRemainingRewardByTotalMaxAmount ¶
Calculates max remaining reward amount by using offer max duration. Return 0 if o.TotalMaxAmount is 0.
func (*Offer) PermissionMsg ¶
func (*Offer) RemainingAmount ¶
Return 0 if o.TotalMaxAmount is 0.
func (*Offer) RemainingReward ¶
Return 0 if o.TotalMaxRewardAmount is 0.
Click to show internal directories.
Click to hide internal directories.