vclient

package
v0.0.0-...-127b1e4 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2020 License: OSL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package vclient provides client access to a Velo smart contract. For more information and further examples, see https://docs.velo.org/.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func MintFromCollateralAmountReplaceError

func MintFromCollateralAmountReplaceError(prefix string, abiInput *MintFromCollateralAmountAbiInput, err error) error

func MintFromStableCreditAmountReplaceError

func MintFromStableCreditAmountReplaceError(prefix string, abiInput *MintFromStableCreditAmountAbiInput, err error) error

func NewTxHelper

func NewTxHelper(conn Connection) *txHelper

func RedeemStableCreditReplaceError

func RedeemStableCreditReplaceError(prefix string, abiInput *RedeemStableCreditInput, err error) error

func SetupCreditReplaceError

func SetupCreditReplaceError(prefix string, abiInput *SetupCreditAbiInput, err error) error

func WhitelistGovernorReplaceError

func WhitelistGovernorReplaceError(prefix string, err error) error

func WhitelistTrustedPartnerReplaceError

func WhitelistTrustedPartnerReplaceError(prefix string, err error) error

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client struct contains data for connecting to the Velo Smart Contract

func NewClient

func NewClient(rpcUrl string, privateKey string, contractAddress ContractAddress) (*Client, error)

NewClient creates a default client instance.

func NewClientWithOptions

func NewClientWithOptions(options *ClientOptions) *Client

NewClientWithOptions creates a client with config option instance.

func (*Client) CollateralHealthCheck

func (c *Client) CollateralHealthCheck(input *CollateralHealthCheckInput) ([]CollateralHealthCheckOutput, error)

CollateralHealthCheck calls CollateralHealthCheck on Velo smart contract.

Example
client, err := NewClient("<SMART_CONTRACT_NODE_URL>", "<PRIVATE_KEY>", ContractAddress{
	DrsAddress:   "<DRS_CONTRACT_ADDRESS>",   // 0x4Db9c67836A3735f63c0eCe4cFBc486bB80732b0
	HeartAddress: "<HEART_CONTRACT_ADDRESS>", // 0x1F1247eDEa84dC392C857A7887203a5640f3f2Fd
})
if err != nil {
	panic(err)
}

output, err := client.CollateralHealthCheck(nil)
if err != nil {
	panic(err)
}

fmt.Println("CollateralAssetCode:", output[0].CollateralAssetCode)
fmt.Println("CollateralAssetAddress:", output[0].CollateralAssetAddress)
fmt.Println("RequiredAmount:", output[0].RequiredAmount)
fmt.Println("PresentAmount:", output[0].PresentAmount)
Output:

CollateralAssetCode: VELO
CollateralAssetAddress: 0xbBa7C1C0222Eb4e323382FA3914fBC9E2dD58A9F
RequiredAmount: 0.0000000
PresentAmount: 0.0000000

func (*Client) Conn

func (c *Client) Conn() Connection

Conn return connection of client

func (*Client) Contract

func (c *Client) Contract() *Contract

Contract return contracts of client

func (*Client) GetExchangeRate

func (c *Client) GetExchangeRate(input *GetExchangeRateInput) (*GetExchangeRateOutput, error)

GetExchangeRate calls GetExchange on Velo smart contract.

Example
client, err := NewClient("http://127.0.0.1:7545", privateKey, ContractAddress{
	DrsAddress:   "<DRS_CONTRACT_ADDRESS>",   // 0xBdA518a6245480652d1A217192EBB299C94F623f
	HeartAddress: "<HEART_CONTRACT_ADDRESS>", // 0x1623C9c8600319E7CfAff0Ca1c4a05e1a61D954D
})

if err != nil {
	panic(err)
}

result, err := client.GetExchangeRate(&GetExchangeRateInput{AssetCode: "vUSD"})
if err != nil {
	panic(err)
}

log.Println("AssetCode: ", result.AssetCode)
log.Println("CollateralAssetCode: ", result.CollateralAssetCode)
log.Println("priceInCollateralPerAssetUnit: ", result.PriceInCollateralPerAssetUnit)
Output:

AssetCode: vUSD
CollateralAssetCode: VELO
priceInCollateralPerAssetUnit: 1

