assets

package
v0.0.0-...-3674750 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatWei

func FormatWei(i *big.Int) string

Returns input big.Int in Wei string format.

Types

type Eth

type Eth big.Int

Eth contains a field to represent the smallest units of ETH

func NewEth

func NewEth(w int64) *Eth

NewEth returns a new struct to represent ETH from it's smallest unit (wei)

func NewEthValue

func NewEthValue(w int64) Eth

NewEthValue returns a new struct to represent ETH from it's smallest unit (wei)

func NewEthValueS

func NewEthValueS(s string) (Eth, error)

NewEthValueS returns a new struct to represent ETH from a string value of Eth (not wei) the underlying value is still wei

func (*Eth) Cmp

func (e *Eth) Cmp(y *Eth) int

Cmp delegates to *big.Int.Cmp

func (*Eth) IsZero

func (e *Eth) IsZero() bool

IsZero returns true when the value is 0 and false otherwise

func (Eth) MarshalJSON

func (e Eth) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*Eth) MarshalText

func (e *Eth) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*Eth) Scan

func (e *Eth) Scan(value interface{}) error

Scan reads the database value and returns an instance.

func (*Eth) SetInt64

func (e *Eth) SetInt64(w int64) *Eth

SetInt64 delegates to *big.Int.SetInt64

func (*Eth) SetString

func (e *Eth) SetString(s string, base int) (*Eth, bool)

SetString delegates to *big.Int.SetString

func (*Eth) String

func (e *Eth) String() string

func (*Eth) Symbol

func (*Eth) Symbol() string

Symbol returns ETH

func (*Eth) ToInt

func (e *Eth) ToInt() *big.Int

ToInt returns the Eth value as a *big.Int.

func (*Eth) UnmarshalJSON

func (e *Eth) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*Eth) UnmarshalText

func (e *Eth) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (Eth) Value

func (e Eth) Value() (driver.Value, error)

Value returns the Eth value for serialization to database.

type Wei

type Wei ubig.Big

Wei extends ubig.Big to implement encoding.TextMarshaler and encoding.TextUnmarshaler with support for unit suffixes, as well as additional functions

func Ether

func Ether[T constraints.Signed](n T) *Wei

func GWei

func GWei[T constraints.Signed](n T) *Wei

func MaxWei

func MaxWei(w, x *Wei) *Wei

func NewWei

func NewWei(i *big.Int) *Wei

NewWei constructs a Wei from *big.Int.

func NewWeiI

func NewWeiI[T constraints.Signed](i T) *Wei

func UEther

func UEther[T constraints.Signed](n T) *Wei

UEther converts units of micro-ether (terawei) into wei

func WeiMax

func WeiMax(x, y *Wei) *Wei

func WeiMin

func WeiMin(x, y *Wei) *Wei

func (*Wei) Add

func (w *Wei) Add(y *Wei) *Wei

func (*Wei) AddPercentage

func (w *Wei) AddPercentage(percentage uint16) *Wei

func (*Wei) Cmp

func (w *Wei) Cmp(y *Wei) int

func (*Wei) Equal

func (w *Wei) Equal(y *Wei) bool

func (*Wei) Int64

func (w *Wei) Int64() int64

func (*Wei) IsNegative

func (w *Wei) IsNegative() bool

func (*Wei) IsZero

func (w *Wei) IsZero() bool

func (*Wei) MarshalText

func (w *Wei) MarshalText() ([]byte, error)

func (*Wei) Mul

func (w *Wei) Mul(y *big.Int) *Wei

func (*Wei) Scan

func (w *Wei) Scan(value interface{}) error

Scan reads the database value and returns an instance.

func (*Wei) String

func (w *Wei) String() string

func (*Wei) Sub

func (w *Wei) Sub(y *Wei) *Wei

func (*Wei) Text

func (w *Wei) Text(suffix string) string

func (*Wei) ToInt

func (w *Wei) ToInt() *big.Int

func (*Wei) UnmarshalText

func (w *Wei) UnmarshalText(b []byte) error

func (Wei) Value

func (w Wei) Value() (driver.Value, error)

Value returns this instance serialized for database storage.

Jump to

Keyboard shortcuts

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