Skip to content

Commit

Permalink
Merge branch 'main' into 1214-migrate-lz-readme
Browse files Browse the repository at this point in the history
# Conflicts:
#	lib/layer-zero/README.md
  • Loading branch information
natanasow committed Jan 29, 2025
2 parents d174b65 + c871341 commit faa8c46
Show file tree
Hide file tree
Showing 16 changed files with 317 additions and 38 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

20 changes: 15 additions & 5 deletions contracts-abi/contracts/wrapped-tokens/WHBAR.sol/WHBAR.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
[
{
"inputs": [],
"name": "InsufficientAllowance",
"type": "error"
},
{
"inputs": [],
"name": "InsufficientFunds",
"type": "error"
},
{
"anonymous": false,
"inputs": [
Expand Down Expand Up @@ -95,20 +105,20 @@
"inputs": [
{
"internalType": "address",
"name": "",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "",
"name": "spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"name": "amount",
"type": "uint256"
}
],
Expand Down Expand Up @@ -143,15 +153,15 @@
"inputs": [
{
"internalType": "address",
"name": "",
"name": "user",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"name": "balance",
"type": "uint256"
}
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.5.0 <0.9.0;
pragma experimental ABIEncoderV2;

import "../HederaResponseCodes.sol";
import "./IHederaScheduleService.sol";

abstract contract HederaScheduleService {
address constant scheduleSystemContractAddress = address(0x16b);

/// Authorizes the calling contract as a signer to the schedule transaction.
/// @param schedule the address of the schedule transaction.
/// @return responseCode The response code for the status of the request. SUCCESS is 22.
function authorizeSchedule(address schedule) internal returns (int64 responseCode) {
(bool success, bytes memory result) = scheduleSystemContractAddress.call(
abi.encodeWithSelector(IHederaScheduleService.authorizeSchedule.selector, schedule));
responseCode = success ? abi.decode(result, (int64)) : HederaResponseCodes.UNKNOWN;
}

/// Allows for the signing of a schedule transaction given a protobuf encoded signature map
/// The message signed by the keys is defined to be the concatenation of the shard, realm, and schedule transaction ID.
/// @param schedule the address of the schedule transaction.
/// @param signatureMap the protobuf encoded signature map
/// @return responseCode The response code for the status of the request. SUCCESS is 22.
function signSchedule(address schedule, bytes memory signatureMap) internal returns (int64 responseCode) {
(bool success, bytes memory result) = scheduleSystemContractAddress.call(
abi.encodeWithSelector(IHederaScheduleService.signSchedule.selector, schedule, signatureMap));
responseCode = success ? abi.decode(result, (int64)) : HederaResponseCodes.UNKNOWN;
}

/// Allows for the creation of a schedule transaction for given a system contract address, abi encoded call data and payer address
/// Currently supports the Hedera Token Service System Contract (0x167) with encoded call data for
/// createFungibleToken, createNonFungibleToken, createFungibleTokenWithCustomFees, createNonFungibleTokenWithCustomFees
/// and updateToken functions
/// @param systemContractAddress the address of the system contract from which to create the schedule transaction
/// @param callData the abi encoded call data for the system contract function
/// @param payer the address of the account that will pay for the schedule transaction
/// @return responseCode The response code for the status of the request. SUCCESS is 22.
/// @return scheduleAddress The address of the newly created schedule transaction.
function scheduleNative(address systemContractAddress, bytes memory callData, address payer) internal returns (int64 responseCode, address scheduleAddress) {
(bool success, bytes memory result) = scheduleSystemContractAddress.call(
abi.encodeWithSelector(IHederaScheduleService.scheduleNative.selector, systemContractAddress, callData, payer));
(responseCode, scheduleAddress) = success ? abi.decode(result, (int64, address)) : (int64(HederaResponseCodes.UNKNOWN), address(0));
}

/// Returns the token information for a scheduled fungible token create transaction
/// @param scheduleAddress the address of the schedule transaction
/// @return responseCode The response code for the status of the request. SUCCESS is 22.
/// @return fungibleTokenInfo The token information for the scheduled fungible token create transaction
function getScheduledCreateFungibleTokenInfo(address scheduleAddress) internal returns (int64 responseCode, IHederaTokenService.FungibleTokenInfo memory fungibleTokenInfo) {
(bool success, bytes memory result) = scheduleSystemContractAddress.call(
abi.encodeWithSelector(IHederaScheduleService.getScheduledCreateFungibleTokenInfo.selector, scheduleAddress));
IHederaTokenService.FungibleTokenInfo memory defaultTokenInfo;
(responseCode, fungibleTokenInfo) = success ? abi.decode(result, (int64, IHederaTokenService.FungibleTokenInfo)) : (int64(HederaResponseCodes.UNKNOWN), defaultTokenInfo);
}

/// Returns the token information for a scheduled non fungible token create transaction
/// @param scheduleAddress the address of the schedule transaction
/// @return responseCode The response code for the status of the request. SUCCESS is 22.
/// @return nonFungibleTokenInfo The token information for the scheduled non fungible token create transaction
function getScheduledCreateNonFungibleTokenInfo(address scheduleAddress) internal returns (int64 responseCode, IHederaTokenService.NonFungibleTokenInfo memory nonFungibleTokenInfo) {
(bool success, bytes memory result) = scheduleSystemContractAddress.call(
abi.encodeWithSelector(IHederaScheduleService.getScheduledCreateNonFungibleTokenInfo.selector, scheduleAddress));
IHederaTokenService.NonFungibleTokenInfo memory defaultTokenInfo;
(responseCode, nonFungibleTokenInfo) = success ? abi.decode(result, (int64, IHederaTokenService.NonFungibleTokenInfo)) : (int64(HederaResponseCodes.UNKNOWN), defaultTokenInfo);
}
}
17 changes: 17 additions & 0 deletions contracts/system-contracts/hedera-schedule-service/IHRC755.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.4.9 <0.9.0;
pragma experimental ABIEncoderV2;

interface IHRC755 {
/// Authorizes the calling contract as a signer to the schedule transaction.
/// @param schedule the address of the schedule transaction.
/// @return responseCode The response code for the status of the request. SUCCESS is 22.
function authorizeSchedule(address schedule) external returns (int64 responseCode);

/// Allows for the signing of a schedule transaction given a protobuf encoded signature map
/// The message signed by the keys is defined to be the concatenation of the shard, realm, and schedule transaction ID.
/// @param schedule the address of the schedule transaction.
/// @param signatureMap the protobuf encoded signature map
/// @return responseCode The response code for the status of the request. SUCCESS is 22.
function signSchedule(address schedule, bytes memory signatureMap) external returns (int64 responseCode);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.4.9 <0.9.0;
pragma experimental ABIEncoderV2;

interface IHRC755ScheduleFacade {
/// Signs the targeted schedule transaction with the key of the calling EOA.
/// @return responseCode The response code for the status of the request. SUCCESS is 22.
function signSchedule() external returns (int64 responseCode);
}
30 changes: 30 additions & 0 deletions contracts/system-contracts/hedera-schedule-service/IHRC756.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.4.9 <0.9.0;
pragma experimental ABIEncoderV2;

import "../hedera-token-service/IHederaTokenService.sol";

interface IHRC756 {
/// Allows for the creation of a schedule transaction for given a system contract address, abi encoded call data and payer address
/// Currently supports the Hedera Token Service System Contract (0x167) with encoded call data for
/// createFungibleToken, createNonFungibleToken, createFungibleTokenWithCustomFees, createNonFungibleTokenWithCustomFees
/// and updateToken functions
/// @param systemContractAddress the address of the system contract from which to create the schedule transaction
/// @param callData the abi encoded call data for the system contract function
/// @param payer the address of the account that will pay for the schedule transaction
/// @return responseCode The response code for the status of the request. SUCCESS is 22.
/// @return scheduleAddress The address of the newly created schedule transaction.
function scheduleNative(address systemContractAddress, bytes memory callData, address payer) external returns (int64 responseCode, address scheduleAddress);

/// Returns the token information for a scheduled fungible token create transaction
/// @param scheduleAddress the address of the schedule transaction
/// @return responseCode The response code for the status of the request. SUCCESS is 22.
/// @return fungibleTokenInfo The token information for the scheduled fungible token create transaction
function getScheduledCreateFungibleTokenInfo(address scheduleAddress) external returns (int64 responseCode, IHederaTokenService.FungibleTokenInfo memory fungibleTokenInfo);

/// Returns the token information for a scheduled non fungible token create transaction
/// @param scheduleAddress the address of the schedule transaction
/// @return responseCode The response code for the status of the request. SUCCESS is 22.
/// @return nonFungibleTokenInfo The token information for the scheduled non fungible token create transaction
function getScheduledCreateNonFungibleTokenInfo(address scheduleAddress) external returns (int64 responseCode, IHederaTokenService.NonFungibleTokenInfo memory nonFungibleTokenInfo);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.4.9 <0.9.0;
pragma experimental ABIEncoderV2;

import "../hedera-token-service/IHederaTokenService.sol";
interface IHederaScheduleService {

/// Authorizes the calling contract as a signer to the schedule transaction.
/// @param schedule the address of the schedule transaction.
/// @return responseCode The response code for the status of the request. SUCCESS is 22.
function authorizeSchedule(address schedule) external returns (int64 responseCode);

/// Allows for the signing of a schedule transaction given a protobuf encoded signature map
/// The message signed by the keys is defined to be the concatenation of the shard, realm, and schedule transaction ID.
/// @param schedule the address of the schedule transaction.
/// @param signatureMap the protobuf encoded signature map
/// @return responseCode The response code for the status of the request. SUCCESS is 22.
function signSchedule(address schedule, bytes memory signatureMap) external returns (int64 responseCode);

/// Allows for the creation of a schedule transaction for a given system contract address, abi encoded call data and payer address
/// Currently supports the Hedera Token Service System Contract (0x167) with encoded call data for
/// createFungibleToken, createNonFungibleToken, createFungibleTokenWithCustomFees, createNonFungibleTokenWithCustomFees
/// and updateToken functions
/// @param systemContractAddress the address of the system contract from which to create the schedule transaction
/// @param callData the abi encoded call data for the system contract function
/// @param payer the address of the account that will pay for the schedule transaction
/// @return responseCode The response code for the status of the request. SUCCESS is 22.
/// @return scheduleAddress The address of the newly created schedule transaction.
function scheduleNative(address systemContractAddress, bytes memory callData, address payer) external returns (int64 responseCode, address scheduleAddress);

/// Returns the token information for a scheduled fungible token create transaction
/// @param scheduleAddress the address of the schedule transaction
/// @return responseCode The response code for the status of the request. SUCCESS is 22.
/// @return fungibleTokenInfo The token information for the scheduled fungible token create transaction
function getScheduledCreateFungibleTokenInfo(address scheduleAddress) external returns (int64 responseCode, IHederaTokenService.FungibleTokenInfo memory fungibleTokenInfo);

/// Returns the token information for a scheduled non fungible token create transaction
/// @param scheduleAddress the address of the schedule transaction
/// @return responseCode The response code for the status of the request. SUCCESS is 22.
/// @return nonFungibleTokenInfo The token information for the scheduled non fungible token create transaction
function getScheduledCreateNonFungibleTokenInfo(address scheduleAddress) external returns (int64 responseCode, IHederaTokenService.NonFungibleTokenInfo memory nonFungibleTokenInfo);
}
21 changes: 21 additions & 0 deletions contracts/system-contracts/hedera-schedule-service/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## Hedera Schedule Service (HSS) System Contract Functions

The Hedera Schedule Service (HSS) System Contract is accessible at address `0x16b` on the Hedera network. This contract interface introduces a new schedule transaction proxy contract to interact with other contracts for functionality such as creating and signing scheduled transactions. It also enables querying information about certain scheduled transactions.

The table below outlines the available Hedera Schedule Service System Contract functions:

| Function Name | Function Selector Hash | Consensus Node Release Version | HIP | Method Interface |
| ----------------- | ---------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------- | -------------------------------------------------------------------------- |
| `authorizeSchedule` | `0xf0637961` | [0.57](https://docs.hedera.com/hedera/networks/release-notes/services#release-v0.57) | [HIP 755](https://hips.hedera.com/hip/hip-755) | `authorizeSchedule(address schedule) external returns (int64 responseCode)` |
| `signSchedule` | `0x358eeb03` | [0.59](https://docs.hedera.com/hedera/networks/release-notes/services#release-v0.59) | [HIP 755](https://hips.hedera.com/hip/hip-755) | `signSchedule(address schedule, bytes memory signatureMap) external returns (int64 responseCode` |
| `scheduleNative` | `0xca829811` | [0.59](https://docs.hedera.com/hedera/networks/release-notes/services#release-v0.59) | [HIP 756](https://hips.hedera.com/hip/hip-756) | `scheduleNative(address systemContractAddress, bytes memory callData, address payer) external returns (int64 responseCode, address scheduleAddress)` |
| `getScheduledCreateFungibleTokenInfo` | `0xda2d5f8f` | [0.59](https://docs.hedera.com/hedera/networks/release-notes/services#release-v0.59) | [HIP 756](https://hips.hedera.com/hip/hip-756) | `getScheduledCreateFungibleTokenInfo(address scheduleAddress) external returns (int64 responseCode, IHederaTokenService.FungibleTokenInfo memory fungibleTokenInfo)` |
| `getScheduledCreateNonFungibleTokenInfo` | `0xd68c902c` | [0.59](https://docs.hedera.com/hedera/networks/release-notes/services#release-v0.59) | [HIP 756](https://hips.hedera.com/hip/hip-756) | `getScheduledCreateNonFungibleTokenInfo(address scheduleAddress) external returns (int64 responseCode, IHederaTokenService.NonFungibleTokenInfo memory nonFungibleTokenInfo)` |

The Hedera network also make facade contract calls available to EOAs for improved experience.
Facade function allow for EOAs to make calls without requiring a deployed contract
The table below outlines the available Hedera Schedule Service (HSS) System Contract facade functions:

| Function Name | Function Selector Hash | Consensus Node Release Version | HIP | Method Interface |
| -------------------------------------- | ---------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `signSchedule` | `0x06d15889` | [0.57](https://docs.hedera.com/hedera/networks/release-notes/services#release-v0.57) | [HIP 755](https://hips.hedera.com/hip/hip-755) | `signSchedule() external returns (int64 responseCode)`
Loading

0 comments on commit faa8c46

Please sign in to comment.