datacap

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0, MIT Imports: 12 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InfiniteAllowance = big.Mul(big.MustFromString("1000000000000000000000"), builtin.TokenPrecision)
View Source
var Methods = map[abi.MethodNum]builtin.MethodMeta{
	1:                                        {"Constructor", *new(func(*address.Address) *abi.EmptyValue)},
	builtin.MustGenerateFRCMethodNum("Mint"): {"MintExported", *new(func(*MintParams) *MintReturn)},
	builtin.MustGenerateFRCMethodNum("Destroy"):           {"DestroyExported", *new(func(*DestroyParams) *BurnReturn)},
	builtin.MustGenerateFRCMethodNum("Name"):              {"NameExported", *new(func(*abi.EmptyValue) *abi.CborString)},
	builtin.MustGenerateFRCMethodNum("Symbol"):            {"SymbolExported", *new(func(*abi.EmptyValue) *abi.CborString)},
	builtin.MustGenerateFRCMethodNum("TotalSupply"):       {"TotalSupplyExported", *new(func(*abi.EmptyValue) *abi.TokenAmount)},
	builtin.MustGenerateFRCMethodNum("Balance"):           {"BalanceExported", *new(func(*address.Address) *abi.TokenAmount)},
	builtin.MustGenerateFRCMethodNum("Transfer"):          {"TransferExported", *new(func(*TransferParams) *TransferReturn)},
	builtin.MustGenerateFRCMethodNum("TransferFrom"):      {"TransferFromExported", *new(func(*TransferFromParams) *TransferFromReturn)},
	builtin.MustGenerateFRCMethodNum("IncreaseAllowance"): {"IncreaseAllowanceExported", *new(func(*IncreaseAllowanceParams) *abi.TokenAmount)},
	builtin.MustGenerateFRCMethodNum("DecreaseAllowance"): {"DecreaseAllowanceExported", *new(func(*DecreaseAllowanceParams) *abi.TokenAmount)},
	builtin.MustGenerateFRCMethodNum("RevokeAllowance"):   {"RevokeAllowanceExported", *new(func(*RevokeAllowanceParams) *abi.TokenAmount)},
	builtin.MustGenerateFRCMethodNum("Burn"):              {"BurnExported", *new(func(*BurnParams) *BurnReturn)},
	builtin.MustGenerateFRCMethodNum("BurnFrom"):          {"BurnFromExported", *new(func(*BurnFromParams) *BurnFromReturn)},
	builtin.MustGenerateFRCMethodNum("Allowance"):         {"AllowanceExported", *new(func(*GetAllowanceParams) *abi.TokenAmount)},
	builtin.MustGenerateFRCMethodNum("Granularity"):       {"GranularityExported", *new(func(value *abi.EmptyValue) *GranularityReturn)},
}

Functions

This section is empty.

Types

type BurnFromParams

type BurnFromParams struct {
	Owner  address.Address
	Amount abi.TokenAmount
}

func (*BurnFromParams) MarshalCBOR

func (t *BurnFromParams) MarshalCBOR(w io.Writer) error

func (*BurnFromParams) UnmarshalCBOR

func (t *BurnFromParams) UnmarshalCBOR(r io.Reader) (err error)

type BurnFromReturn

type BurnFromReturn struct {
	Balance   abi.TokenAmount
	Allowance abi.TokenAmount
}

func (*BurnFromReturn) MarshalCBOR

func (t *BurnFromReturn) MarshalCBOR(w io.Writer) error

func (*BurnFromReturn) UnmarshalCBOR

func (t *BurnFromReturn) UnmarshalCBOR(r io.Reader) (err error)

type BurnParams

type BurnParams struct {
	Amount abi.TokenAmount
}

func (*BurnParams) MarshalCBOR

func (t *BurnParams) MarshalCBOR(w io.Writer) error

func (*BurnParams) UnmarshalCBOR

func (t *BurnParams) UnmarshalCBOR(r io.Reader) (err error)

type BurnReturn

type BurnReturn struct {
	Balance abi.TokenAmount
}

func (*BurnReturn) MarshalCBOR

func (t *BurnReturn) MarshalCBOR(w io.Writer) error

func (*BurnReturn) UnmarshalCBOR

func (t *BurnReturn) UnmarshalCBOR(r io.Reader) (err error)

type DecreaseAllowanceParams

type DecreaseAllowanceParams struct {
	Operator address.Address
	Decrease abi.TokenAmount
}

func (*DecreaseAllowanceParams) MarshalCBOR

func (t *DecreaseAllowanceParams) MarshalCBOR(w io.Writer) error

func (*DecreaseAllowanceParams) UnmarshalCBOR

func (t *DecreaseAllowanceParams) UnmarshalCBOR(r io.Reader) (err error)

type DestroyParams

type DestroyParams struct {
	Owner  address.Address
	Amount abi.TokenAmount
}

func (*DestroyParams) MarshalCBOR

func (t *DestroyParams) MarshalCBOR(w io.Writer) error

func (*DestroyParams) UnmarshalCBOR

func (t *DestroyParams) UnmarshalCBOR(r io.Reader) (err error)

type GetAllowanceParams

type GetAllowanceParams struct {
	Owner    address.Address
	Operator address.Address
}

