-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 1214-migrate-lz-readme
# Conflicts: # lib/layer-zero/README.md
- Loading branch information
Showing
16 changed files
with
317 additions
and
38 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
...dera-token-service/examples/token-create/TokenCreateContract.sol/TokenCreateContract.json
Large diffs are not rendered by default.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
...-token-service/examples/token-create/TokenCreateCustom.sol/TokenCreateCustomContract.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
contracts/system-contracts/hedera-schedule-service/HederaScheduleService.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
17
contracts/system-contracts/hedera-schedule-service/IHRC755.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
9 changes: 9 additions & 0 deletions
9
contracts/system-contracts/hedera-schedule-service/IHRC755ScheduleFacade.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
30
contracts/system-contracts/hedera-schedule-service/IHRC756.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
42 changes: 42 additions & 0 deletions
42
contracts/system-contracts/hedera-schedule-service/IHederaScheduleService.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
21
contracts/system-contracts/hedera-schedule-service/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)` |
Oops, something went wrong.