Sample Smart Contracts

Oracle Blockchain Platform Enterprise Edition for Besu includes predeployed sample smart contracts.

To access the predeployed contracts, click Developer Tools in the service console, and then click Pre-deployed Contracts.

Select the Download menu for each contract to download the Solidity source code or the application binary interface (ABI). You can use this information to interact with deployed smart contracts by using RPC proxy API calls. You can also import the source code into a Solidity development environment such as Hardhat or Remix and make changes or enhancements as needed.

Hash Time-Locked Contract (HTLC)

This contract is deployed when you create an instance. The Hash Time-Locked Contract enables atomic exchanges of ETH and ERC-20 tokens, where a receiver claims a payment prior to a deadline or the payment is refunded to the sender. The contract supports the following operations.
  • Exchange ETH or ERC-20 tokens.
  • Lock funds for a receiver under a secret condition for a specified amount of time.
  • Claim locked funds by providing the correct secret before the lock expires.
  • Refund unclaimed locked funds to the sender after the lock expires.
  • Get the status of a locked exchange, including whether is has been claimed or refunded, the locked amount, and the lock deadline.

LockBox

This contract is deployed when you create an instance. The LockBox contract implements a time-locked vault that holds ETH and ERC-20 tokens and then releases the contents to a designated owner at a specific time. The contract supports the following operations.
  • Deposit funds into the vault by sending ETH directly or transferring ERC-20 tokens.
  • Get vault details, including who the beneficiary/owner is, what the release time is, and what tokens/ETH are in the vault. Any user can get this information.
  • Release funds at a specified time. After the specified time stamp, the owner can call the release action to retrieve the funds.