Skip to content

hashgraph/hedera-smart-contracts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Hedera Smart Contracts

Reference library for Smart Contracts utilized by the Hedera network with supporting files and examples.

Overview

The Hedera network utilizes system contracts at a reserved contract address on the EVM to surface HAPI service functionality through EVM processed transactions. These system contracts are precompiled smart contracts whose function selectors are mapped to defined network logic. In this way EVM users can utilize exposed HAPI features natively in their smart contracts.

The system contract functions are defined in this library and implemented by the Hedera Services repo as part of consensus node functionality.

Hedera Token Service (HTS) System Contract

The Hedera Token Service (HTS) functionality is defined by the IHederaTokenService.sol interface smart contract as defined in HIP 206, HIP 376 and HIP 514. The contract is exposed via the 0x167 address. Reference smart contracts to call these functions as well as examples can be found under contracts/system-contracts/hedera-token-service

For further details on methods, hashes and availability please refer to HTS System Contract Methods

  • Solidity files updated on April 20, 2022 to add token create support
  • Solidity files updated on Jan 18, 2022

Hedera Account Service (HAS) System Contract

The Hedera Account Service (HAS) functionality is defined by the IHederaAccountService.sol interface smart contract as defined in HIP 632 and HIP 906. The contract is exposed via the 0x16a address. Reference smart contracts to call these functions as well as examples can be found under contracts/system-contracts/hedera-account-service

For further details on methods, hashes and availability please refer to HAS System Contract Methods

Exchange Rate System Contract

The Exchange Rate functionality is defined by the IExchangeRate.sol interface smart contract as defined in HIP 475 and exposed via the 0x168 address. Reference smart contracts to call these functions as well as examples can be found under contracts/system-contracts/exchange-rate

For further details on methods, hashes and availability please refer to Exchange Rate System Contract Methods

Prng System Contract

The PRNG functionality is defined by the IPrngSystemContract.sol interface smart contract as defined in HIP 351 and exposed via the 0x169 address. Reference smart contracts to call these functions as well as examples can be found under contracts/system-contracts/pseudo-random-number-generator

For further details on methods, hashes and availability please refer to PRNG System Contract Methods

Development guidelines

This project is set up using the Hardhat development environment. To get started, please follow this test setup guide.

For using this project as a library in a Foundry project see Foundry Testing

Support

If you have a question on how to use the product, please see our support guide.

Contributing

Contributions are welcome. Please see the contributing guide to see how you can get involved.

Code of Conduct

This project is governed by the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code of conduct. Please report unacceptable behavior to oss@hedera.com.

License

Apache License 2.0

Smart contracts - testing

Smart contracts tests - documentation