Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add missing comments, remove redundant assertion & create3 deployer #32

Merged
merged 2 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions contracts/StoryProtocolGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ contract StoryProtocolGateway is IStoryProtocolGateway, ERC721Holder, AccessMana
/// @param derivData The derivative data to be used for registerDerivative.
/// @param nftMetadata OPTIONAL. The desired metadata for the newly minted NFT.
/// @param ipMetadata OPTIONAL. The desired metadata for the newly registered IP.
/// @param recipient The address to receive the minted NFT.
/// @return ipId The ID of the registered IP.
/// @return tokenId The ID of the minted NFT.
function mintAndRegisterIpAndMakeDerivative(
Expand Down Expand Up @@ -556,6 +557,7 @@ contract StoryProtocolGateway is IStoryProtocolGateway, ERC721Holder, AccessMana
/// @param licenseTemplate The address of the license template.
/// @param licenseTermsId The ID of the license terms for the parent IP.
/// @param amount The amount of licenses to mint.
/// @return The mint fee for the given parent IP.
function _getMintFeeForSingleParent(
address childIpId,
address parentIpId,
Expand Down
1 change: 1 addition & 0 deletions contracts/interfaces/IStoryProtocolGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ interface IStoryProtocolGateway {
/// @param derivData The derivative data to be used for registerDerivative.
/// @param nftMetadata OPTIONAL. The desired metadata for the newly minted NFT.
/// @param ipMetadata OPTIONAL. The desired metadata for the newly registered IP.
/// @param recipient The address to receive the minted NFT.
/// @return ipId The ID of the registered IP.
/// @return tokenId The ID of the minted NFT.
function mintAndRegisterIpAndMakeDerivative(
Expand Down
19 changes: 3 additions & 16 deletions script/UpgradeSPGNFT.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pragma solidity ^0.8.23;

import { console2 } from "forge-std/console2.sol";
import { Script } from "forge-std/Script.sol";
import { ICreate3Deployer } from "@create3-deployer/contracts/Create3Deployer.sol";

import { UpgradeableBeacon } from "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol";

Expand All @@ -19,9 +18,6 @@ import { JsonDeploymentHandler } from "./utils/JsonDeploymentHandler.s.sol";
contract UpgradeSPGNFT is Script, StoryProtocolPeripheryAddressManager, BroadcastManager, JsonDeploymentHandler {
using StringUtil for uint256;

ICreate3Deployer private constant create3Deployer = ICreate3Deployer(0x384a891dFDE8180b054f04D66379f16B7a678Ad6);
uint256 private constant create3SaltSeed = 12;

StoryProtocolGateway private spg;
SPGNFT private spgNftImpl;
UpgradeableBeacon private spgNftBeacon;
Expand All @@ -38,7 +34,7 @@ contract UpgradeSPGNFT is Script, StoryProtocolPeripheryAddressManager, Broadcas
spgNftBeacon = UpgradeableBeacon(spgNftBeaconAddr);

_beginBroadcast();
_deploySPGNFT(deployer);
_deploySPGNFT();

// Upgrade the collections via multisig (can't do here).
// spg.upgradeCollections(address(spgNftImpl));
Expand All @@ -47,17 +43,12 @@ contract UpgradeSPGNFT is Script, StoryProtocolPeripheryAddressManager, Broadcas
_endBroadcast();
}

function _deploySPGNFT(address accessControlDeployer) private {
function _deploySPGNFT() private {
_writeAddress("SPG", address(spg));
_writeAddress("SPGNFTBeacon", address(spgNftBeacon));

_predeploy("SPGNFTImpl");
spgNftImpl = SPGNFT(
create3Deployer.deploy(
_getSalt(type(SPGNFT).name),
abi.encodePacked(type(SPGNFT).creationCode, abi.encode(address(spg)))
)
);
spgNftImpl = new SPGNFT(address(spg));
_postdeploy("SPGNFTImpl", address(spgNftImpl));
}

Expand All @@ -69,8 +60,4 @@ contract UpgradeSPGNFT is Script, StoryProtocolPeripheryAddressManager, Broadcas
_writeAddress(contractKey, newAddress);
console2.log(string.concat(contractKey, " deployed to:"), newAddress);
}

function _getSalt(string memory name) private view returns (bytes32 salt) {
salt = keccak256(abi.encode(name, create3SaltSeed));
}
}
1 change: 0 additions & 1 deletion test/StoryProtocolGateway.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,6 @@ contract StoryProtocolGatewayTest is BaseTest {
assertTrue(ipAssetRegistry.isRegistered(ipIdChild));
assertEq(tokenIdChild, 2);
assertMetadata(ipIdChild, ipMetadataDefault);
assertMetadata(ipIdChild, ipMetadataDefault);
(address licenseTemplateChild, uint256 licenseTermsIdChild) = licenseRegistry.getAttachedLicenseTerms(
ipIdChild,
0
Expand Down
Loading