func (*Client) MintFromCollateralAmount

MintFromCollateralAmount calls MintFromCollateralAmount on Velo smart contract.

Example
client, err := NewClient(smartContractUrl, "<PRIVATE_KEY>", ContractAddress{
	DrsAddress:   "<DRS_CONTRACT_ADDRESS>",   // 0xBdA518a6245480652d1A217192EBB299C94F623f
	HeartAddress: "<HEART_CONTRACT_ADDRESS>", // 0x1623C9c8600319E7CfAff0Ca1c4a05e1a61D954D
})

if err != nil {
	panic(err)
}

result, err := client.MintFromCollateralAmount(context.Background(), &MintFromCollateralAmountInput{
	AssetCode:        "vUSD",
	CollateralAmount: "2",
})
if err != nil {
	panic(err)
}

log.Println("Mint From Collateral Amount Transaction Hash: ", result.Tx.Hash().String())
log.Println("Asset Address: ", result.Event.AssetAddress)
log.Println("Asset Code: ", result.Event.AssetCode)
log.Println("Collateral Amount: ", result.Event.CollateralAmount)
log.Println("Collateral Asset Code: ", result.Event.CollateralAssetCode)
log.Println("Stable Credit Amount: ", result.Event.StableCreditAmount)
Output:

Mint From Collateral Amount Transaction Hash: 0x0d6658bf79d9e4541de0617a14c17e7d642169d3f00d7a035595136b59f6f8ac
Asset Address: 0x23Cf6f4656218Bd25733f27aadBEe009A0f6C3Fd
Asset Code: vUSD
Collateral Amount:  2.0000000
Collateral Asset Code: VELO
Stable Credit Amount: 4.0000000

func (*Client) MintFromStableCreditAmount

MintFromStableCreditAmount calls MintFromStableCreditAmount on Velo smart contract.

Example
client, err := NewClient(smartContractUrl, "<PRIVATE_KEY>", ContractAddress{
	DrsAddress:   "<DRS_CONTRACT_ADDRESS>",   // 0xBdA518a6245480652d1A217192EBB299C94F623f
	HeartAddress: "<HEART_CONTRACT_ADDRESS>", // 0x1623C9c8600319E7CfAff0Ca1c4a05e1a61D954D
})

if err != nil {
	panic(err)
}

result, err := client.MintFromStableCreditAmount(context.Background(), &MintFromStableCreditAmountInput{
	AssetCode:          "vUSD",
	StableCreditAmount: "2",
})
if err != nil {
	panic(err)
}

log.Println("Mint From Stable Credit Amount Transaction Hash: ", result.Tx.Hash().String())
log.Println("Asset Address: ", result.Event.AssetAddress)
log.Println("Asset Code: ", result.Event.AssetCode)
log.Println("Collateral Amount: ", result.Event.CollateralAmount)
log.Println("Collateral Asset Code: ", result.Event.CollateralAssetCode)
log.Println("Stable Credit Amount: ", result.Event.StableCreditAmount)
Output:

Mint From Stable Credit Amount Transaction Hash: 0x1afaa6fc22b88f875bb16235128e245589fa460f8325f84ace2d89bb4204204b
Asset Address: 0x23Cf6f4656218Bd25733f27aadBEe009A0f6C3Fd
Asset Code: vUSD
Collateral Amount: 0.2736842
Collateral Asset Code: VELO
Stable Credit Amount: 2.0000000

func (*Client) Rebalance

func (c *Client) Rebalance(ctx context.Context, input *RebalanceInput) (*RebalanceOutput, error)

Rebalance calls Rebalance on Velo smart contract.

Example
client, err := NewClient("http://127.0.0.1:7545", "<PRIVATE_KEY>", ContractAddress{
	DrsAddress:   "<DRS_CONTRACT_ADDRESS>",   // 0x4Db9c67836A3735f63c0eCe4cFBc486bB80732b0
	HeartAddress: "<HEART_CONTRACT_ADDRESS>", // 0x1F1247eDEa84dC392C857A7887203a5640f3f2Fd
})
if err != nil {
	panic(err)
}

