Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

common state

Back to all declarations

AssertIsNotHandleNativeCoin

func()

AssertIsNotHandleNativeCoin validates that no native coins were sent with the transaction. Panics with errNotHandleNativeCoin if any native coins were sent. Use this when a function should only work with GRC20 tokens and not accept native coins.

Open
OID
057463…de87:3
AssertIsNotHandleNativeCoin details

Inspect func

errNotRegistered

untyped string

Value

"[GNOSWAP-COMMON-001] token is not registered"

errNotHandleNativeCoin

untyped string

Value

"[GNOSWAP-COMMON-002] handle native coin is not allowed"

newErrorWithDetail

func(message string, detail string) string

newErrorWithDetail creates an error message with additional context in format "\<original\_error> || \<detail>".

Open
OID
057463…de87:5
newErrorWithDetail details

Inspect func

GetToken

func(tokenKey string) *grc20.Token

GetToken returns a grc20.Token instance for the specified tokenKey, panicking if not registered. Parameters: - tokenKey: GRC20 registry key Returns a pointer to the grc20.Token instance. Panics if the token is not registered in grc20reg.

Open
OID
057463…de87:7
GetToken details

Inspect func

GetTokenTeller

func(tokenKey string) grc20.Teller

GetTokenTeller returns a CallerTeller for the specified tokenKey, panicking if not registered. Parameters: - tokenKey: GRC20 registry key Returns a grc20.Teller whose write methods derive the actor from the caller realm. Panics if the token is not registered in grc20reg.

Open
OID
057463…de87:9
GetTokenTeller details

Inspect func

IsRegistered

func(tokenKey string) .uverse.error

IsRegistered checks if a token is registered in grc20reg, returning nil if registered or error if not. Parameters: - tokenKey: GRC20 registry key Returns nil if the token is registered, or an error describing the issue.

Open
OID
057463…de87:10
IsRegistered details

Inspect func

MustRegistered

func(tokenKeys []string)

MustRegistered checks if all provided tokens are registered, panicking if any is not registered. Parameters: - tokenKeys: variable number of GRC20 registry keys to check Panics if any of the provided tokens is not registered in grc20reg.

Open
OID
057463…de87:11
MustRegistered details

Inspect func

TotalSupply

func(tokenKey string) int64

TotalSupply returns the total supply of the specified token. Parameters: - tokenKey: GRC20 registry key Returns the total supply of the token as int64.

Open
OID
057463…de87:12
TotalSupply details

Inspect func

BalanceOf

func(tokenKey string, addr .uverse.address) int64

BalanceOf returns the token balance for the specified address. Parameters: - tokenKey: GRC20 registry key - addr: address to query the balance for Returns the token balance as int64.

Open
OID
057463…de87:13
BalanceOf details

Inspect func

Allowance

func(tokenKey string, owner .uverse.address, spender .uverse.address) int64

Allowance returns the token allowance from owner to spender. Parameters: - tokenKey: GRC20 registry key - owner: address of the token owner - spender: address of the spender Returns the allowance amount as int64.

Open
OID
057463…de87:14
Allowance details

Inspect func

Transfer

func(tokenKey string, to .uverse.address, amount int64) .uverse.error

Transfer crosses into common before forwarding to grc20.Teller.Transfer. CallerTeller uses cur.Previous() as the token actor, so this helper must remain a crossing adapter called with cross(cur). Parameters: - cur: current realm - tokenKey: GRC20 registry key - to: recipient address - amount: amount of tokens to transfer Returns an error if the transfer fails, nil otherwise.

Open
OID
057463…de87:15
Transfer details

Inspect func

TransferFrom

func(tokenKey string, from .uverse.address, to .uverse.address, amount int64) .uverse.error

TransferFrom crosses into common before forwarding to grc20.Teller.TransferFrom. CallerTeller uses cur.Previous() as the spender, so this helper must remain a crossing adapter called with cross(cur). Parameters: - cur: current realm - tokenKey: GRC20 registry key - from: sender address - to: recipient address - amount: amount of tokens to transfer Returns an error if the transfer fails, nil otherwise.

Open
OID
057463…de87:16
TransferFrom details

Inspect func

Approve

func(tokenKey string, spender .uverse.address, amount int64) .uverse.error

Approve crosses into common before forwarding to grc20.Teller.Approve. CallerTeller uses cur.Previous() as the approver, so this helper must remain a crossing adapter called with cross(cur). Parameters: - cur: current realm - tokenKey: GRC20 registry key - spender: address allowed to spend the tokens - amount: amount of tokens to approve Returns an error if the approval fails, nil otherwise.

Open
OID
057463…de87:17
Approve details

Inspect func

SafeGRC20Transfer

func(tokenKey string, to .uverse.address, amount int64)

SafeGRC20Transfer crosses into common, transfers tokens, and panics if it fails. CallerTeller uses cur.Previous() as the token actor, so this helper must remain a crossing adapter called with cross(cur). Parameters: - cur: current realm - tokenKey: GRC20 registry key - to: recipient address - amount: amount of tokens to transfer Panics if the transfer fails.

Open
OID
057463…de87:18
SafeGRC20Transfer details

Inspect func

SafeGRC20TransferFrom

func(tokenKey string, from .uverse.address, to .uverse.address, amount int64)

SafeGRC20TransferFrom crosses into common, transfers tokens, and panics if it fails. CallerTeller uses cur.Previous() as the spender, so this helper must remain a crossing adapter called with cross(cur). Parameters: - cur: current realm - tokenKey: GRC20 registry key - from: sender address - to: recipient address - amount: amount of tokens to transfer Panics if the transfer fails.

Open
OID
057463…de87:19
SafeGRC20TransferFrom details

Inspect func

SafeGRC20Approve

func(tokenKey string, spender .uverse.address, amount int64)

SafeGRC20Approve crosses into common, approves tokens, and panics if it fails. CallerTeller uses cur.Previous() as the approver, so this helper must remain a crossing adapter called with cross(cur). Parameters: - cur: current realm - tokenKey: GRC20 registry key - spender: address allowed to spend the tokens - amount: amount of tokens to approve Panics if the approval fails.

Open
OID
057463…de87:20
SafeGRC20Approve details

Inspect func
AssertIsNotHandleNativeCoin : func() Inspect
errNotRegistered : untyped string ="[GNOSWAP-COMMON-001] token is not registered"
errNotHandleNativeCoin : untyped string ="[GNOSWAP-COMMON-002] handle native coin is not allowed"
newErrorWithDetail : func(message string, detail string) string Inspect
GetToken : func(tokenKey string) *grc20.Token Inspect
GetTokenTeller : func(tokenKey string) grc20.Teller Inspect
IsRegistered : func(tokenKey string) .uverse.error Inspect
MustRegistered : func(tokenKeys []string) Inspect
TotalSupply : func(tokenKey string) int64 Inspect
BalanceOf : func(tokenKey string, addr .uverse.address) int64 Inspect
Allowance : func(tokenKey string, owner .uverse.address, spender .uverse.address) int64 Inspect
Transfer : func(tokenKey string, to .uverse.address, amount int64) .uverse.error Inspect
TransferFrom : func(tokenKey string, from .uverse.address, to .uverse.address, amount int64) .uverse.error Inspect
Approve : func(tokenKey string, spender .uverse.address, amount int64) .uverse.error Inspect
SafeGRC20Transfer : func(tokenKey string, to .uverse.address, amount int64) Inspect
SafeGRC20TransferFrom : func(tokenKey string, from .uverse.address, to .uverse.address, amount int64) Inspect
SafeGRC20Approve : func(tokenKey string, spender .uverse.address, amount int64) Inspect