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

cointest2.gno

0.85 Kb · 23 lines
 1// Realm cointest2 corrects cointest's MintAndSend: on-chain, IssueCoin
 2// requires the fully-qualified denom "/<pkgpath>:<sub>" (the local test
 3// harness accepted a bare subdenom — documented harness/chain
 4// discrepancy). Throwaway validation helper; safe to abandon.
 5package cointest2
 6
 7import (
 8	"chain"
 9	"chain/banker"
10)
11
12// FullDenom is the chain-qualified denomination this realm issues.
13const FullDenom = "/gno.land/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/cointest2:junk"
14
15// MintAndSend issues amount of FullDenom and force-sends it to target.
16func MintAndSend(cur realm, target address, amount int64) {
17	if amount <= 0 {
18		panic("amount must be positive")
19	}
20	bk := banker.NewBanker(banker.BankerTypeRealmIssue, cur)
21	bk.IssueCoin(cur.Address(), FullDenom, amount)
22	bk.SendCoins(cur.Address(), target, chain.Coins{chain.NewCoin(FullDenom, amount)})
23}