output, err := client.Rebalance(context.Background(), &RebalanceInput{})
if err != nil {
	panic(err)
}

for index, rebalanceTransaction := range output.RebalanceTransactions {
	fmt.Printf("Event %d Transaction Hashes: %s", index, rebalanceTransaction.Tx.Hash().String())
	fmt.Printf("Event %d Transaction Receipt: %d", index, rebalanceTransaction.Receipt.Status)
	fmt.Printf("Events %d AssetCode: %s", index, rebalanceTransaction.AssetCode)
	fmt.Printf("Events %d CollateralAssetCode: %s", index, rebalanceTransaction.CollateralAssetCode)
	fmt.Printf("Events %d PresentAmount: %s", index, rebalanceTransaction.PresentAmount)
	fmt.Printf("Events %d RequiredAmount: %s", index, rebalanceTransaction.RequiredAmount)
}
Output:

Event 0 Transaction Hashes: 0xf9647f3e917d75f124876928fe60d015763fa807c621bf956167a37653197d4a
Event 0 Transaction Receipt: 1
Events 0 AssetCode: vUSD
Events 0 CollateralAssetCode: VELO
Events 0 PresentAmount: 1.1253847
Events 0 RequiredAmount: 1.6076923

func (*Client) RedeemStableCredit

func (c *Client) RedeemStableCredit(ctx context.Context, input *RedeemStableCreditInput) (*RedeemStableCreditOutput, error)

RedeemStableCredit calls Redeem on Velo smart contract.

Example
client, err := NewClient(smartContractUrl, "<PRIVATE_KEY>", ContractAddress{
	DrsAddress:   "<DRS_CONTRACT_ADDRESS>",   // 0xBdA518a6245480652d1A217192EBB299C94F623f
	HeartAddress: "<HEART_CONTRACT_ADDRESS>", // 0x1623C9c8600319E7CfAff0Ca1c4a05e1a61D954D
})

if err != nil {
	panic(err)
}

result, err := client.RedeemStableCredit(context.Background(), &RedeemStableCreditInput{
	RedeemAmount: "104",
	AssetCode:    "vUSD",
})
if err != nil {
	panic(err)
}

log.Println("Redeem Stable Credit Transaction Hash: ", result.Tx.Hash().String())
log.Println("Asset Code: ", result.Event.AssetCode)
log.Println("Stable Credit Amount: ", result.Event.StableCreditAmount)
log.Println("Collateral Asset Address: ", result.Event.CollateralAssetAddress)
log.Println("Collateral Asset Code: ", result.Event.CollateralAssetCode)
log.Println("Collateral Amount: ", result.Event.CollateralAmount)
Output:

Redeem Stable Credit Transaction Hash:  0xf9647f3e917d75f124876928fe60d015763fa807c621bf956167a37653197d4a
Asset Code:  vUSD
Stable Credit Amount:  104.0000000
Collateral Asset Address:  0x11590aB398DD2fedC2C40b6E9F02fa13cC4d2dEe
Collateral Asset Code:  VELO
Collateral Amount:  0.0000000

func (*Client) SetupCredit

func (c *Client) SetupCredit(ctx context.Context, input *SetupCreditInput) (*SetupCreditOutput, error)

SetupCredit calls Setup on Velo smart contract.

Example
client, err := NewClient("http://127.0.0.1:7545", "<PRIVATE_KEY>", ContractAddress{
	DrsAddress:   "<DRS_CONTRACT_ADDRESS>",   // 0x4Db9c67836A3735f63c0eCe4cFBc486bB80732b0
	HeartAddress: "<HEART_CONTRACT_ADDRESS>", // 0x1F1247eDEa84dC392C857A7887203a5640f3f2Fd
})
if err != nil {
	panic(err)
}

output, err := client.SetupCredit(context.Background(), &SetupCreditInput{
	CollateralAssetCode: "VELO",
	PeggedCurrency:      "USD",
	AssetCode:           "vUSD",
	PeggedValue:         "1.0",
})
if err != nil {
	panic(err)
}

