Predefined blockchain variables available in rule conditions and effects.
GV:
and can be used directly in condition expressions, tracker update expressions, and other rule logic.
Variable | Type | Description |
---|---|---|
GV:BLOCK_TIMESTAMP | uint256 | Current block timestamp (Unix timestamp) |
GV:MSG_DATA | bytes | Complete calldata of the current message |
GV:MSG_SENDER | address | Address of the message sender |
GV:BLOCK_NUMBER | uint256 | Current block number |
GV:TX_ORIGIN | address | Original external account that initiated the transaction |
GV:BLOCK_TIMESTAMP
for implementing time-based restrictions, deadlines, or time windows:
GV:MSG_SENDER
and GV:TX_ORIGIN
for implementing access control:
GV:MSG_DATA
for analyzing transaction data or implementing complex validation logic:
GV:BLOCK_NUMBER
for implementing block-based logic, such as rate limiting or periodic operations:
GV:MSG_SENDER
vs GV:TX_ORIGIN
, remember that:GV:MSG_SENDER
is the immediate caller (could be a contract)GV:TX_ORIGIN
is the original external account that initiated the transactionGV:TX_ORIGIN
when you need to identify the actual user, and GV:MSG_SENDER
when you need to identify the immediate caller.GV:BLOCK_TIMESTAMP
may not be perfectly accurate for time-sensitive applications.