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

atomicswap state

Back to all declarations

defaultTimelockDuration

time.Duration

// 1w

Value

<zero>

counter

int

Value

0

NewCoinSwap

func(recipient .uverse.address, hashlock string) (int, *atomicswap.Swap)

NewCoinSwap creates a new atomic swap contract for native coins. It uses a default timelock duration.

Open
OID
0d1bfc…e65c:6
NewCoinSwap details

Inspect func

NewGRC20Swap

func(recipient .uverse.address, hashlock string, tokenRegistryKey string) (int, *atomicswap.Swap)

NewGRC20Swap creates a new atomic swap contract for grc20 tokens. It uses gno.land/r/demo/defi/grc20reg to lookup for a registered token.

Open
OID
0d1bfc…e65c:8
NewGRC20Swap details

Inspect func

NewCustomCoinSwap

func(recipient .uverse.address, hashlock string, timelock time.Time) (int, *atomicswap.Swap)

NewCoinSwapWithTimelock creates a new atomic swap contract for native coin. It allows specifying a custom timelock duration. Only direct user-call (maketx call) is accepted: unsafe.OriginSend() describes a real receipt at this realm only when the caller is a pure EOA. Intermediate code realms or \`maketx run\` ephemeral realms can attach -send to the tx but spend the envelope elsewhere, leaving OriginSend() describing a phantom payment that would let the swap drain the realm's pre-existing balance on Claim.

Open
OID
0d1bfc…e65c:9
NewCustomCoinSwap details

Inspect func

NewCustomGRC20Swap

func(recipient .uverse.address, hashlock string, timelock time.Time, token *grc20.Token) (int, *atomicswap.Swap)

NewCustomGRC20Swap creates a new atomic swap contract for grc20 tokens. It is not callable with \`gnokey maketx call\`, but can be imported by another contract or \`gnokey maketx run\`.

Open
OID
0d1bfc…e65c:10
NewCustomGRC20Swap details

Inspect func

Claim

func(id int, secret string)

Claim allows the recipient to claim the funds if they provide the correct preimage. rlm is the cur of the surrounding crossing wrapper; rlm.Previous() is the immediate caller of that wrapper, against which we authorize.

Open
OID
0d1bfc…e65c:11
Claim details

Inspect func

Refund

func(id int)

Refund allows the sender to refund the funds after the timelock has expired.

Open
OID
0d1bfc…e65c:12
Refund details

Inspect func

Render

func(path string) string

Render returns a list of swaps (simplified) for the homepage, and swap details when specifying a swap ID.

Open
OID
0d1bfc…e65c:13
Render details

Inspect func

require

func(check bool, msg string)

require checks a condition and panics with a message if the condition is false.

Open
OID
0d1bfc…e65c:14
require details

Inspect func

mustGet

func(id int) *atomicswap.Swap

mustGet retrieves a swap by its id or panics.

Open
OID
0d1bfc…e65c:15
mustGet details

Inspect func

Swap

type

Swap represents an atomic swap contract.

Value

atomicswap.Swap

newSwap

func(sender .uverse.address, recipient .uverse.address, hashlock string, timelock time.Time, amountStr string, sendFn func(...)) *atomicswap.Swap
Open
OID
0d1bfc…e65c:16
newSwap details

Inspect func
defaultTimelockDuration : time.Duration =<zero>
swaps : v0.Tree Inspect
counter : int =0
NewCoinSwap : func(recipient .uverse.address, hashlock string) (int, *atomicswap.Swap) Inspect
NewGRC20Swap : func(recipient .uverse.address, hashlock string, tokenRegistryKey string) (int, *atomicswap.Swap) Inspect
NewCustomCoinSwap : func(recipient .uverse.address, hashlock string, timelock time.Time) (int, *atomicswap.Swap) Inspect
NewCustomGRC20Swap : func(recipient .uverse.address, hashlock string, timelock time.Time, token *grc20.Token) (int, *atomicswap.Swap) Inspect
Claim : func(id int, secret string) Inspect
Refund : func(id int) Inspect
Render : func(path string) string Inspect
require : func(check bool, msg string) Inspect
mustGet : func(id int) *atomicswap.Swap Inspect
Swap : type =atomicswap.Swap
newSwap : func(sender .uverse.address, recipient .uverse.address, hashlock string, timelock time.Time, amountStr string, sendFn func(...)) *atomicswap.Swap Inspect