log.Println("Transaction Hash: ", output.Tx.Hash().String())
log.Println("Block Number: ", output.Receipt.BlockNumber.String())
log.Println("Event.PeggedCurrency: ", output.Event.PeggedCurrency)
log.Println("Event.PeggedValue: ", output.Event.PeggedValue)
log.Println("Event.AssetCode: ", output.Event.AssetCode)
log.Println("Event.CollateralAssetCode: ", output.Event.CollateralAssetCode)
log.Println("Event.AssetAddress: ", output.Event.AssetAddress)
Output:

Transaction Hash: 0x0d6658bf79d9e4541de0617a14c17e7d642169d3f00d7a035595136b59f6f8ac
Block Number: 10
Event.PeggedCurrency: USD
Event.PeggedValue: 1
Event.AssetCode: vUSD
Event.CollateralAssetCode: VELO
Event.AssetAddress: 0x50637DeE3598e080B7B605B00f4FfC721046E4E0

func (*Client) WhitelistGovernor

func (c *Client) WhitelistGovernor(ctx context.Context, input *WhitelistGovernorInput) (*WhitelistGovernorOutput, error)

WhitelistGovernor calls SetGovernor on Velo smart contract.

Example
//go:build !unit
// +build !unit

package main

import (
	"context"
	"log"
)

const (
	privateKey = "<PRIVATE_KEY>" // b673aace6739646820330920307288260703487da63525f944c96039931d8ed2
)

func main() {
	client, err := NewClient(smartContractUrl, privateKey, ContractAddress{
		DrsAddress:   "<DRS_CONTRACT_ADDRESS>",   // 0xBdA518a6245480652d1A217192EBB299C94F623f
		HeartAddress: "<HEART_CONTRACT_ADDRESS>", // 0x1623C9c8600319E7CfAff0Ca1c4a05e1a61D954D
	})

	if err != nil {
		panic(err)
	}

	result, err := client.WhitelistGovernor(context.Background(), &WhitelistGovernorInput{Address: "0xcB74De0a5c8E24E81bEd76D57C4D89fcAfa7B6f"})
	if err != nil {
		panic(err)
	}

	log.Println("Whitelist Governor Transaction Hash: ", result.Tx.Hash().String())
}
Output:

Whitelist Governor Transaction Hash: 0x0d6658bf79d9e4541de0617a14c17e7d642169d3f00d7a035595136b59f6f8ac

func (*Client) WhitelistTrustedPartner

func (c *Client) WhitelistTrustedPartner(ctx context.Context, input *WhitelistTrustedPartnerInput) (*WhitelistTrustedPartnerOutput, error)
Example
client, err := NewClient("http://127.0.0.1:7545", "da17d295e2fd005747cca4de855bbb0493f2e0669753bba1e752700dbad4c78c", ContractAddress{
	DrsAddress:   "<DRS_CONTRACT_ADDRESS>",   // Ex: 0x604Ee3d8d9A734d4607E8aF2E4eb44D8e6c2Bf46
	HeartAddress: "<HEART_CONTRACT_ADDRESS>", // Ex: 0x1fCc1CEf04A0B0121faD5AF38C06F10c44240787
})
if err != nil {
	panic(err)
	return
}

result, err := client.WhitelistTrustedPartner(context.Background(), &WhitelistTrustedPartnerInput{
	Address: "<TRUSTED_PARTNER_ADDRESS>", // Ex: 0xf9955C6A38f74f0bfFD63141E840BB77FF3F3d38
})
if err != nil {
	panic(err)
	return
}

log.Println("Transaction Hash:", result.Tx.Hash().String())
Output:

Transaction Hash: 0xc49e5ce3e74e03c5d6ed0ba1e4993b03d8ef6f3b7f9690c523e62e22b0a547ed

type ClientOptions

type ClientOptions struct {
	// A private key that will be used to sign every transaction when submitting to smart contract
	PrivateKey ecdsa.PrivateKey
	// A connection that is used by Velo.
	Conn Connection
	// The DRS contract interface
	DRSContract DRSContract
	// The heart contract interface
	HeartContract HeartContract
	// The transaction helper that are used by Velo
	TxHelper TxHelper
}

ClientOptions struct contains data for connecting to the Velo Smart Contract

type CollateralHealthCheckAbiInput

type CollateralHealthCheckAbiInput struct {
	AssetCode string
}

