interest_bearing_mint

package
v0.0.0-...-3968f94 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ProgramName = "interest_bearing_mint"

Variables

View Source
var (
	Instruction_Initialize uint8 = 0
	Instruction_UpdateRate uint8 = 1
)
View Source
var InstructionImplDef = binary.NewVariantDefinition(binary.Uint8TypeIDEncoding, []binary.VariantType{
	{
		"initialize", (*Initialize)(nil),
	},
	{
		"update_rate", (*UpdateRate)(nil),
	},
})
View Source
var ProgramID common.PublicKey = common.MustPublicKeyFromBase58("11111111111111111111111111111111")

Functions

func InstructionIDToName

func InstructionIDToName(id uint8) string

InstructionIDToName returns the name of the instruction given its ID.

func SetProgramID

func SetProgramID(pubkey common.PublicKey)

Types

type Initialize

type Initialize struct {
	// The public key for the account that can update the rate
	RateAuthority *common.PublicKey
	// The initial interest rate
	Rate *int16
	// [0] = [WRITE] mint `The mint to initialize`
	common.AccountMetaSlice `bin:"-"`
	// contains filtered or unexported fields
}

Initialize Instruction

func NewInitializeInstruction

func NewInitializeInstruction(
	rateAuthority common.PublicKey,
	rate int16,
	mint common.PublicKey,
) *Initialize

NewInitializeInstruction

Parameters:

rateAuthority: The public key for the account that can update the rate
rate: The initial interest rate
mint: The mint to initialize

func NewInitializeInstructionBuilder

func NewInitializeInstructionBuilder() *Initialize

NewInitializeInstructionBuilder creates a new `Initialize` instruction builder.

func (*Initialize) Build

func (obj *Initialize) Build() *Instruction

func (*Initialize) EncodeToTree

func (obj *Initialize) EncodeToTree(parent treeout.Branches)

func (*Initialize) GetMintAccount

func (obj *Initialize) GetMintAccount() *common.AccountMeta

GetMintAccount gets the "mint" parameter. The mint to initialize

func (*Initialize) MarshalWithEncoder

func (obj *Initialize) MarshalWithEncoder(encoder *binary.Encoder) (err error)

func (*Initialize) SetMintAccount

func (obj *Initialize) SetMintAccount(mint common.PublicKey, multiSigners ...common.PublicKey) *Initialize

SetMintAccount sets the "mint" parameter. The mint to initialize

func (*Initialize) SetProgramId

func (obj *Initialize) SetProgramId(programId *common.PublicKey) *Initialize

func (*Initialize) SetRate

func (obj *Initialize) SetRate(rate int16) *Initialize

SetRate sets the "rate" parameter.

func (*Initialize) SetRateAuthority

func (obj *Initialize) SetRateAuthority(rateAuthority common.PublicKey) *Initialize

SetRateAuthority sets the "rateAuthority" parameter.

func (*Initialize) UnmarshalWithDecoder

func (obj *Initialize) UnmarshalWithDecoder(decoder *binary.Decoder) (err error)

func (*Initialize) Validate

func (obj *Initialize) Validate() error

func (*Initialize) ValidateAndBuild

func (obj *Initialize) ValidateAndBuild() (*Instruction, error)

ValidateAndBuild validates the instruction parameters and accounts; if there is a validation error, it returns the error. Otherwise, it builds and returns the instruction.

type Instruction

type Instruction struct {
	binary.BaseVariant
	// contains filtered or unexported fields
}

func DecodeInstruction

func DecodeInstruction(accounts []*common.AccountMeta, data []byte) (*Instruction, error)

func (*Instruction) Accounts

func (obj *Instruction) Accounts() (out []*common.AccountMeta)

func (*Instruction) Data

func (obj *Instruction) Data() ([]byte, error)

func (*Instruction) EncodeToTree

func (obj *Instruction) EncodeToTree(parent treeout.Branches)

func (*Instruction) MarshalWithEncoder

func (obj *Instruction) MarshalWithEncoder(encoder *binary.Encoder) error

func (*Instruction) ProgramID

