Skip to main content

Constants

balance

Number of tez held by the contract.

It is indeed possible to send tez to a contract, either with a buitlin tansfer command (tezos-client, wallets, ...) or when calling an entrypoint.

danger

Note however that it is not possible to transfer the balance of a contract unless it is explicitely made possible by entrypoints.

If a contract is receiving tez, it is recommended to add the following collect entrypoint:

entry collect(collector : address) {
called by owner
effect {
transfer balance to collector
}
}

Type


Michelson

caller

Address calling the contract. It may be an account or another smart contract.

Type


Michelson


Related

level

Current block level.

Type


Michelson

now

Block date. It is constant throughout endpoint execution.

Type


Michelson

self_address

Address of current contract.

Type


Michelson


Related

self_chain_id

Chain unique identifier.

It is typically used in signed permits data to be verified on chain, in order to avoid replay attacks from testnet to mainnet (so that a permit from testnet cannot be used on mainnet).

The table below shows the chain id of the main networks:

Mainnet

"NetXdQprcVkpaWU"


Testnet (Ithacanet)

"NetXnHfVqm9iesp"

The chain id is provided by the tezos node at:

<node url>/chains/main/chain_id

Type


Michelson

source

Address of the account at the origin of the call to the entrypoint. If Alice calls contract A, which calls contract B, then source in contract B is Alice (and caller in contract B is contract A).

Type


Michelson


Related

state

State of the contract when designed as a state machine. It is changed with transition entrypoints, not assignment instructions.

The Michelson representation is a nat storage variable named _state.


Related

transferred

Amount of tez sent to current entrypoint execution.

Type


Michelson


Related

total_voting_power

Total voting power of all contracts.

Type


Michelson


Related