forked from storyprotocol/protocol-periphery
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(upgrade): add upgrade scripts for Story NFTs (#92)
* feat(upgrade): add upgrade scripts for story nfts * chore: nof new line * fix: rm duplicated code & invalid sig error * fix: update address printing logic
- Loading branch information
1 parent
534795d
commit e439da2
Showing
12 changed files
with
197 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,46 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.26; | ||
/* solhint-disable no-console */ | ||
|
||
// external | ||
import { console2 } from "forge-std/console2.sol"; | ||
|
||
// contracts | ||
import { StoryBadgeNFT } from "../../contracts/story-nft/StoryBadgeNFT.sol"; | ||
import { IStoryNFTFactory } from "../../contracts/interfaces/story-nft/IStoryNFTFactory.sol"; | ||
|
||
// script | ||
import { UpgradeHelper } from "../utils/upgrades/UpgradeHelper.s.sol"; | ||
|
||
contract UpdateDefaultStoryNFTTemplate is UpgradeHelper { | ||
uint256 public constant LICENSE_TERMS_ID = 1; | ||
|
||
/// @dev To use, run the following command (e.g., for Story Iliad testnet): | ||
/// forge script script/upgrade/UpdateDefaultStoryNFTTemplate.s.sol:UpdateDefaultStoryNFTTemplate \ | ||
/// --rpc-url=$TESTNET_URL -vvvv --broadcast --priority-gas-price=1 --legacy \ | ||
/// --verify --verifier=$VERIFIER_NAME --verifier-url=$VERIFIER_URL | ||
/// | ||
/// For detailed examples, see the documentation in `../../docs/DEPLOY_UPGRADE.md`. | ||
function run() public override { | ||
super.run(); | ||
_beginBroadcast(); | ||
_updateDefaultStoryNFTTemplate(); | ||
_writeDeployment(); | ||
_endBroadcast(); | ||
} | ||
|
||
function _updateDefaultStoryNFTTemplate() private { | ||
_predeploy("DefaultStoryNftTemplate"); | ||
StoryBadgeNFT newDefaultStoryNftTemplate = new StoryBadgeNFT( | ||
ipAssetRegistryAddr, | ||
licensingModuleAddr, | ||
orgNftAddr, | ||
pilTemplateAddr, | ||
LICENSE_TERMS_ID | ||
); | ||
IStoryNFTFactory(storyNftFactoryAddr).setDefaultStoryNftTemplate(address(newDefaultStoryNftTemplate)); | ||
defaultStoryNftTemplateAddr = address(newDefaultStoryNftTemplate); | ||
console2.log("DefaultStoryNftTemplate deployed to: ", defaultStoryNftTemplateAddr); | ||
_writeAllAddresses(); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.26; | ||
/* solhint-disable no-console */ | ||
|
||
// external | ||
import { console2 } from "forge-std/console2.sol"; | ||
|
||
// contracts | ||
import { OrgNFT } from "../../contracts/story-nft/OrgNFT.sol"; | ||
|
||
// script | ||
import { UpgradeHelper } from "../utils/upgrades/UpgradeHelper.s.sol"; | ||
|
||
contract UpgradeOrgNFT is UpgradeHelper { | ||
uint256 public constant LICENSE_TERMS_ID = 1; | ||
|
||
/// @dev To use, run the following command (e.g., for Story Iliad testnet): | ||
/// forge script script/upgrade/UpgradeOrgNFT.s.sol:UpgradeOrgNFT \ | ||
/// --rpc-url=$TESTNET_URL -vvvv --broadcast --priority-gas-price=1 --legacy \ | ||
/// --verify --verifier=$VERIFIER_NAME --verifier-url=$VERIFIER_URL | ||
/// | ||
/// For detailed examples, see the documentation in `../../docs/DEPLOY_UPGRADE.md`. | ||
function run() public override { | ||
super.run(); | ||
_beginBroadcast(); | ||
_upgradeOrgNFT(); | ||
_writeDeployment(); | ||
_endBroadcast(); | ||
} | ||
|
||
function _upgradeOrgNFT() private { | ||
_predeploy("OrgNFT"); | ||
OrgNFT newOrgNft = new OrgNFT( | ||
ipAssetRegistryAddr, | ||
licensingModuleAddr, | ||
storyNftFactoryAddr, | ||
pilTemplateAddr, | ||
LICENSE_TERMS_ID | ||
); | ||
console2.log("New OrgNFT implementation: ", address(newOrgNft)); | ||
console2.log("OrgNFT deployed to: ", orgNftAddr); | ||
_writeAllAddresses(); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.26; | ||
/* solhint-disable no-console */ | ||
|
||
// external | ||
import { console2 } from "forge-std/console2.sol"; | ||
|
||
// contracts | ||
import { StoryNFTFactory } from "../../contracts/story-nft/StoryNFTFactory.sol"; | ||
|
||
// script | ||
import { UpgradeHelper } from "../utils/upgrades/UpgradeHelper.s.sol"; | ||
|
||
contract UpgradeStoryNFTFactory is UpgradeHelper { | ||
uint256 public constant LICENSE_TERMS_ID = 1; | ||
|
||
/// @dev To use, run the following command (e.g., for Story Iliad testnet): | ||
/// forge script script/upgrade/UpgradeStoryNFTFactory.s.sol:UpgradeStoryNFTFactory \ | ||
/// --rpc-url=$TESTNET_URL -vvvv --broadcast --priority-gas-price=1 --legacy \ | ||
/// --verify --verifier=$VERIFIER_NAME --verifier-url=$VERIFIER_URL | ||
/// | ||
/// For detailed examples, see the documentation in `../../docs/DEPLOY_UPGRADE.md`. | ||
function run() public override { | ||
super.run(); | ||
_beginBroadcast(); | ||
_upgradeStoryNFTFactory(); | ||
_writeDeployment(); | ||
_endBroadcast(); | ||
} | ||
|
||
function _upgradeStoryNFTFactory() private { | ||
_predeploy("StoryNFTFactory"); | ||
StoryNFTFactory newStoryNftFactory = new StoryNFTFactory( | ||
ipAssetRegistryAddr, | ||
licensingModuleAddr, | ||
pilTemplateAddr, | ||
LICENSE_TERMS_ID, | ||
orgNftAddr | ||
); | ||
console2.log("New StoryNFTFactory implementation: ", address(newStoryNftFactory)); | ||
console2.log("StoryNFTFactory deployed to: ", storyNftFactoryAddr); | ||
_writeAllAddresses(); | ||
} | ||
} |
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