Built-in Contracts

Examples of how to use the built-in contracts can be found herearrow-up-right.

staker.sol

staker.solarrow-up-right is related to the delegated proof of stake (dPoS) consensus mechanism. The Staker contract manages a list of validators that are responsible for packing transactions into a block. This contract replaces authority.sol after the hayabusa fork and transition period. The contract also allows adding delegations. For more information please refer to the relevant VIParrow-up-right

Address :0x00000000000000000000000000005374616b6572

Codearrow-up-right / ABIarrow-up-right

authority.sol

authority.sol arrow-up-rightis related to the proof of authority (PoA) consensus mechanism. The Authority contract manages a list of candidate proposers that are responsible for packing transactions into a block. The proposers are authorized by a voting committee, but only the first 101 proposers in the candidates list can build a block. A candidate proposer includes signer address, endorsor address and identity. Signer address is related to sign a block, endorsor address is used for charging miner's fee and identity is used for identifying the proposer.

Address :0x0000000000000000000000417574686f72697479

Codearrow-up-right / ABIarrow-up-right

energy.sol

energy.sol arrow-up-rightrepresents the sub-token in VeChainThor which conforms to VIP-180(ERC-20) standard. The name of the token is VeThor and the symbol is VTHO. 1 VTHO equals to 1e18 Wei. The main function of VTHO is to pay for the transaction fee. VTHO is generated from VET, so the initial supply of VTHO is zero in the genesis block. The growth rate of VTHO is dynamic and depends on both network utilization and the amount of VET Staked in the DPoS consensus.

Address :0x0000000000000000000000000000456e65726779

Code arrow-up-right/ ABIarrow-up-right

executor.sol

executor.sol arrow-up-rightrepresents the core code for the on-chain governance. The contract enables a proposal to be executed automatically on VeChainThor if it is approved by at least two-thirda of the steering committee members. A proposal can be registered either by an approver (a steering committee member) or by an authorized voting contract.

Address : 0x0000000000000000000000004578656375746f72

Codearrow-up-right / ABIarrow-up-right

extension-v2.sol

extension-v2.sol arrow-up-rightextends EVM functions. It allows the developer to get information of the current transaction and any historical block within range of the genesis block to the best block. The information obtained based on block number includes blockID, blockTotalScore, blockTime and blockSigner. The developer can also get the current transaction information, including txGasPayer, txProvedWork, txID, txBlockRef and txExpiration.

Note

Before implement the VIP-191 , extension.sol arrow-up-rightis the main contract

Address : 0x0000000000000000000000457874656e73696f6e

V1 Codearrow-up-right / V2 code arrow-up-right/ ABIarrow-up-right

params.sol

params.sol arrow-up-rightstores the governance params of VeChainThor. The params can be set by the executor, a contract that is authorized to modify governance params by a voting Committee. Anyone can get the params just by calling "get" function. The governance params is written in genesis block at launch time. You can find the list of the governance parameters in params.goarrow-up-right.

Address : 0x0000000000000000000000000000506172616d73

Codearrow-up-right / ABIarrow-up-right

prototype.sol

prototype.sol arrow-up-rightis an account management model of VeChainThor. In the account management model every contract has a master account, which, by default, is the creator of a contract. The master account plays the role of a contract manager, which has some authorities including "setMaster", "setCreditPlan", "addUser", "removeUser" and "selectSponsor". Every contract keeps a list of users who can call the contract for free but limited by credit. The user of a specific contract can be either added or removed by the contract master. Although from a user's perspective the fee is free, it is paid by a sponsor of the contract. Anyone can be a sponsor of a contract, just by calling sponsor function, and also the sponsor identity can be cancelled by calling unsponsor function. A contract may have more than one sponsor, but only the current sponsor chosen by master needs to pay the fee for the contract. If the current sponsor is out of energy, the master can select a sponsor from other sponsors candidates by calling selectSponsor function. The creditPlan can be set by the master which includes credit and recoveryRate. Every user has the same original credit. Every transaction consumes some amount of credit which is equal to the fee of the transaction, and the user can also pay the fee by itself if the gas payer is out of the credit. The credit can be recovered based on recoveryRate (per block).

Address : 0x000000000000000000000050726f746f74797065

Codearrow-up-right / ABIarrow-up-right / Event ABIarrow-up-right

Last updated

Was this helpful?