Skip to content

Commit

Permalink
disables initializers in IPToken constructor
Browse files Browse the repository at this point in the history
Signed-off-by: stadolf <[email protected]>
  • Loading branch information
elmariachi111 committed Jan 16, 2024
1 parent ab49b7e commit 3fb40c3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/IPToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ contract IPToken is ERC20BurnableUpgradeable, OwnableUpgradeable {
_metadata = metadata_;
}

constructor() {
_disableInitializers();
}

modifier onlyIssuerOrOwner() {
if (_msgSender() != _metadata.originalOwner && _msgSender() != owner()) {
revert OnlyIssuerOrOwner();
Expand Down
9 changes: 8 additions & 1 deletion test/Forking/TokenizerFork.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { IPNFT } from "../../src/IPNFT.sol";

import { MustOwnIpnft, AlreadyTokenized, Tokenizer } from "../../src/Tokenizer.sol";
import { Tokenizer11 } from "../../src/helpers/test-upgrades/Tokenizer11.sol";
import { IPToken, OnlyIssuerOrOwner, TokenCapped } from "../../src/IPToken.sol";
import { IPToken, OnlyIssuerOrOwner, TokenCapped, Metadata } from "../../src/IPToken.sol";
import { IPermissioner, BlindPermissioner } from "../../src/Permissioner.sol";

//import { SchmackoSwap, ListingState } from "../../src/SchmackoSwap.sol";
Expand Down Expand Up @@ -72,6 +72,13 @@ contract TokenizerForkTest is Test {
deployCodeTo("Permissioner.sol:BlindPermissioner", "", address(upgradedTokenizer.permissioner()));
vm.stopPrank();

vm.startPrank(alice);
vm.expectRevert("Initializable: contract is already initialized");
newTokenizerImplementation.initialize(IPNFT(address(0)), BlindPermissioner(address(0)));
vm.expectRevert("Initializable: contract is already initialized");
newIPTokenImplementation.initialize("Foo", "Bar", Metadata(2, alice, "abcde"));
vm.stopPrank();

assertEq(ipnftMainnetInstance.ownerOf(valleyDaoIpnftId), valleyDaoMultisig);

vm.startPrank(valleyDaoMultisig);
Expand Down

0 comments on commit 3fb40c3

Please sign in to comment.