Documentation ¶
Index ¶
- Constants
- type BindingArgs
- type BorrowArgs
- type CallOptions
- type CollateralItem
- type Contract
- func (c *Contract) BorrowLocal(ctx context.Context, signer sui_types.SuiAddress, typeArgs []string, ...) (*types.TransactionBytes, error)
- func (c *Contract) GetAllOraclePrice(ctx context.Context, signer sui_types.SuiAddress, callOptions CallOptions) (prices []DolaTokenPrice, err error)
- func (c *Contract) GetAllPoolLiquidity(ctx context.Context, signer sui_types.SuiAddress, dolaPoolId uint16, ...) (poolInfos []PoolInfo, err error)
- func (c *Contract) GetAllReserveInfo(ctx context.Context, signer sui_types.SuiAddress, callOptions CallOptions) (reserveInfos []ReserveInfo, err error)
- func (c *Contract) GetAppTokenLiquidity(ctx context.Context, signer sui_types.SuiAddress, appId uint16, ...) (liquidity *big.Int, err error)
- func (c *Contract) GetDolaTokenLiquidity(ctx context.Context, signer sui_types.SuiAddress, dolaPoolId uint16, ...) (liquidity *big.Int, err error)
- func (c *Contract) GetDolaUserAddresses(ctx context.Context, signer sui_types.SuiAddress, dolaUserId string, ...) (dolaUserAddresses []DolaUserAddress, err error)
- func (c *Contract) GetDolaUserId(ctx context.Context, signer sui_types.SuiAddress, dolaChainId uint16, ...) (userId string, err error)
- func (c *Contract) GetOraclePrice(ctx context.Context, signer sui_types.SuiAddress, dolaPoolId uint16, ...) (dolaTokenPrice DolaTokenPrice, err error)
- func (c *Contract) GetPoolLiquidity(ctx context.Context, signer sui_types.SuiAddress, dolaChainId uint16, ...) (liquidity *big.Int, err error)
- func (c *Contract) GetReserveInfo(ctx context.Context, signer sui_types.SuiAddress, dolaPoolId uint16, ...) (reserveInfo *ReserveInfo, err error)
- func (c *Contract) GetUserAllowedBorrow(ctx context.Context, signer sui_types.SuiAddress, dolaUserId string, ...) (amount *big.Int, err error)
- func (c *Contract) GetUserCollateral(ctx context.Context, signer sui_types.SuiAddress, dolaUserId string, ...) (collateral CollateralItem, err error)
- func (c *Contract) GetUserHealthFactor(ctx context.Context, signer sui_types.SuiAddress, dolaUserId string, ...) (healthFactor *big.Int, err error)
- func (c *Contract) GetUserLendingInfo(ctx context.Context, signer sui_types.SuiAddress, dolaUserId string, ...) (userLendingInfo *UserLendingInfo, err error)
- func (c *Contract) GetUserTokenDebt(ctx context.Context, signer sui_types.SuiAddress, dolaUserId string, ...) (debtAmount *big.Int, debtValue *big.Int, err error)
- func (c *Contract) Repay(ctx context.Context, signer sui_types.SuiAddress, typeArgs []string, ...) (*types.TransactionBytes, error)
- func (c *Contract) SendBinding(ctx context.Context, signer sui_types.SuiAddress, typeArgs []string, ...) (*types.TransactionBytes, error)
- func (c *Contract) SendingUnbinding(ctx context.Context, signer sui_types.SuiAddress, typeArgs []string, ...) (*types.TransactionBytes, error)
- func (c *Contract) Supply(ctx context.Context, signer sui_types.SuiAddress, typeArgs []string, ...) (*types.TransactionBytes, error)
- func (c *Contract) WithdrawLocal(ctx context.Context, signer sui_types.SuiAddress, typeArgs []string, ...) (*types.TransactionBytes, error)
- func (c *Contract) WithdrawRemote(ctx context.Context, signer sui_types.SuiAddress, typeArgs []string, ...) (*types.TransactionBytes, error)
- type ContractConfig
- type DebtItem
- type DolaTokenPrice
- type DolaUserAddress
- type EventHeader
- type Faucet
- type LendingCoreEvent
- type LendingCoreExecuteEvent
- type LendingPortalEvent
- type LocalLendingEvent
- type MoveEventHeader
- type PoolInfo
- type RepayArgs
- type ReserveInfo
- type SupplyArgs
- type UnbindingArgs
- type UserLendingInfo
- type WithdrawArgs
Constants ¶
View Source
const ( CallTypeSupply = 0 CallTypeWithdraw = 1 CallTypeBorrow = 2 CallTypeRepay = 3 CallTypeLiquidite = 4 CallTypeBinding = 5 CallTypeUnbinding = 6 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BindingArgs ¶
type BorrowArgs ¶
type CallOptions ¶
type CollateralItem ¶
type Contract ¶
type Contract struct {
// contains filtered or unexported fields
}
func NewContract ¶
func NewContract(client *client.Client, config ContractConfig) (*Contract, error)
func (*Contract) BorrowLocal ¶ added in v0.0.2
func (c *Contract) BorrowLocal(ctx context.Context, signer sui_types.SuiAddress, typeArgs []string, borrowArgs BorrowArgs, callOptions CallOptions) (*types.TransactionBytes, error)
func (*Contract) GetAllOraclePrice ¶
func (c *Contract) GetAllOraclePrice(ctx context.Context, signer sui_types.SuiAddress, callOptions CallOptions) (prices []DolaTokenPrice, err error)
func (*Contract) GetAllPoolLiquidity ¶
func (c *Contract) GetAllPoolLiquidity(ctx context.Context, signer sui_types.SuiAddress, dolaPoolId uint16, callOptions CallOptions) (poolInfos []PoolInfo, err error)
GetAllPoolLiquidity return all chain liquidity of a dola pool
func (*Contract) GetAllReserveInfo ¶
func (c *Contract) GetAllReserveInfo(ctx context.Context, signer sui_types.SuiAddress, callOptions CallOptions) (reserveInfos []ReserveInfo, err error)
func (*Contract) GetAppTokenLiquidity ¶
func (*Contract) GetDolaTokenLiquidity ¶
func (c *Contract) GetDolaTokenLiquidity(ctx context.Context, signer sui_types.SuiAddress, dolaPoolId uint16, callOptions CallOptions) (liquidity *big.Int, err error)
func (*Contract) GetDolaUserAddresses ¶
func (c *Contract) GetDolaUserAddresses(ctx context.Context, signer sui_types.SuiAddress, dolaUserId string, callOptions CallOptions) (dolaUserAddresses []DolaUserAddress, err error)
func (*Contract) GetDolaUserId ¶
func (c *Contract) GetDolaUserId(ctx context.Context, signer sui_types.SuiAddress, dolaChainId uint16, user string, callOptions CallOptions) (userId string, err error)
GetDolaUserId return dola_user_id for (dola_chain_id, address) pair if not exist, an error return
func (*Contract) GetOraclePrice ¶
func (c *Contract) GetOraclePrice(ctx context.Context, signer sui_types.SuiAddress, dolaPoolId uint16, callOptions CallOptions) (dolaTokenPrice DolaTokenPrice, err error)
func (*Contract) GetPoolLiquidity ¶
func (c *Contract) GetPoolLiquidity(ctx context.Context, signer sui_types.SuiAddress, dolaChainId uint16, poolAddress string, callOptions CallOptions) (liquidity *big.Int, err error)
GetPoolLiquidity return a pool liquidity on a chain
func (*Contract) GetReserveInfo ¶
func (c *Contract) GetReserveInfo(ctx context.Context, signer sui_types.SuiAddress, dolaPoolId uint16, callOptions CallOptions) (reserveInfo *ReserveInfo, err error)
func (*Contract) GetUserAllowedBorrow ¶
func (*Contract) GetUserCollateral ¶
func (c *Contract) GetUserCollateral(ctx context.Context, signer sui_types.SuiAddress, dolaUserId string, dolaPoolId uint16, callOptions CallOptions) (collateral CollateralItem, err error)
func (*Contract) GetUserHealthFactor ¶
func (c *Contract) GetUserHealthFactor(ctx context.Context, signer sui_types.SuiAddress, dolaUserId string, callOptions CallOptions) (healthFactor *big.Int, err error)
func (*Contract) GetUserLendingInfo ¶
func (c *Contract) GetUserLendingInfo(ctx context.Context, signer sui_types.SuiAddress, dolaUserId string, callOptions CallOptions) (userLendingInfo *UserLendingInfo, err error)
func (*Contract) GetUserTokenDebt ¶
func (*Contract) Repay ¶
func (c *Contract) Repay(ctx context.Context, signer sui_types.SuiAddress, typeArgs []string, repayArgs RepayArgs, callOptions CallOptions) (*types.TransactionBytes, error)
func (*Contract) SendBinding ¶
func (c *Contract) SendBinding(ctx context.Context, signer sui_types.SuiAddress, typeArgs []string, bindingArgs BindingArgs, callOptions CallOptions) (*types.TransactionBytes, error)
func (*Contract) SendingUnbinding ¶
func (c *Contract) SendingUnbinding(ctx context.Context, signer sui_types.SuiAddress, typeArgs []string, unbindingArgs UnbindingArgs, callOptions CallOptions) (*types.TransactionBytes, error)
func (*Contract) Supply ¶
func (c *Contract) Supply(ctx context.Context, signer sui_types.SuiAddress, typeArgs []string, supplyArgs SupplyArgs, callOptions CallOptions) (*types.TransactionBytes, error)
func (*Contract) WithdrawLocal ¶ added in v0.0.2
func (c *Contract) WithdrawLocal(ctx context.Context, signer sui_types.SuiAddress, typeArgs []string, withdrawArgs WithdrawArgs, callOptions CallOptions) (*types.TransactionBytes, error)
func (*Contract) WithdrawRemote ¶ added in v0.0.2
func (c *Contract) WithdrawRemote(ctx context.Context, signer sui_types.SuiAddress, typeArgs []string, withdrawArgs WithdrawArgs, callOptions CallOptions) (*types.TransactionBytes, error)
type ContractConfig ¶
type ContractConfig struct { LendingPortalPackageId string ExternalInterfacePackageId string BridgePoolPackageId string PoolManagerInfo string PoolState string PriceOracle string Storage string WormholeState string UserManagerInfo string CoreState string LendingPortal string LendingCore string Clock string PoolApproval string }
type DolaTokenPrice ¶
type DolaUserAddress ¶
type EventHeader ¶ added in v0.0.2
type Faucet ¶
type Faucet interface {
Claim(ctx context.Context, signer sui_types.SuiAddress, typeArgs []string, callOptions CallOptions) (*types.TransactionBytes, error)
}
type LendingCoreEvent ¶ added in v0.0.2
type LendingCoreEvent struct { MoveEventHeader MoveEventHeader Nonce uint64 SenderUserId uint64 SourceChainId uint16 DstChainId uint16 DolaPoolId uint16 Receiver []byte Amount uint64 LiquidateUserId uint64 CallType int }
bridge send event, from other chain transaction
func ParseLendingCoreEvent ¶ added in v0.0.2
func ParseLendingCoreEvent(event types.SuiEvent) (result *LendingCoreEvent, err error)
type LendingCoreExecuteEvent ¶ added in v0.0.3
type LendingCoreExecuteEvent struct { MoveEventHeader MoveEventHeader UserId uint64 Amount *big.Int PoolId uint16 ViolatorId uint64 CallType int }
core event
func ParseLendingCoreExecuteEvent ¶ added in v0.0.3
func ParseLendingCoreExecuteEvent(event types.SuiEvent) (result *LendingCoreExecuteEvent, err error)
type LendingPortalEvent ¶ added in v0.0.2
type LendingPortalEvent struct { MoveEventHeader MoveEventHeader Nonce uint64 Sender string DolaPoolAddress []byte SourceChainId uint16 DstChainId uint16 Receiver []byte Amount uint64 CallType int }
Sui chain call remote borrow/withdraw
func ParseLendingPortalEvent ¶ added in v0.0.2
func ParseLendingPortalEvent(event types.SuiEvent) (result *LendingPortalEvent, err error)
type LocalLendingEvent ¶ added in v0.0.2
type LocalLendingEvent struct { MoveEventHeader MoveEventHeader Nonce uint64 Sender string DolaPoolAddress []byte Amount uint64 CallType int }
Sui local chain lending event
func ParseLocalLendingEvent ¶ added in v0.0.2
func ParseLocalLendingEvent(event types.SuiEvent) (result *LocalLendingEvent, err error)
type MoveEventHeader ¶ added in v0.0.2
type ReserveInfo ¶
type ReserveInfo struct { BorrowApy int // 200 -> 200/10000=2.0% BorrowCoefficient *big.Int CollateralCoefficient *big.Int Debt *big.Int // 100000000 -> 100000000/1e8 = 1 Reserve *big.Int // 100000000 -> 100000000/1e8 = 1 SupplyApy int // 100 -> 100/10000=1.0% UtilizationRate int // 100 -> 100/10000=1.0% DolaPoolId uint16 Pools []PoolInfo }
type SupplyArgs ¶
type UnbindingArgs ¶
type UserLendingInfo ¶
Click to show internal directories.
Click to hide internal directories.