generated from EthSign/hardhat-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for external NFT as FutureToken
- Loading branch information
Showing
5 changed files
with
215 additions
and
44 deletions.
There are no files selected for viewing
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,58 @@ | ||
// SPDX-License-Identifier: AGPL v3 | ||
pragma solidity ^0.8.20; | ||
|
||
import {TokenTableUnlockerV2} from "../../TokenTableUnlockerV2.sol"; | ||
import {Actual, Preset} from "../../../interfaces/TokenTableUnlockerV2DataModels.sol"; | ||
|
||
contract TTUV2ExternalFT is TokenTableUnlockerV2 { | ||
error Unsupported(); | ||
|
||
function createActuals( | ||
uint256[] calldata actualIds, | ||
Actual[] calldata actuals_, | ||
uint256[] calldata recipientIds, | ||
uint256 batchId, | ||
bytes calldata | ||
) external virtual onlyOwner { | ||
TokenTableUnlockerV2Storage | ||
storage $ = _getTokenTableUnlockerV2Storage(); | ||
if (!$.isCreateable) revert NotPermissioned(); | ||
for (uint256 i = 0; i < actualIds.length; i++) { | ||
_createActual(actualIds[i], actuals_[i], recipientIds[i], batchId); | ||
} | ||
_callHook(_msgData()); | ||
} | ||
|
||
function createActuals( | ||
address[] calldata, | ||
Actual[] calldata, | ||
uint256[] calldata, | ||
uint256, | ||
bytes calldata | ||
) external pure virtual override { | ||
revert Unsupported(); | ||
} | ||
|
||
function _createActual( | ||
uint256 actualId, | ||
Actual memory actual, | ||
uint256 recipientId, | ||
uint256 batchId | ||
) internal virtual { | ||
TokenTableUnlockerV2Storage | ||
storage $ = _getTokenTableUnlockerV2Storage(); | ||
address recipient = $.futureToken.ownerOf(actualId); | ||
Preset storage preset = $._presets[actual.presetId]; | ||
if (_presetIsEmpty(preset)) revert PresetDoesNotExist(); | ||
if (actual.amountClaimed >= actual.totalAmount) | ||
revert InvalidSkipAmount(); | ||
$.actuals[actualId] = actual; | ||
emit ActualCreated( | ||
actual.presetId, | ||
actualId, | ||
recipient, | ||
recipientId, | ||
batchId | ||
); | ||
} | ||
} |
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
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
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
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