-
Notifications
You must be signed in to change notification settings - Fork 381
/
native.gno
60 lines (49 loc) · 1.44 KB
/
native.gno
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package std
func AssertOriginCall() // injected
func IsOriginCall() bool // injected
func CurrentRealmPath() string // injected
func GetChainID() string // injected
func GetHeight() int64 // injected
func GetOrigSend() Coins {
den, amt := origSend()
coins := make(Coins, len(den))
for i := range coins {
coins[i] = Coin{Denom: den[i], Amount: amt[i]}
}
return coins
}
func GetOrigCaller() Address {
return Address(origCaller())
}
func CurrentRealm() Realm {
addr, path := getRealm(0)
return Realm{Address(addr), path}
}
func PrevRealm() Realm {
addr, path := getRealm(1)
return Realm{Address(addr), path}
}
func GetOrigPkgAddr() Address {
return Address(origPkgAddr())
}
func GetCallerAt(n int) Address {
return Address(callerAt(n))
}
func DerivePkgAddr(pkgPath string) Address {
return Address(derivePkgAddr(pkgPath))
}
func EncodeBech32(prefix string, bz [20]byte) Address {
return Address(encodeBech32(prefix, bz))
}
func DecodeBech32(addr Address) (prefix string, bz [20]byte, ok bool) {
return decodeBech32(string(addr))
}
// Variations which don't use named types.
func origSend() (denoms []string, amounts []int64)
func origCaller() string
func origPkgAddr() string
func callerAt(n int) string
func getRealm(height int) (address string, pkgPath string)
func derivePkgAddr(pkgPath string) string
func encodeBech32(prefix string, bz [20]byte) string
func decodeBech32(addr string) (prefix string, bz [20]byte, ok bool)