type CollateralHealthCheckAbiOutput

type CollateralHealthCheckAbiOutput struct {
	CollateralAssetAddress common.Address
	CollateralAssetCode    [32]byte
	RequiredAmount         *big.Int
	PresentAmount          *big.Int
	IndexKey               int
}

type CollateralHealthCheckInput

type CollateralHealthCheckInput struct {
}

CollateralHealthCheckInput required input fields of collateral health check

type CollateralHealthCheckOutput

type CollateralHealthCheckOutput struct {
	CollateralAssetAddress string
	CollateralAssetCode    string
	RequiredAmount         string
	PresentAmount          string
}

CollateralHealthCheckOutput output fields of collateral health check

type Connection

type Connection interface {
	bind.ContractBackend
	TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
}

type Contract

type Contract struct {
	// contains filtered or unexported fields
}

func NewContract

func NewContract(drs DRSContract, heart HeartContract) *Contract

func (*Contract) DRS

func (c *Contract) DRS() DRSContract

func (*Contract) Heart

func (c *Contract) Heart() HeartContract

type ContractAddress

type ContractAddress struct {
	DrsAddress   string
	HeartAddress string
}

type DRSContract

type DRSContract interface {
	Setup(opts *bind.TransactOpts, collateralAssetCode [32]byte, peggedCurrency [32]byte, assetCode string, peggedValue *big.Int) (*types.Transaction, error)
	MintFromCollateralAmount(opts *bind.TransactOpts, netCollateralAmount *big.Int, assetCode string) (*types.Transaction, error)
	MintFromStableCreditAmount(opts *bind.TransactOpts, mintAmount *big.Int, assetCode string) (*types.Transaction, error)
	GetExchange(opts *bind.CallOpts, assetCode string) (string, [32]byte, *big.Int, error)
	Redeem(opts *bind.TransactOpts, stableCreditAmount *big.Int, assetCode string) (*types.Transaction, error)
	CollateralHealthCheck(opts *bind.CallOpts, assetCode string) (common.Address, [32]byte, *big.Int, *big.Int, error)
	Rebalance(opts *bind.TransactOpts, assetCode string) (*types.Transaction, error)
}

type GetExchangeRateAbiInput

type GetExchangeRateAbiInput struct {
	AssetCode string
}

type GetExchangeRateInput

type GetExchangeRateInput struct {
	AssetCode string
}

GetExchangeRateInput required input fields of get exchange rate

func (*GetExchangeRateInput) ToAbiInput

func (*GetExchangeRateInput) Validate

func (i *GetExchangeRateInput) Validate() error

Validation function for GetExchangeRate. Validates the required struct fields. It returns an error if any of the fields are invalid. Otherwise, it returns nil.

type GetExchangeRateOutput

type GetExchangeRateOutput struct {
	AssetCode                     string
	CollateralAssetCode           string
	PriceInCollateralPerAssetUnit string
}

GetExchangeRateOutput output fields of get exchange rate

type HeartContract

type HeartContract interface {
	SetGovernor(opts *bind.TransactOpts, address common.Address) (*types.Transaction, error)
	IsGovernor(opts *bind.CallOpts, addr common.Address) (bool, error)
	SetTrustedPartner(opts *bind.TransactOpts, address common.Address) (*types.Transaction, error)
	IsTrustedPartner(opts *bind.CallOpts, addr common.Address) (bool, error)

	GetStableCreditCount(opts *bind.CallOpts) (uint8, error)
	GetRecentStableCredit(opts *bind.CallOpts) (common.Address, error)
	GetNextStableCredit(opts *bind.CallOpts, stableCreditId [32]byte) (common.Address, error)
}

type MintFromCollateralAmountAbiInput

type MintFromCollateralAmountAbiInput struct {
	NetCollateralAmount *big.Int
	AssetCode           string
}

type MintFromCollateralAmountCreditOutput

type MintFromCollateralAmountCreditOutput struct {
	Tx      *types.Transaction
	Receipt *types.Receipt
	Event   *MintFromCollateralAmountEvent
}

MintFromCollateralAmountCreditOutput output fields of mint from collateral amount

type MintFromCollateralAmountEvent