func (*GetAllowanceParams) MarshalCBOR

func (t *GetAllowanceParams) MarshalCBOR(w io.Writer) error

func (*GetAllowanceParams) UnmarshalCBOR

func (t *GetAllowanceParams) UnmarshalCBOR(r io.Reader) (err error)

type GranularityReturn

type GranularityReturn = cbg.CborInt

type IncreaseAllowanceParams

type IncreaseAllowanceParams struct {
	Operator address.Address
	Increase abi.TokenAmount
}

func (*IncreaseAllowanceParams) MarshalCBOR

func (t *IncreaseAllowanceParams) MarshalCBOR(w io.Writer) error

func (*IncreaseAllowanceParams) UnmarshalCBOR

func (t *IncreaseAllowanceParams) UnmarshalCBOR(r io.Reader) (err error)

type MintParams

type MintParams struct {
	To        address.Address
	Amount    abi.TokenAmount
	Operators []address.Address
}

func (*MintParams) MarshalCBOR

func (t *MintParams) MarshalCBOR(w io.Writer) error

func (*MintParams) UnmarshalCBOR

func (t *MintParams) UnmarshalCBOR(r io.Reader) (err error)

type MintReturn

type MintReturn struct {
	Balance       abi.TokenAmount
	Supply        abi.TokenAmount
	RecipientData []byte
}

func (*MintReturn) MarshalCBOR

func (t *MintReturn) MarshalCBOR(w io.Writer) error

func (*MintReturn) UnmarshalCBOR

func (t *MintReturn) UnmarshalCBOR(r io.Reader) (err error)

type RevokeAllowanceParams

type RevokeAllowanceParams struct {
	Operator address.Address
}

func (*RevokeAllowanceParams) MarshalCBOR

func (t *RevokeAllowanceParams) MarshalCBOR(w io.Writer) error

func (*RevokeAllowanceParams) UnmarshalCBOR

func (t *RevokeAllowanceParams) UnmarshalCBOR(r io.Reader) (err error)

type State

type State struct {
	Governor address.Address
	Token    TokenState
}

func ConstructState

func ConstructState(store adt.Store, governor address.Address, bitWidth uint64) (*State, error)

func (*State) MarshalCBOR

func (t *State) MarshalCBOR(w io.Writer) error

func (*State) UnmarshalCBOR

func (t *State) UnmarshalCBOR(r io.Reader) (err error)

type StateSummary

type StateSummary struct {
	Balances    map[abi.ActorID]abi.TokenAmount
	Allowances  map[abi.ActorID]map[abi.ActorID]abi.TokenAmount
	TotalSupply abi.TokenAmount
}

func CheckStateInvariants

func CheckStateInvariants(st *State, store adt.Store) (*StateSummary, *builtin.MessageAccumulator)

Checks internal invariants of verified registry state.

type TokenState

type TokenState struct {
	Supply       abi.TokenAmount
	Balances     cid.Cid // HAMT abi.ActorID[abi.TokenAmount]
	Allowances   cid.Cid // HAMT abi.ActorID[abi.ActorID[abi.TokenAmount]]
	HamtBitWidth uint64  // uint32 in builtin-actors. uint64 here to satisfy cbor-gen
}

func (*TokenState) MarshalCBOR

func (t *TokenState) MarshalCBOR(w io.Writer) error

func (*TokenState) UnmarshalCBOR

func (t *TokenState) UnmarshalCBOR(r io.Reader) (err error)

type TransferFromParams

type TransferFromParams struct {
	From         address.Address
	To           address.Address
	Amount       abi.TokenAmount
	OperatorData []byte
}

func (*TransferFromParams) MarshalCBOR

func (t *TransferFromParams) MarshalCBOR(w io.Writer) error

func (*TransferFromParams) UnmarshalCBOR

func (t *TransferFromParams) UnmarshalCBOR(r io.Reader) (err error)

type TransferFromReturn

type TransferFromReturn struct {
	FromBalance   abi.TokenAmount
	ToBalance     abi.TokenAmount
	Allowance     abi.TokenAmount
	RecipientData []byte
}

func (*TransferFromReturn) MarshalCBOR

func (t *TransferFromReturn) MarshalCBOR(w io.Writer) error

func (*TransferFromReturn) UnmarshalCBOR

func (t *TransferFromReturn) UnmarshalCBOR(r io.Reader) (err error)

type TransferParams

type TransferParams struct {
	To           address.Address
	Amount       abi.TokenAmount
	OperatorData []byte
}

func (*TransferParams) MarshalCBOR

func (t *TransferParams) MarshalCBOR(w io.Writer) error

func (*TransferParams) UnmarshalCBOR

func (t *TransferParams) UnmarshalCBOR(r io.Reader) (err error)

type TransferReturn

type TransferReturn struct {
	FromBalance   abi.TokenAmount
	ToBalance     abi.TokenAmount
	RecipientData []byte
}

func (*TransferReturn) MarshalCBOR

func (t *TransferReturn) MarshalCBOR(w io.Writer) error

func (*TransferReturn) UnmarshalCBOR

func (t *TransferReturn) UnmarshalCBOR(r io.Reader) (err error)

Jump to

Keyboard shortcuts

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