Skip to content

Latest commit

 

History

History
24 lines (18 loc) · 509 Bytes

常量.md

File metadata and controls

24 lines (18 loc) · 509 Bytes

常量

常量是不能改变的变量。

# @version ^0.3.7

MY_CONSTANT: constant(uint256) = 123
MIN: constant(uint256) = 1
MAX: constant(uint256) = 10
ADDR: constant(address) = 0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B


@external
@pure
def getBuiltInConstants() -> (address, uint256, bytes32):
    # Commonly used constants availabe in Vyper
    return (ZERO_ADDRESS, MAX_UINT256, EMPTY_BYTES32)


@external
@pure
def getMyConstants() -> (uint256, uint256, address):
    return (MIN, MAX, ADDR)