maker

package
v0.0.0-...-24d2682 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2019 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Float

type Float big.Float

Float is for json purposes

func (*Float) MarshalJSON

func (f *Float) MarshalJSON() ([]byte, error)

MarshalJSON transforms the Float in JSON number

func (*Float) String

func (f *Float) String() string

type Status

type Status struct {
	ID      *Float
	DaiDebt *Float
	Locked  *Float
	Price   *Float
	Ratio   *Float
	DaiNet  *Float
	ColNet  *Float
}

Status represents the status of a Vault at a given price

func (*Status) String

func (s *Status) String() string

type Vault

type Vault struct {
	ID               *big.Int
	BytesID          [32]byte
	Debt             *big.Float
	Col              *big.Float
	LiquidationRatio *big.Float
	IlkID            [32]byte
	Address          common.Address
}

Vault represents a Vault

func NewVault

func NewVault(id int64) *Vault

NewVault iritializes a new vault

func (*Vault) EqualizeVault

func (vault *Vault) EqualizeVault(colPrice, targetRatio *big.Float) (newVault *Vault, err error)

EqualizeVault returns a new Vault equalized at targetRatio for a given price

func (*Vault) GetChangePrices

func (vault *Vault) GetChangePrices(colPrice, minRatio, maxRatio *big.Float) (minPrice, maxPrice *big.Float)

GetChangePrices returns the prices (up and down) where this vault must be equalized

func (*Vault) GetColToFree

func (vault *Vault) GetColToFree(colPrice, target *big.Float) *big.Float

GetColToFree returns the number of collateral to free to go to the target ratio

func (*Vault) GetDaiToDraw

func (vault *Vault) GetDaiToDraw(colPrice, target *big.Float) *big.Float

GetDaiToDraw returns the number of DAI to draw to go to the target ratio

func (*Vault) GetMaxColToFree

func (vault *Vault) GetMaxColToFree(colPrice *big.Float) *big.Float

GetMaxColToFree returns the maximum number of collateral to free Returns nil if there is no collateral

func (*Vault) GetMaxDaiToDraw

func (vault *Vault) GetMaxDaiToDraw(colPrice *big.Float) *big.Float

GetMaxDaiToDraw returns the maximum number of DAI to draw

func (*Vault) GetRatio

func (vault *Vault) GetRatio(colPrice *big.Float) *big.Float

GetRatio returns the collateralization ratio of the vault at the actual collateral price Returns nil if there is no debt

func (*Vault) GetStatus

func (vault *Vault) GetStatus(colPrice *big.Float) (status *Status, err error)

GetStatus returns the status of the Vault for this price

func (*Vault) Log

func (vault *Vault) Log(colPrice, target *big.Float)

Log print infos on the Vault in the logs

Jump to

Keyboard shortcuts

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