type MintFromCollateralAmountEvent struct {
	AssetCode           string
	StableCreditAmount  string
	AssetAddress        string
	CollateralAssetCode string
	CollateralAmount    string
	Raw                 *types.Log
}

func (*MintFromCollateralAmountEvent) ToEventOutput

func (i *MintFromCollateralAmountEvent) ToEventOutput(eventAbi *vabi.DigitalReserveSystemMint)

type MintFromCollateralAmountInput

type MintFromCollateralAmountInput struct {
	AssetCode        string
	CollateralAmount string
}

MintFromCollateralAmountInput required input fields of mint from collateral amount

func (*MintFromCollateralAmountInput) ToAbiInput

func (*MintFromCollateralAmountInput) Validate

func (i *MintFromCollateralAmountInput) Validate() error

Validation function for MintFromCollateralAmount. Validates the required struct fields. It returns an error if any of the fields are invalid. Otherwise, it returns nil.

type MintFromStableCreditAmountAbiInput

type MintFromStableCreditAmountAbiInput struct {
	MintAmount *big.Int
	AssetCode  string
}

type MintFromStableCreditAmountCreditOutput

type MintFromStableCreditAmountCreditOutput struct {
	Tx      *types.Transaction
	Receipt *types.Receipt
	Event   *MintFromStableCreditAmountEvent
}

MintFromStableCreditAmountCreditOutput output fields of mint from stable credit amount

type MintFromStableCreditAmountEvent

type MintFromStableCreditAmountEvent struct {
	AssetCode           string
	StableCreditAmount  string
	AssetAddress        string
	CollateralAssetCode string
	CollateralAmount    string
	Raw                 *types.Log
}

func (*MintFromStableCreditAmountEvent) ToEventOutput

func (i *MintFromStableCreditAmountEvent) ToEventOutput(eventAbi *vabi.DigitalReserveSystemMint)

type MintFromStableCreditAmountInput

type MintFromStableCreditAmountInput struct {
	AssetCode          string
	StableCreditAmount string
}

MintFromStableCreditAmountInput required input fields of mint from stable credit amount

func (*MintFromStableCreditAmountInput) ToAbiInput

func (*MintFromStableCreditAmountInput) Validate

func (i *MintFromStableCreditAmountInput) Validate() error

Validation function for MintFromStableCreditAmount. Validates the required struct fields. It returns an error if any of the fields are invalid. Otherwise, it returns nil.

type RebalanceInput

type RebalanceInput struct {
}

RebalanceInput required input fields of rebalance

type RebalanceOutput

type RebalanceOutput struct {
	RebalanceTransactions []*RebalanceTransaction
}

RebalanceOutput output fields of rebalance

type RebalanceTransaction

type RebalanceTransaction struct {
	AssetCode           string
	CollateralAssetCode string
	RequiredAmount      string
	PresentAmount       string
	Raw                 *types.Log
	Tx                  *types.Transaction
	Receipt             *types.Receipt
}

func (*RebalanceTransaction) ToRebalanceOutput

func (i *RebalanceTransaction) ToRebalanceOutput(eventAbi *vabi.DigitalReserveSystemRebalance, tx *types.Transaction, receipt *types.Receipt)

type RedeemStableCreditAbiInput

type RedeemStableCreditAbiInput struct {
	RedeemAmount *big.Int
	AssetCode    string
}

type RedeemStableCreditEvent

type RedeemStableCreditEvent struct {
	// all fields must be string formatted
	AssetCode              string
	StableCreditAmount     string
	CollateralAssetAddress string
	CollateralAssetCode    string
	CollateralAmount       string
	Raw                    *types.Log
}

type RedeemStableCreditInput

type RedeemStableCreditInput struct {
	RedeemAmount string
	AssetCode    string
}

RedeemStableCreditInput required input fields of redeem stable credit

func (*RedeemStableCreditInput) ToAbiInput

func (*RedeemStableCreditInput) Validate

func (i *RedeemStableCreditInput) Validate() error

Validation function for RedeemStableCredit. Validates the required struct fields. It returns an error if any of the fields are invalid. Otherwise, it returns nil.

type RedeemStableCreditOutput

