Skip to content

arianejasuwienas/hedera-smart-contracts

 
 

Repository files navigation

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 precompiled functions are defined in this library and picked up by the Hedera Services repo.

HTS Precompile

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/hts-precompile

For further details on methods, hashes and availability please refer to HTS Precompile methods

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

Exchange Rate Precompile

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/exchange-rate-precompile

For further details on methods, hashes and availability please refer to Exchange Rate Precompile methods

Prng Precompile

The PRNG functionality is defined by the IPrng.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/util-precompile

For further details on methods, hashes and availability please refer to PRNG Precompile 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 [email protected].

License

Apache License 2.0

Smart contracts - testing

Smart contracts tests - documentation

About

Contains Hedera Smart Contract Service supporting files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 41.5%
  • Solidity 28.2%
  • JavaScript 25.4%
  • HTML 4.5%
  • CSS 0.3%
  • Makefile 0.1%