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

assert.gno

0.43 Kb · 17 lines
 1package common
 2
 3import (
 4	"errors"
 5
 6	"chain/runtime/unsafe"
 7)
 8
 9// AssertIsNotHandleNativeCoin validates that no native coins were sent with the transaction.
10// Panics with errNotHandleNativeCoin if any native coins were sent.
11//
12// Use this when a function should only work with GRC20 tokens and not accept native coins.
13func AssertIsNotHandleNativeCoin() {
14	if len(unsafe.OriginSend()) > 0 {
15		panic(errors.New(errNotHandleNativeCoin))
16	}
17}