mover.gno
0.80 Kb · 20 lines
1// Package mover is the market-shaped half of spike (b)/(c): a separate realm
2// that moves a spike/subtoken token it was approved for, through
3// RealmTeller — the exact call market/v1.Buy makes on core tokens. It shows
4// (1) the approval path works across realms for a sub-realm-created token
5// and (2) the lock extension still vetoes the move before reveal.
6package mover
7
8import (
9 "gno.land/p/nt/grc721/v0"
10
11 "gno.land/r/g19dzk54hhsdc3gllpksuj6gu4a3e6fl8cr6rn4w/minhwa/spike/subtoken"
12)
13
14// Move transfers tid from -> to, acting as this realm's own address. The
15// ledger only lets that succeed if `from` approved this realm.
16func Move(cur realm, tid string, from, to address) {
17 if err := subtoken.Token().RealmTeller(0, cur).TransferFrom(0, cur, from, to, grc721.TokenID(tid)); err != nil {
18 panic(err)
19 }
20}