From 04c153bfb5d74c12a9ac9a7b76c0855853514451 Mon Sep 17 00:00:00 2001 From: Scott Date: Fri, 24 Jan 2025 01:25:29 +0800 Subject: [PATCH] refactor: token factory --- script/DeployTokenFactory.s.sol | 3 +- .../ISpotlightTokenFactory.sol | 59 ++++----- .../SpotlightTokenFactory.sol | 112 ++++++------------ .../SpotlightTokenFactoryStorage.sol | 16 +-- test/SpotlightTokenFactoryTest.t.sol | 84 +++++++------ test/SpotlightTokenTest.t.sol | 1 - 6 files changed, 111 insertions(+), 164 deletions(-) diff --git a/script/DeployTokenFactory.s.sol b/script/DeployTokenFactory.s.sol index 9a3ad9a..0ea5431 100644 --- a/script/DeployTokenFactory.s.sol +++ b/script/DeployTokenFactory.s.sol @@ -41,7 +41,6 @@ contract Deploy is Script { address private _STORY_DERIVATIVE_WORKFLOWS_ADDRESS = 0xa8815CEB96857FFb8f5F8ce920b1Ae6D70254C7B; address private _SPOTLIGHT_TOKEN_FACTORY_OWNER = 0x582d6944a8EA7e4ACD385D18DC95CF5915510289; - address private constant WRAPPER_IP = 0xe8CabF9d1FFB6CE23cF0a86641849543ec7BD7d5; address private constant PIPERX_V2_ROUTER = 0x8812d810EA7CC4e1c3FB45cef19D6a7ECBf2D85D; address private constant PIPERX_V2_FACTORY = 0x700722D24f9256Be288f56449E8AB1D27C4a70ca; @@ -77,13 +76,13 @@ contract Deploy is Script { address(tokenIpCollection), // tokenIpCollection_ address(spotlightTokenImpl), // tokenImplementation_ address(bondingCurve), // bondingCurve_ - WRAPPER_IP, _STORY_DERIVATIVE_WORKFLOWS_ADDRESS, // storyDerivativeWorkflows_ PIPERX_V2_ROUTER, // piperxV2Router_ PIPERX_V2_FACTORY, // piperxV2Factory_ address(protocolRewards) // protocolRewards_ ); tokenIpCollection.setTokenFactory(address(factoryProxy)); + tokenIpCollection.setMintEnabled(true); vm.stopBroadcast(); } } diff --git a/src/spotlight-token-factory/ISpotlightTokenFactory.sol b/src/spotlight-token-factory/ISpotlightTokenFactory.sol index 81a0ed5..37b88b8 100644 --- a/src/spotlight-token-factory/ISpotlightTokenFactory.sol +++ b/src/spotlight-token-factory/ISpotlightTokenFactory.sol @@ -68,11 +68,10 @@ interface ISpotlightTokenFactory { * @param tokenIpCollection_ The address of the token IP collection contract. * @param tokenImplementation_ The address of the token implementation contract. * @param bondingCurve_ The address of the bonding curve contract. - * @param baseToken_ The address of the base token. * @param storyDerivativeWorkflows_ The address of the story derivative workflows contract. * @param piperXRouter_ The address of the PiperX router contract. * @param piperXFactory_ The address of the PiperX factory contract. - * @param protocolRewards_ The address of the protocol rewards contract. + * @param rewardsVault_ The address of the reward vault contract. */ function initialize( address owner_, @@ -80,29 +79,27 @@ interface ISpotlightTokenFactory { address tokenIpCollection_, address tokenImplementation_, address bondingCurve_, - address baseToken_, address storyDerivativeWorkflows_, address piperXRouter_, address piperXFactory_, - address protocolRewards_ + address rewardsVault_ ) external; /** - * @dev Returns the address of the token factory owner. + * @dev Returns the fee amount required to create a token (in native token) */ - function owner() external view returns (address); + function createTokenFee() external view returns (uint256); /** - * @dev Returns the address of the token IP collection contract - * @notice The token IP collection contract must implement ISpotlightTokenIPCollection + * @dev Sets the fee amount required to create a token (in native token) */ - function tokenIpCollection() external view returns (address); + function setCreateTokenFee(uint256 newFee) external; /** - * @dev Sets the address of the token IP collection contract + * @dev Returns the address of the token IP collection contract * @notice The token IP collection contract must implement ISpotlightTokenIPCollection */ - function setTokenIpCollection(address newTokenIpCollection) external; + function tokenIpCollection() external view returns (address); /** * @dev Returns the address of the token implementation contract @@ -115,14 +112,14 @@ interface ISpotlightTokenFactory { function setTokenImplementation(address newTokenImplementation) external; /** - * @dev Returns the fee amount required to create a token (in native token) + * @dev Returns the address of the bonding curve contract */ - function createTokenFee() external view returns (uint256); + function bondingCurve() external view returns (address); /** - * @dev Sets the fee amount required to create a token (in native token) + * @dev Sets the address of the bonding curve contract */ - function setCreateTokenFee(uint256 newFee) external; + function setBondingCurve(address newBondingCurve) external; /** * @dev Returns the address of the story derivative workflows contract @@ -130,29 +127,19 @@ interface ISpotlightTokenFactory { function storyDerivativeWorkflows() external view returns (address); /** - * @dev Sets the address of the story derivative workflows contract - */ - function setStoryDerivativeWorkflows(address newStoryDerivativeWorkflows) external; - - /** - * @dev Returns the address of the base token - */ - function baseToken() external view returns (address); - - /** - * @dev Sets the address of the base token + * @dev Returns the address of the PiperX router contract */ - function setBaseToken(address newBaseToken) external; + function piperXRouter() external view returns (address); /** - * @dev Returns the address of the bonding curve contract + * @dev Returns the address of the PiperX factory contract */ - function bondingCurve() external view returns (address); + function piperXFactory() external view returns (address); /** - * @dev Sets the address of the bonding curve contract + * @dev Returns the address of the rewards vault contract */ - function setBindingCurve(address newBondingCurve) external; + function rewardsVault() external view returns (address); /** * @dev Computes the address of a token created by the specified token creator. @@ -170,7 +157,7 @@ interface ISpotlightTokenFactory { * @param ipMetadata Metadata for the intellectual property. See {IStoryDerivativeWorkflows-registerIpAndMakeDerivative}. * @param sigMetadata Signature data for token creation. See {IStoryDerivativeWorkflows-registerIpAndMakeDerivative}. * @param sigRegister Signature data for IP registration. See {IStoryDerivativeWorkflows-registerIpAndMakeDerivative}. - * @param specificAddress The address of the specific address to be used for the token creation. + * @param parentIPAccount The address of the Parent IP account to be used for the token creation. * * @return tokenAddress The address of the newly created token. * @return ipId The ID of the newly registered intellectual property. @@ -182,15 +169,9 @@ interface ISpotlightTokenFactory { StoryWorkflowStructs.IPMetadata calldata ipMetadata, StoryWorkflowStructs.SignatureData calldata sigMetadata, StoryWorkflowStructs.SignatureData calldata sigRegister, - address specificAddress + address parentIPAccount ) external payable returns (address tokenAddress, address ipId); - /** - * @dev Returns the quote for initial buying tokens - * @param tokensOut The number of tokens to be bought - */ - function getInitialBuyTokenQuote(uint256 tokensOut) external view returns (uint256); - /** * @dev Returns the number of tokens created by a token creator */ diff --git a/src/spotlight-token-factory/SpotlightTokenFactory.sol b/src/spotlight-token-factory/SpotlightTokenFactory.sol index d0fa90e..0bd6d1d 100644 --- a/src/spotlight-token-factory/SpotlightTokenFactory.sol +++ b/src/spotlight-token-factory/SpotlightTokenFactory.sol @@ -4,6 +4,7 @@ pragma solidity ^0.8.13; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol"; +import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import {ISpotlightTokenFactory} from "./ISpotlightTokenFactory.sol"; import {ISpotlightToken} from "../spotlight-token/ISpotlightToken.sol"; import {ISpotlightTokenIPCollection} from "../spotlight-token-collection/ISpotlightTokenIPCollection.sol"; @@ -13,22 +14,17 @@ import {SpotlightTokenFactoryStorage} from "./SpotlightTokenFactoryStorage.sol"; import {ISpotlightBondingCurve} from "../spotlight-bonding-curve/ISpotlightBondingCurve.sol"; import {MarketType} from "../spotlight-token/ISpotlightToken.sol"; -contract SpotlightTokenFactory is SpotlightTokenFactoryStorage, ISpotlightTokenFactory { +contract SpotlightTokenFactory is OwnableUpgradeable, SpotlightTokenFactoryStorage, ISpotlightTokenFactory { modifier needInitialized() { _checkIsInitialized(); _; } - modifier onlyOwner() { - _checkIsOwner(); - _; - } - /** * @dev See {ISpotlightTokenFactory-isInitialized}. */ function isInitialized() public view returns (bool) { - return _isInitialized; + return _getInitializedVersion() == 1; } /** @@ -40,54 +36,47 @@ contract SpotlightTokenFactory is SpotlightTokenFactoryStorage, ISpotlightTokenF address tokenIpCollection_, address tokenImplementation_, address bondingCurve_, - address baseToken_, address storyDerivativeWorkflows_, address piperXRouter_, address piperXFactory_, - address protocolRewards_ - ) external { - if (isInitialized()) { - revert("SpotlightTokenFactory: Already initialized"); - } - _owner = owner_; + address rewardsVault_ + ) external initializer { + __Ownable_init(owner_); _creationFee = creationFee_; _tokenIpCollection = tokenIpCollection_; _tokenImplementation = tokenImplementation_; _bondingCurve = bondingCurve_; - _baseToken = baseToken_; _storyDerivativeWorkflows = storyDerivativeWorkflows_; - - _isInitialized = true; _piperXRouter = piperXRouter_; _piperXFactory = piperXFactory_; - _protocolRewards = protocolRewards_; + _rewardsVault = rewardsVault_; } /** - * @dev See {ISpotlightTokenFactory-owner}. + * @dev See {ISpotlightTokenFactory-creationFee}. */ - function owner() public view needInitialized returns (address) { - return _owner; + function createTokenFee() public view returns (uint256) { + return _creationFee; } /** - * @dev See {ISpotlightTokenFactory-tokenIpCollection}. + * @dev See {ISpotlightTokenFactory-setCreateTokenFee}. */ - function tokenIpCollection() public view needInitialized returns (address) { - return _tokenIpCollection; + function setCreateTokenFee(uint256 newFee) external needInitialized onlyOwner { + _creationFee = newFee; } /** - * @dev See {ISpotlightTokenFactory-setTokenIpCollection}. + * @dev See {ISpotlightTokenFactory-tokenIpCollection}. */ - function setTokenIpCollection(address newTokenIpCollection) external needInitialized onlyOwner { - _tokenIpCollection = newTokenIpCollection; + function tokenIpCollection() public view returns (address) { + return _tokenIpCollection; } /** * @dev See {ISpotlightTokenFactory-tokenImplementation}. */ - function tokenImplementation() public view needInitialized returns (address) { + function tokenImplementation() public view returns (address) { return _tokenImplementation; } @@ -99,65 +88,51 @@ contract SpotlightTokenFactory is SpotlightTokenFactoryStorage, ISpotlightTokenF } /** - * @dev See {ISpotlightTokenFactory-creationFee}. + * @dev See {ISpotlightTokenFactory-bondingCurve}. */ - function createTokenFee() public view needInitialized returns (uint256) { - return _creationFee; + function bondingCurve() public view returns (address) { + return _bondingCurve; } /** - * @dev See {ISpotlightTokenFactory-setCreateTokenFee}. + * @dev See {ISpotlightTokenFactory-setBondingCurve}. */ - function setCreateTokenFee(uint256 newFee) external needInitialized onlyOwner { - _creationFee = newFee; + function setBondingCurve(address newBondingCurve) external needInitialized onlyOwner { + _bondingCurve = newBondingCurve; } /** * @dev See {ISpotlightTokenFactory-storyDerivativeWorkflows}. */ - function storyDerivativeWorkflows() public view needInitialized returns (address) { + function storyDerivativeWorkflows() public view returns (address) { return _storyDerivativeWorkflows; } /** - * @dev See {ISpotlightTokenFactory-setStoryDerivativeWorkflows}. - */ - function setStoryDerivativeWorkflows(address newStoryDerivativeWorkflows) external needInitialized onlyOwner { - _storyDerivativeWorkflows = newStoryDerivativeWorkflows; - } - - /** - * @dev See {ISpotlightTokenFactory-baseToken}. - */ - function baseToken() public view needInitialized returns (address) { - return _baseToken; - } - - /** - * @dev See {ISpotlightTokenFactory-setBaseToken}. + * @dev See {ISpotlightTokenFactory-piperXRouter}. */ - function setBaseToken(address newBaseToken) external needInitialized onlyOwner { - _baseToken = newBaseToken; + function piperXRouter() public view returns (address) { + return _piperXRouter; } /** - * @dev See {ISpotlightTokenFactory-bondingCurve}. + * @dev See {ISpotlightTokenFactory-piperXFactory}. */ - function bondingCurve() public view needInitialized returns (address) { - return _bondingCurve; + function piperXFactory() public view returns (address) { + return _piperXFactory; } /** - * @dev See {ISpotlightTokenFactory-setBondingCurve}. + * @dev See {ISpotlightTokenFactory-rewardsVault}. */ - function setBindingCurve(address newBondingCurve) external needInitialized onlyOwner { - _bondingCurve = newBondingCurve; + function rewardsVault() public view returns (address) { + return _rewardsVault; } /** * @dev See {ISpotlightTokenFactory-calculateTokenAddress}. */ - function calculateTokenAddress(address tokenCreator) external view needInitialized returns (address) { + function calculateTokenAddress(address tokenCreator) external view returns (address) { bytes32 salt = _salt(tokenCreator); return Clones.predictDeterministicAddress(_tokenImplementation, salt, address(this)); } @@ -172,9 +147,9 @@ contract SpotlightTokenFactory is SpotlightTokenFactoryStorage, ISpotlightTokenF StoryWorkflowStructs.IPMetadata calldata ipMetadata, StoryWorkflowStructs.SignatureData calldata sigMetadata, StoryWorkflowStructs.SignatureData calldata sigRegister, - address specificAddress + address parentIPAccount ) external payable needInitialized returns (address tokenAddress, address ipId) { - tokenAddress = _deploySpotlightToken(tokenCreationData, msg.sender, specificAddress); + tokenAddress = _deploySpotlightToken(tokenCreationData, msg.sender, parentIPAccount); ISpotlightTokenIPCollection(_tokenIpCollection).mint(msg.sender, tokenCreationData.tokenIpNFTId); @@ -200,17 +175,10 @@ contract SpotlightTokenFactory is SpotlightTokenFactoryStorage, ISpotlightTokenF ); } - /** - * @dev See {ISpotlightTokenFactory-getInitialBuyTokenQuote}. - */ - function getInitialBuyTokenQuote(uint256 tokensOut) external view needInitialized returns (uint256) { - return ISpotlightBondingCurve(_bondingCurve).getTargetTokenBuyQuote(0, tokensOut); - } - /** * @dev See {ISpotlightTokenFactory-numberOfTokensCreated}. */ - function numberOfTokensCreated(address tokenCreator) public view needInitialized returns (uint256) { + function numberOfTokensCreated(address tokenCreator) public view returns (uint256) { return _numbersOfTokensCreated[tokenCreator]; } @@ -231,10 +199,6 @@ contract SpotlightTokenFactory is SpotlightTokenFactoryStorage, ISpotlightTokenF } } - function _checkIsOwner() internal view { - require(msg.sender == _owner, "SpotlightTokenFactory: Not owner"); - } - function _salt(address account) internal view returns (bytes32) { return keccak256(abi.encodePacked(account, numberOfTokensCreated(account))); } @@ -251,7 +215,7 @@ contract SpotlightTokenFactory is SpotlightTokenFactoryStorage, ISpotlightTokenF _bondingCurve, address(this), ipAccount, - _protocolRewards, + _rewardsVault, _piperXRouter, _piperXFactory ); diff --git a/src/spotlight-token-factory/SpotlightTokenFactoryStorage.sol b/src/spotlight-token-factory/SpotlightTokenFactoryStorage.sol index e6ce470..57a1b13 100644 --- a/src/spotlight-token-factory/SpotlightTokenFactoryStorage.sol +++ b/src/spotlight-token-factory/SpotlightTokenFactoryStorage.sol @@ -2,22 +2,14 @@ pragma solidity ^0.8.13; abstract contract SpotlightTokenFactoryStorage { - // @dev v1 properties - address internal _owner; uint256 internal _creationFee; - address internal _creationFeeToken; //deprecated + address internal _tokenIpCollection; address internal _tokenImplementation; address internal _bondingCurve; - address internal _baseToken; - address internal _tokenIpCollection; address internal _storyDerivativeWorkflows; - mapping(address => uint256) internal _numbersOfTokensCreated; - - bool internal _isInitialized; - // @dev end of v1 properties - // @dev v2 properties address internal _piperXRouter; address internal _piperXFactory; - address internal _protocolRewards; - // @dev end of v2 properties + address internal _rewardsVault; + + mapping(address => uint256) internal _numbersOfTokensCreated; } diff --git a/test/SpotlightTokenFactoryTest.t.sol b/test/SpotlightTokenFactoryTest.t.sol index acf2eab..76a43ba 100644 --- a/test/SpotlightTokenFactoryTest.t.sol +++ b/test/SpotlightTokenFactoryTest.t.sol @@ -10,6 +10,7 @@ import {ISpotlightTokenFactory} from "../src/spotlight-token-factory/ISpotlightT import {StoryWorkflowStructs} from "../src/spotlight-token-factory/story-workflow-interfaces/StoryWorkflowStructs.sol"; import {SpotlightNativeBondingCurve} from "../src/spotlight-bonding-curve/SpotlightNativeBondingCurve.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import {SpotlightProtocolRewards} from "../src/spotlight-protocol-rewards/SpotlightProtocolRewards.sol"; contract SpotlightTokenFactoryTest is Test { @@ -20,100 +21,111 @@ contract SpotlightTokenFactoryTest is Test { SpotlightTokenFactory private _factory; address private _factoryAddress; + SpotlightToken private _spotlightTokenImpl; SpotlightTokenIPCollection private _tokenIpCollection; SpotlightNativeBondingCurve private _bondingCurve; - SpotlightProtocolRewards private _protocolRewards; - address private constant Wrapper_IP = 0xe8CabF9d1FFB6CE23cF0a86641849543ec7BD7d5; + SpotlightProtocolRewards private _rewardsVault; + address private constant _piperXRouter = address(0); + address private constant _piperXFactory = address(0); function setUp() public { _factoryOwner = makeAddr("factoryOwner"); _mockStoryWorkflows = new MockStoryDerivativeWorkflows(); - SpotlightToken spotlightTokenImpl = new SpotlightToken(); + _spotlightTokenImpl = new SpotlightToken(); vm.startPrank(_factoryOwner); _factory = new SpotlightTokenFactory(); _factoryAddress = address(_factory); _tokenIpCollection = new SpotlightTokenIPCollection(_factoryAddress); _bondingCurve = new SpotlightNativeBondingCurve(1060848709, 4379701787); - _protocolRewards = new SpotlightProtocolRewards(); + _rewardsVault = new SpotlightProtocolRewards(); _factory.initialize( _factoryOwner, DEFAULT_CREATION_FEE, address(_tokenIpCollection), - address(spotlightTokenImpl), + address(_spotlightTokenImpl), address(_bondingCurve), - Wrapper_IP, address(_mockStoryWorkflows), - address(0), - address(0), - address(_protocolRewards) + address(_piperXRouter), + address(_piperXFactory), + address(_rewardsVault) ); vm.stopPrank(); } + function testImplementationIsInitialized() public { + SpotlightTokenFactory factory = new SpotlightTokenFactory(); + assertFalse(factory.isInitialized()); + } + function testTokenFactoryConstructor() public view { assertEq(_factory.owner(), _factoryOwner); assertEq(_factory.createTokenFee(), DEFAULT_CREATION_FEE); + assertEq(_factory.tokenIpCollection(), address(_tokenIpCollection)); + assertEq(_factory.tokenImplementation(), address(_spotlightTokenImpl)); + assertEq(_factory.bondingCurve(), address(_bondingCurve)); assertEq(_factory.storyDerivativeWorkflows(), address(_mockStoryWorkflows)); + assertEq(_factory.piperXRouter(), _piperXRouter); + assertEq(_factory.piperXFactory(), _piperXFactory); + assertEq(_factory.rewardsVault(), address(_rewardsVault)); } - function testNotOwnerSetTokenIpCollection() public { + function testNotOwnerSetCreationFee() public { address notOwner = makeAddr("notOwner"); + uint256 creationFee = DEFAULT_CREATION_FEE; vm.startPrank(notOwner); - vm.expectRevert(); - _factory.setTokenIpCollection(makeAddr("newTokenIpCollection")); + vm.expectRevert(abi.encodeWithSelector(OwnableUpgradeable.OwnableUnauthorizedAccount.selector, notOwner)); + _factory.setCreateTokenFee(creationFee); vm.stopPrank(); } - function testSetTokneIpCollection() public { + function testSetCreationFee() public { + uint256 creationFee = DEFAULT_CREATION_FEE; + vm.startPrank(_factoryOwner); - SpotlightTokenIPCollection tokenIpCollection = new SpotlightTokenIPCollection(_factoryAddress); - address tokenIpCollectionAddress = address(tokenIpCollection); - _factory.setTokenIpCollection(tokenIpCollectionAddress); + _factory.setCreateTokenFee(creationFee); vm.stopPrank(); - assertEq(_factory.tokenIpCollection(), tokenIpCollectionAddress); - assertEq(tokenIpCollection.owner(), _factoryOwner); - assertEq(tokenIpCollection.tokenFactory(), _factoryAddress); + assertEq(_factory.createTokenFee(), creationFee); } - function testNotOwnerSetCreationFee() public { + function testNotOwnerSetTokenImplementation() public { address notOwner = makeAddr("notOwner"); - uint256 creationFee = DEFAULT_CREATION_FEE; + address newTokenImplementation = makeAddr("newTokenImplementation"); vm.startPrank(notOwner); - vm.expectRevert(); - _factory.setCreateTokenFee(creationFee); + vm.expectRevert(abi.encodeWithSelector(OwnableUpgradeable.OwnableUnauthorizedAccount.selector, notOwner)); + _factory.setTokenImplementation(newTokenImplementation); vm.stopPrank(); } - function testSetCreationFee() public { - uint256 creationFee = DEFAULT_CREATION_FEE; + function testSetTokenImplementation() public { + address newTokenImplementation = makeAddr("newTokenImplementation"); vm.startPrank(_factoryOwner); - _factory.setCreateTokenFee(creationFee); + _factory.setTokenImplementation(newTokenImplementation); vm.stopPrank(); - assertEq(_factory.createTokenFee(), creationFee); + assertEq(_factory.tokenImplementation(), newTokenImplementation); } - function testNotOwnerSetStoryDerivativeWorkflows() public { + function testNotOwnerSetBondingCurve() public { address notOwner = makeAddr("notOwner"); - address newStoryDerivativeWorkflows = makeAddr("newStoryDerivativeWorkflows"); + address newBondingCurve = makeAddr("bondingCurve"); vm.startPrank(notOwner); - vm.expectRevert(); - _factory.setStoryDerivativeWorkflows(newStoryDerivativeWorkflows); + vm.expectRevert(abi.encodeWithSelector(OwnableUpgradeable.OwnableUnauthorizedAccount.selector, notOwner)); + _factory.setBondingCurve(newBondingCurve); vm.stopPrank(); } - function testSetStoryDerivativeWorkflows() public { - address newStoryDerivativeWorkflows = makeAddr("newStoryDerivativeWorkflows"); + function testSetBondingCurve() public { + address newBondingCurve = makeAddr("newBondingCurve"); vm.startPrank(_factoryOwner); - _factory.setStoryDerivativeWorkflows(newStoryDerivativeWorkflows); + _factory.setBondingCurve(newBondingCurve); vm.stopPrank(); - assertEq(_factory.storyDerivativeWorkflows(), newStoryDerivativeWorkflows); + assertEq(_factory.bondingCurve(), newBondingCurve); } function testCalculateTokenAddress() public { @@ -284,7 +296,7 @@ contract SpotlightTokenFactoryTest is Test { address nonOwner = makeAddr("nonOwner"); vm.startPrank(nonOwner); - vm.expectRevert("SpotlightTokenFactory: Not owner"); + vm.expectRevert(abi.encodeWithSelector(OwnableUpgradeable.OwnableUnauthorizedAccount.selector, nonOwner)); _factory.claimFee(address(nonOwner)); vm.stopPrank(); } diff --git a/test/SpotlightTokenTest.t.sol b/test/SpotlightTokenTest.t.sol index 0ee998b..90b9af3 100644 --- a/test/SpotlightTokenTest.t.sol +++ b/test/SpotlightTokenTest.t.sol @@ -60,7 +60,6 @@ contract SpotlightTokenTest is Test { address(_tokenIpCollection), address(spotlightTokenImpl), address(_bondingCurve), - WRAPPER_IP, address(_mockStoryWorkflows), PIPERX_V2_ROUTER, PIPERX_V2_FACTORY,