defaultTimelockDuration
time.Duration// 1w
Value
<zero>
swaps
v0.Tree// id -> \*Swap
- OID
- 0d1bfc…e65c:4
swaps details
counter
intValue
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.
- OID
- 0d1bfc…e65c:6
NewCoinSwap details
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.
- OID
- 0d1bfc…e65c:8
NewGRC20Swap details
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.
- OID
- 0d1bfc…e65c:9
NewCustomCoinSwap details
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\`.
- OID
- 0d1bfc…e65c:10
NewCustomGRC20Swap details
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.
- OID
- 0d1bfc…e65c:11
Claim details
Refund
func(id int)Refund allows the sender to refund the funds after the timelock has expired.
- OID
- 0d1bfc…e65c:12
Refund details
Render
func(path string) stringRender returns a list of swaps (simplified) for the homepage, and swap details when specifying a swap ID.
- OID
- 0d1bfc…e65c:13
Render details
require
func(check bool, msg string)require checks a condition and panics with a message if the condition is false.
- OID
- 0d1bfc…e65c:14
require details
mustGet
func(id int) *atomicswap.SwapmustGet retrieves a swap by its id or panics.
- OID
- 0d1bfc…e65c:15
mustGet details
Swap
typeSwap 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- OID
- 0d1bfc…e65c:16