func (obj *Instruction) ProgramID() common.PublicKey

func (*Instruction) TextEncode

func (obj *Instruction) TextEncode(encoder *text.Encoder, option *text.Option) error

func (*Instruction) UnmarshalWithDecoder

func (obj *Instruction) UnmarshalWithDecoder(decoder *binary.Decoder) error

type InterestBearingConfig

type InterestBearingConfig struct {
	// Authority that can set the interest rate and authority
	RateAuthority common.PublicKey
	// Timestamp of initialization, from which to base interest calculations
	InitializationTimestamp solanago.UnixTimeSeconds
	// Average rate from initialization until the last time it was updated
	PreUpdateAverageRate int16
	// Timestamp of the last update, used to calculate the total amount accrued
	LastUpdateTimestamp solanago.UnixTimeSeconds
	// Current rate, since the last update
	CurrentRate int16
}

InterestBearingConfig Struct

func (*InterestBearingConfig) MarshalWithEncoder

func (obj *InterestBearingConfig) MarshalWithEncoder(encoder *binary.Encoder) (err error)

func (*InterestBearingConfig) UnmarshalWithDecoder

func (obj *InterestBearingConfig) UnmarshalWithDecoder(decoder *binary.Decoder) (err error)

type UpdateRate

type UpdateRate struct {
	Rate *int16
	// [0] = [WRITE] mint `The mint`
	// [1] = [SIGNER] authority `The mint rate authority.`
	common.AccountMetaSlice `bin:"-"`
	// contains filtered or unexported fields
}

UpdateRate Instruction

func NewUpdateRateInstruction

func NewUpdateRateInstruction(
	rate int16,
	mint common.PublicKey,
	authority common.PublicKey,
) *UpdateRate

NewUpdateRateInstruction

Parameters:

rate:
mint: The mint
authority: The mint rate authority.

func NewUpdateRateInstructionBuilder

func NewUpdateRateInstructionBuilder() *UpdateRate

NewUpdateRateInstructionBuilder creates a new `UpdateRate` instruction builder.

func (*UpdateRate) Build

func (obj *UpdateRate) Build() *Instruction

func (*UpdateRate) EncodeToTree

func (obj *UpdateRate) EncodeToTree(parent treeout.Branches)

func (*UpdateRate) GetAuthorityAccount

func (obj *UpdateRate) GetAuthorityAccount() *common.AccountMeta

GetAuthorityAccount gets the "authority" parameter. The mint rate authority.

func (*UpdateRate) GetMintAccount

func (obj *UpdateRate) GetMintAccount() *common.AccountMeta

GetMintAccount gets the "mint" parameter. The mint

func (*UpdateRate) MarshalWithEncoder

func (obj *UpdateRate) MarshalWithEncoder(encoder *binary.Encoder) (err error)

func (*UpdateRate) SetAuthorityAccount

func (obj *UpdateRate) SetAuthorityAccount(authority common.PublicKey, multiSigners ...common.PublicKey) *UpdateRate

SetAuthorityAccount sets the "authority" parameter. The mint rate authority.

func (*UpdateRate) SetMintAccount

func (obj *UpdateRate) SetMintAccount(mint common.PublicKey) *UpdateRate

SetMintAccount sets the "mint" parameter. The mint

func (*UpdateRate) SetProgramId

func (obj *UpdateRate) SetProgramId(programId *common.PublicKey) *UpdateRate

func (*UpdateRate) SetRate

func (obj *UpdateRate) SetRate(rate int16) *UpdateRate

SetRate sets the "rate" parameter.

func (*UpdateRate) UnmarshalWithDecoder

func (obj *UpdateRate) UnmarshalWithDecoder(decoder *binary.Decoder) (err error)

func (*UpdateRate) Validate

func (obj *UpdateRate) Validate() error

func (*UpdateRate) ValidateAndBuild

func (obj *UpdateRate) ValidateAndBuild() (*Instruction, error)

ValidateAndBuild validates the instruction parameters and accounts; if there is a validation error, it returns the error. Otherwise, it builds and returns the instruction.

Jump to

Keyboard shortcuts

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