-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a dynamic launcher that allows the creator to update the metadata…
… just before mint. The update has to be signed by the creators private key, to make sure they intend it. This can be used to dynamically mint NFTs while limiting the number of NFTs in a collection and not require a DID spend for every NFT.
- Loading branch information
Showing
5 changed files
with
268 additions
and
26 deletions.
There are no files selected for viewing
103 changes: 103 additions & 0 deletions
103
secure_the_mint/puzzles/secure_the_mint_dynamic_launcher.clsp
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,103 @@ | ||
(mod (SINGLETON_MOD_HASH SINGLETON_LAUNCHER_PUZHASH | ||
NFT_STATE_LAYER_MOD_HASH METADATA_HASH METADATA_UPDATER_PUZZLE_HASH | ||
NFT_OWNERSHIP_LAYER_MOD_HASH | ||
NFT_OWNERSHIP_TRANSFER_PROGRAM_MOD_HASH ROYALTY_ADDRESS TRADE_PRICE_PERCENTAGE | ||
P2_PUZZLE_HASH | ||
CREATOR_PUBLIC_KEY | ||
mode ; 1 for mint, 0 for melt | ||
my_id | ||
updated_metadata_hash) | ||
(include condition_codes.clib) | ||
(include curry-and-treehash.clib) | ||
|
||
(defun-inline nft_ownership_transfer_program_puzzle_hash (NFT_OWNERSHIP_TRANSFER_PROGRAM_MOD_HASH SINGLETON_STRUCT ROYALTY_ADDRESS TRADE_PRICE_PERCENTAGE) | ||
(puzzle-hash-of-curried-function NFT_OWNERSHIP_TRANSFER_PROGRAM_MOD_HASH | ||
(sha256 ONE TRADE_PRICE_PERCENTAGE) | ||
(sha256 ONE ROYALTY_ADDRESS) | ||
(sha256tree SINGLETON_STRUCT) | ||
) | ||
) | ||
|
||
(defun-inline nft_ownership_layer_puzzle_hash (NFT_OWNERSHIP_LAYER_MOD_HASH CURRENT_OWNER TRANSFER_PROGRAM_HASH inner_puzzle_hash) | ||
(puzzle-hash-of-curried-function NFT_OWNERSHIP_LAYER_MOD_HASH | ||
inner_puzzle_hash | ||
TRANSFER_PROGRAM_HASH | ||
(sha256 ONE CURRENT_OWNER) | ||
(sha256 ONE NFT_OWNERSHIP_LAYER_MOD_HASH) | ||
) | ||
) | ||
|
||
(defun-inline nft_state_layer_puzzle_hash (NFT_STATE_LAYER_MOD_HASH METADATA_HASH METADATA_UPDATER_PUZZLE_HASH inner_puzzle_hash) | ||
(puzzle-hash-of-curried-function NFT_STATE_LAYER_MOD_HASH | ||
inner_puzzle_hash | ||
(sha256 ONE METADATA_UPDATER_PUZZLE_HASH) | ||
METADATA_HASH | ||
(sha256 ONE NFT_STATE_LAYER_MOD_HASH) | ||
) | ||
) | ||
|
||
(defun-inline calculate_singleton_puzzle_hash (SINGLETON_STRUCT inner_puzzle_hash) | ||
(puzzle-hash-of-curried-function (f SINGLETON_STRUCT) | ||
inner_puzzle_hash | ||
(sha256tree SINGLETON_STRUCT) | ||
) | ||
) | ||
|
||
(defun-inline calculate_full_puzzle_hash | ||
(SINGLETON_STRUCT | ||
NFT_STATE_LAYER_MOD_HASH METADATA_HASH METADATA_UPDATER_PUZZLE_HASH | ||
NFT_OWNERSHIP_LAYER_MOD_HASH | ||
NFT_OWNERSHIP_TRANSFER_PROGRAM_MOD_HASH ROYALTY_ADDRESS TRADE_PRICE_PERCENTAGE | ||
inner_puzzle_hash | ||
) | ||
(calculate_singleton_puzzle_hash | ||
SINGLETON_STRUCT | ||
(nft_state_layer_puzzle_hash | ||
NFT_STATE_LAYER_MOD_HASH | ||
METADATA_HASH | ||
METADATA_UPDATER_PUZZLE_HASH | ||
(nft_ownership_layer_puzzle_hash | ||
NFT_OWNERSHIP_LAYER_MOD_HASH | ||
() | ||
(nft_ownership_transfer_program_puzzle_hash | ||
NFT_OWNERSHIP_TRANSFER_PROGRAM_MOD_HASH | ||
SINGLETON_STRUCT | ||
ROYALTY_ADDRESS | ||
TRADE_PRICE_PERCENTAGE | ||
) | ||
inner_puzzle_hash | ||
) | ||
) | ||
) | ||
) | ||
|
||
|
||
(if mode | ||
(list ; mint | ||
(list ASSERT_MY_COIN_ID my_id) | ||
(list CREATE_COIN SINGLETON_LAUNCHER_PUZHASH 1) | ||
(list ASSERT_COIN_ANNOUNCEMENT | ||
(sha256 | ||
(calculate_coin_id my_id SINGLETON_LAUNCHER_PUZHASH 1) | ||
(sha256tree | ||
(list | ||
(calculate_full_puzzle_hash | ||
(c SINGLETON_MOD_HASH (c (calculate_coin_id my_id SINGLETON_LAUNCHER_PUZHASH 1) SINGLETON_LAUNCHER_PUZHASH)) | ||
NFT_STATE_LAYER_MOD_HASH (if updated_metadata_hash updated_metadata_hash METADATA_HASH) METADATA_UPDATER_PUZZLE_HASH | ||
NFT_OWNERSHIP_LAYER_MOD_HASH | ||
NFT_OWNERSHIP_TRANSFER_PROGRAM_MOD_HASH ROYALTY_ADDRESS TRADE_PRICE_PERCENTAGE | ||
P2_PUZZLE_HASH | ||
) | ||
1 | ||
() | ||
) | ||
) | ||
) | ||
) | ||
(if updated_metadata_hash (list AGG_SIG_ME CREATOR_PUBLIC_KEY updated_metadata_hash) (list REMARK)) | ||
) | ||
(list ; melt | ||
(list AGG_SIG_ME CREATOR_PUBLIC_KEY 1) | ||
) | ||
) | ||
) |
1 change: 1 addition & 0 deletions
1
secure_the_mint/puzzles/secure_the_mint_dynamic_launcher.clsp.hex
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 @@ | ||
ff02ffff01ff02ffff03ff822fffffff01ff04ffff04ff38ffff04ff825fffff808080ffff04ffff04ff34ffff04ff0bffff01ff01808080ffff04ffff04ff28ffff04ffff0bffff02ff36ffff04ff02ffff04ff825fffffff04ff0bffff01ff018080808080ffff02ff3effff04ff02ffff04ffff04ffff02ff2effff04ff02ffff04ff05ffff04ffff02ff2effff04ff02ffff04ff17ffff04ffff02ff2effff04ff02ffff04ff81bfffff04ff820bffffff04ffff02ff2effff04ff02ffff04ff82017fffff04ffff0bff3cff8205ff80ffff04ffff0bff3cff8202ff80ffff04ffff02ff3effff04ff02ffff04ffff04ff05ffff04ffff02ff36ffff04ff02ffff04ff825fffffff04ff0bffff01ff018080808080ff0b8080ff80808080ff80808080808080ffff04ffff0bff3cff8080ffff04ffff0bff3cff81bf80ff8080808080808080ffff04ffff0bff3cff5f80ffff04ffff02ffff03ff82bfffffff0182bfffffff012f80ff0180ffff04ffff0bff3cff1780ff8080808080808080ffff04ffff02ff3effff04ff02ffff04ffff04ff05ffff04ffff02ff36ffff04ff02ffff04ff825fffffff04ff0bffff01ff018080808080ff0b8080ff80808080ff808080808080ffff01ff01ff808080ff8080808080ff808080ffff04ffff02ffff03ff82bfffffff01ff04ff10ffff04ff8217ffffff04ff82bfffff80808080ffff01ff04ff32ff808080ff0180ff8080808080ffff01ff04ffff04ff10ffff04ff8217ffffff01ff01808080ff808080ff0180ffff04ffff01ffffff32ff3d46ffff0233ff0401ffffff0101ff0220ffffff02ffff03ff05ffff01ff02ff26ffff04ff02ffff04ff0dffff04ffff0bff2affff0bff3cff2c80ffff0bff2affff0bff2affff0bff3cff2280ff0980ffff0bff2aff0bffff0bff3cff8080808080ff8080808080ffff010b80ff0180ff02ffff03ffff22ffff09ffff0dff0580ff3a80ffff09ffff0dff0b80ff3a80ffff15ff17ffff0181ff8080ffff01ff0bff05ff0bff1780ffff01ff088080ff0180ffff0bff2affff0bff3cff2480ffff0bff2affff0bff2affff0bff3cff2280ff0580ffff0bff2affff02ff26ffff04ff02ffff04ff07ffff04ffff0bff3cff3c80ff8080808080ffff0bff3cff8080808080ff02ffff03ffff07ff0580ffff01ff0bffff0102ffff02ff3effff04ff02ffff04ff09ff80808080ffff02ff3effff04ff02ffff04ff0dff8080808080ffff01ff0bffff0101ff058080ff0180ff018080 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
hash,uris,meta_hash,meta_uris,license_hash,license_uris,edition_number,edition_total | ||
1513fdebd3534ac65adb0c66c95f0ad26daf9179ee42fe6749e3fbbf91129c2a,https://picsum.photos/367/812,19cd52eb2b39627f6a6d1be24bf514f7a25004ab9f5809787846b2d212dd9a30,http://www.ford.com/,873e895e1224a52738c8a63ffc34a1ac134d93feac0fce77a862015ccabb4dfb,http://www.sanchez.net/,1,1 | ||
326c3fa53129a7e09a225261a3f2eb1075afa276027daeb891169821e453b40d,https://dummyimage.com/81x681,6fdcc8e1c0d8ae548d87a2cef119f95dad674e35e8eeaeb142ac50c64d45a75b,https://lynch.biz/,060f7bb447554b03a6888912981088cec1c5b72c9dd6c50d74152a7a9d476abd,http://vincent-williams.com/,1,1 | ||
dd59fa90fa0fac296160f2cac9b1ed8d653e846838676cef39a375ed404f299b,https://dummyimage.com/75x723,64819a3d7a205b8a8e8b986f7d283d1b01caa3b08fe6abd145ee3fee215fbba2,http://cannon-perkins.com/,bd05c1fa2c4f46e28c4ae98135040d019a8eeb6876a0ed45092e03cb045d9cb7,http://www.hicks-saunders.com/,1,1 |
Oops, something went wrong.