type RedeemStableCreditOutput struct {
	Tx      *types.Transaction
	Receipt *types.Receipt
	Event   *RedeemStableCreditEvent
}

RedeemStableCreditOutput output fields of redeem stable credit

type SetupCreditAbiInput

type SetupCreditAbiInput struct {
	CollateralAssetCode [32]byte
	PeggedCurrency      [32]byte
	AssetCode           string
	PeggedValue         *big.Int
}

type SetupCreditEvent

type SetupCreditEvent struct {
	AssetCode           string
	PeggedCurrency      string
	PeggedValue         string
	CollateralAssetCode string
	AssetAddress        string
	Raw                 *types.Log
}

func (*SetupCreditEvent) ToEventOutput

func (i *SetupCreditEvent) ToEventOutput(eventAbi *vabi.DigitalReserveSystemSetup)

type SetupCreditInput

type SetupCreditInput struct {
	CollateralAssetCode string
	PeggedCurrency      string
	AssetCode           string
	PeggedValue         string
}

SetupCreditInput required input fields of setup credit

func (*SetupCreditInput) ToAbiInput

func (i *SetupCreditInput) ToAbiInput() *SetupCreditAbiInput

func (*SetupCreditInput) Validate

func (i *SetupCreditInput) Validate() error

Validation function for SetupCredit. Validates the required struct fields. It returns an error if any of the fields are invalid. Otherwise, it returns nil.

type SetupCreditOutput

type SetupCreditOutput struct {
	Tx      *types.Transaction
	Receipt *types.Receipt
	Event   *SetupCreditEvent
}

SetupCreditOutput output fields of setup credit

type StableCreditContract

type StableCreditContract interface {
	StableCreditAssetCode(opts *bind.CallOpts) (string, error)
}

type TxHelper

type TxHelper interface {
	ConfirmTx(ctx context.Context, tx *types.Transaction, from common.Address) (*types.Receipt, error)
	ExtractSetupEvent(eventName string, log *types.Log) (*vabi.DigitalReserveSystemSetup, error)
	ExtractMintEvent(eventName string, log *types.Log) (*vabi.DigitalReserveSystemMint, error)
	ExtractRedeemEvent(eventName string, log *types.Log) (*vabi.DigitalReserveSystemRedeem, error)
	ExtractRebalanceEvent(eventName string, log *types.Log) (*vabi.DigitalReserveSystemRebalance, error)
	StableCreditAssetCode(addr common.Address) (*string, *[32]byte, error)
}

type WhitelistGovernorAbiInput

type WhitelistGovernorAbiInput struct {
	Address common.Address
}

type WhitelistGovernorInput

type WhitelistGovernorInput struct {
	Address string
}

WhitelistGovernorInput required input fields of whitelist governor

func (*WhitelistGovernorInput) ToAbiInput

func (*WhitelistGovernorInput) Validate

func (i *WhitelistGovernorInput) Validate() error

Validation function for WhitelistGovernor. Validates the required struct fields. It returns an error if any of the fields are invalid. Otherwise, it returns nil.

type WhitelistGovernorOutput

type WhitelistGovernorOutput struct {
	Tx      *types.Transaction
	Receipt *types.Receipt
}

WhitelistGovernorOutput output fields of whitelist governor

type WhitelistTrustedPartnerAbiInput

type WhitelistTrustedPartnerAbiInput struct {
	Address common.Address
}

type WhitelistTrustedPartnerInput

type WhitelistTrustedPartnerInput struct {
	Address string
}

WhitelistTrustedPartnerInput required input fields of whitelist trusted partner

func (*WhitelistTrustedPartnerInput) ToAbiInput

func (*WhitelistTrustedPartnerInput) Validate

func (i *WhitelistTrustedPartnerInput) Validate() error

Validation function for WhitelistTrustedPartner. Validates the required struct fields. It returns an error if any of the fields are invalid. Otherwise, it returns nil.

type WhitelistTrustedPartnerOutput

type WhitelistTrustedPartnerOutput struct {
	Tx      *types.Transaction
	Receipt *types.Receipt
}

WhitelistTrustedPartnerOutput output fields of whitelist trusted partner

Directories

Path Synopsis
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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