Skip to content

Commit

Permalink
test: more test case
Browse files Browse the repository at this point in the history
  • Loading branch information
r3v4s committed Jun 24, 2024
1 parent c2f6436 commit 00c7e30
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions examples/gno.land/r/demo/banktest/z_3_filetest.gno
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package main

import (
"std"
)

func main() {
banktestAddr := std.DerivePkgAddr("gno.land/r/demo/banktest")

// print main balance before.
mainaddr := std.DerivePkgAddr("main")
std.TestSetOrigCaller(mainaddr)

banker := std.GetBanker(std.BankerTypeRealmSend)
send := std.Coins{{"ugnot", int64(123)}}
banker.SendCoins(banktestAddr, mainaddr, send)

}

// Error:
// can only send coins from realm that created banker "g17rgsdnfxzza0sdfsdma37sdwxagsz378833ca4", not "g1dv3435088tlrgggf745kaud0ptrkc9v42k8llz"
2 changes: 1 addition & 1 deletion gnovm/stdlibs/std/banker.gno
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (b banker) SendCoins(from, to Address, amt Coins) {
panic("BankerTypeReadonly cannot send coins")
}
if b.pkgAddr != from.String() {
msg := "can only send coins from realm that created banker(" + b.pkgAddr + ")" + " not ( " + from.String() + ")"
msg := `can only send coins from realm that created banker "` + b.pkgAddr + `", not "` + from.String() + `"`
panic(msg)
}
denoms, amounts := amt.expandNative()
Expand Down

0 comments on commit 00c7e30

Please sign in to comment.