Skip to content

Commit 80ea697

Browse files
author
Cashmaney
authored
Update random-usage.md
1 parent 8297e24 commit 80ea697

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

docs/random-usage.md

+22
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,28 @@ pub fn execute(env: Env, _info: MessageInfo, _msg: T) -> Result<Response<T>> {
5151
}
5252
```
5353

54+
The env and block_info structures are defined as:
55+
56+
```rust
57+
pub struct Env {
58+
pub block: BlockInfo,
59+
pub contract: ContractInfo,
60+
pub transaction: Option<TransactionInfo>,
61+
}
62+
63+
pub struct BlockInfo {
64+
/// The height of a block is the number of blocks preceding it in the blockchain.
65+
pub height: u64,
66+
pub time: Timestamp,
67+
pub chain_id: String,
68+
#[cfg(feature = "random")]
69+
#[serde(skip_serializing_if = "Option::is_none")]
70+
pub random: Option<Binary>,
71+
}
72+
```
73+
74+
Where the random is 32 bytes long and base64 encoded.
75+
5476
## Example: Lottery Contract
5577
Below is a simple lottery contract that uses the randomness feature:
5678

0 commit comments

Comments
 (0)