-
Notifications
You must be signed in to change notification settings - Fork 8
/
env.go
43 lines (37 loc) · 1.32 KB
/
env.go
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
package types
//---------- Env ---------
// Env defines the state of the blockchain environment this contract is
// running in. This must contain only trusted data - nothing from the Tx itself
// that has not been verfied (like Signer).
//
// Env are json encoded to a byte slice before passing to the wasm contract.
type Env struct {
Block BlockInfo
Contract ContractInfo
Transaction *TransactionInfo `json:"transaction_info,omitempty"`
}
type BlockInfo struct {
// block height this transaction is executed
Height uint64 `json:"height"`
// time in nanoseconds since unix epoch. Uses string to ensure JavaScript compatibility.
Time uint64 `json:"time,string"`
ChainID string `json:"chain_id"`
}
type MessageInfo struct {
// binary encoding of sdk.AccAddress executing the contract
Sender string `json:"sender"`
// amount of funds send to the contract along with this message
Funds []Coin `json:"funds,emptyslice"`
}
type ContractInfo struct {
// bech32 encoding of sdk.AccAddress of the contract, to be used when sending messages
Address string
}
type TransactionInfo struct {
// Position of this transaction in the block.
// The first transaction has index 0
//
// Along with BlockInfo.Height, this allows you to get a unique
// transaction identifier for the chain for future queries
Index uint32 `json:"index"`
}