HSSAdapterLib
Title: HSSAdapterLib
Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Modified from hiero-ledger/hiero-contracts (https://github.com/hiero-ledger/hiero-contracts)
Logic + ERC-7201 storage for the diamond's use of the Hedera Schedule Service.
scheduleCall makes the CALLING CONTRACT the schedule payer and the schedule's admin key, so the
diamond funds execution from its own HBAR and can delete what it scheduled. When the network fires the
call, the diamond is the sender — a self-scheduled callback therefore sees msg.sender == address(this),
which checkScheduledSelfCall uses as its guard.
Functions
hssAdapterStorage
function hssAdapterStorage() internal pure returns (HSSAdapterStorage storage $);Returns
| Name | Type | Description |
|---|---|---|
| $ | HSSAdapterStorage |
__HSSAdapter_init
function __HSSAdapter_init() internal;registerInterface
function registerInterface() internal;hasScheduleCapacity
function hasScheduleCapacity(uint256 expirySecond, uint256 gasLimit) internal view returns (bool);Parameters
| Name | Type | Description |
|---|---|---|
| expirySecond | uint256 | |
| gasLimit | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool |
scheduleOf
function scheduleOf(bytes32 jobId) internal view returns (address);Parameters
| Name | Type | Description |
|---|---|---|
| jobId | bytes32 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | address |
checkScheduledSelfCall
Reverts unless the current frame is the diamond executing its own scheduled call.
function checkScheduledSelfCall() internal view;scheduleCall
function scheduleCall(address to, uint256 expirySecond, uint256 gasLimit, uint64 value, bytes calldata data)
internal
returns (address scheduleAddress);Parameters
| Name | Type | Description |
|---|---|---|
| to | address | |
| expirySecond | uint256 | |
| gasLimit | uint256 | |
| value | uint64 | |
| data | bytes |
Returns
| Name | Type | Description |
|---|---|---|
| scheduleAddress | address |
scheduleSelfCall
function scheduleSelfCall(bytes32 jobId, uint256 expirySecond, uint256 gasLimit, bytes calldata data)
internal
returns (address scheduleAddress);Parameters
| Name | Type | Description |
|---|---|---|
| jobId | bytes32 | |
| expirySecond | uint256 | |
| gasLimit | uint256 | |
| data | bytes |
Returns
| Name | Type | Description |
|---|---|---|
| scheduleAddress | address |
completeSelfCall
The ONLY path that clears jobId. See the stranding limitation on
IHSSAdapter.scheduleSelfCall: a schedule that is deleted or expires unfired leaves its job
permanently occupied, because nothing else may write this mapping.
function completeSelfCall(bytes32 jobId) internal;Parameters
| Name | Type | Description |
|---|---|---|
| jobId | bytes32 |
deleteSchedule
function deleteSchedule(address scheduleAddress) internal;Parameters
| Name | Type | Description |
|---|---|---|
| scheduleAddress | address |
authorizeSchedule
function authorizeSchedule(address scheduleAddress) internal;Parameters
| Name | Type | Description |
|---|---|---|
| scheduleAddress | address |
_schedule
function _schedule(address to, uint256 expirySecond, uint256 gasLimit, uint64 value, bytes calldata data)
private
returns (address scheduleAddress);Parameters
| Name | Type | Description |
|---|---|---|
| to | address | |
| expirySecond | uint256 | |
| gasLimit | uint256 | |
| value | uint64 | |
| data | bytes |
Returns
| Name | Type | Description |
|---|---|---|
| scheduleAddress | address |
_callForCode
function _callForCode(bytes memory data) private returns (int64 code);Parameters
| Name | Type | Description |
|---|---|---|
| data | bytes |
Returns
| Name | Type | Description |
|---|---|---|
| code | int64 |