Skip to content

Commit

Permalink
Merge pull request #152 from moleculeprotocol/stefan/drop-permissione…
Browse files Browse the repository at this point in the history
…r-setter

drops setPermissioner
  • Loading branch information
elmariachi111 authored Jan 11, 2024
2 parents f40298d + 7ce189d commit 1b9c739
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 35 deletions.
25 changes: 20 additions & 5 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,25 @@ src = 'src'
out = 'out'
libs = ['lib']
test = 'test'
cache_path = 'cache_forge'
cache_path = 'cache_forge'
solc_version = "0.8.18"
gas_reports = ["IPNFT", "IPNFTV2", "SchmackoSwap", "Tokenizer", "IPToken", "CrowdSale", "LockingCrowdSale", "StakedLockingCrowdSale", "TimelockedToken", "TermsAcceptedPermissioner", "SignedMintAuthorizer"]
fs_permissions = [{ access = "read-write", path = "./SALEID.txt"}]
gas_reports = [
"IPNFT",
"IPNFTV2",
"SchmackoSwap",
"Tokenizer",
"IPToken",
"CrowdSale",
"LockingCrowdSale",
"StakedLockingCrowdSale",
"TimelockedToken",
"TermsAcceptedPermissioner",
"SignedMintAuthorizer",
]
fs_permissions = [
{ access = "read-write", path = "./SALEID.txt" },
{ access = "read", path = "./out" },
]

[fmt]
bracket_spacing = true
Expand All @@ -18,5 +33,5 @@ override_spacing = false

[rpc_endpoints]
optimism = "https://optimism-goerli.infura.io/v3/${INFURA_KEY}"
goerli = "https://goerli.infura.io/v3/${INFURA_KEY}"
mainnet = "https://mainnet.infura.io/v3/${INFURA_KEY}"
goerli = "https://goerli.infura.io/v3/${INFURA_KEY}"
mainnet = "https://mainnet.infura.io/v3/${INFURA_KEY}"
2 changes: 1 addition & 1 deletion lib/forge-std
Submodule forge-std updated 56 files
+1 −0 .gitattributes
+134 −0 .github/workflows/ci.yml
+29 −0 .github/workflows/sync.yml
+0 −27 .github/workflows/tests.yml
+1 −1 .gitignore
+1 −1 LICENSE-APACHE
+1 −1 LICENSE-MIT
+8 −4 README.md
+19 −0 foundry.toml
+1 −1 lib/ds-test
+4 −4 package.json
+666 −0 scripts/vm.py
+35 −0 src/Base.sol
+24 −41 src/Script.sol
+376 −0 src/StdAssertions.sol
+244 −0 src/StdChains.sol
+817 −0 src/StdCheats.sol
+15 −0 src/StdError.sol
+107 −0 src/StdInvariant.sol
+126 −61 src/StdJson.sol
+43 −0 src/StdMath.sol
+378 −0 src/StdStorage.sol
+333 −0 src/StdStyle.sol
+226 −0 src/StdUtils.sol
+29 −1,134 src/Test.sol
+1,071 −244 src/Vm.sol
+406 −386 src/console2.sol
+105 −0 src/interfaces/IERC1155.sol
+12 −0 src/interfaces/IERC165.sol
+43 −0 src/interfaces/IERC20.sol
+190 −0 src/interfaces/IERC4626.sol
+164 −0 src/interfaces/IERC721.sol
+73 −0 src/interfaces/IMulticall3.sol
+216 −0 src/mocks/MockERC20.sol
+221 −0 src/mocks/MockERC721.sol
+13,248 −0 src/safeconsole.sol
+0 −20 src/test/Script.t.sol
+0 −602 src/test/StdAssertions.t.sol
+0 −282 src/test/StdCheats.t.sol
+0 −200 src/test/StdMath.t.sol
+1,015 −0 test/StdAssertions.t.sol
+216 −0 test/StdChains.t.sol
+610 −0 test/StdCheats.t.sol
+14 −18 test/StdError.t.sol
+212 −0 test/StdMath.t.sol
+120 −126 test/StdStorage.t.sol
+110 −0 test/StdStyle.t.sol
+342 −0 test/StdUtils.t.sol
+15 −0 test/Vm.t.sol
+10 −0 test/compilation/CompilationScript.sol
+10 −0 test/compilation/CompilationScriptBase.sol
+10 −0 test/compilation/CompilationTest.sol
+10 −0 test/compilation/CompilationTestBase.sol
+0 −0 test/fixtures/broadcast.log.json
+441 −0 test/mocks/MockERC20.t.sol
+721 −0 test/mocks/MockERC721.t.sol
8 changes: 0 additions & 8 deletions src/Tokenizer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,6 @@ contract Tokenizer is UUPSUpgradeable, OwnableUpgradeable {
ipTokenImplementation = _ipTokenImplementation;
}

function setPermissioner(IPermissioner _permissioner) external onlyOwner {
if (address(_permissioner) == address(0)) {
revert ZeroAddress();
}
emit PermissionerUpdated(permissioner, _permissioner);
permissioner = _permissioner;
}

/**
* @dev called after an upgrade to reinitialize a new permissioner impl.
* @param _permissioner the new TermsPermissioner
Expand Down
5 changes: 2 additions & 3 deletions test/Forking/TokenizerFork.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { IPermissioner, BlindPermissioner } from "../../src/Permissioner.sol";

//import { SchmackoSwap, ListingState } from "../../src/SchmackoSwap.sol";

contract TokenizerTest is Test {
contract TokenizerForkTest is Test {
using SafeERC20Upgradeable for IPToken;

uint256 mainnetFork;
Expand Down Expand Up @@ -69,8 +69,7 @@ contract TokenizerTest is Test {

assertEq(address(upgradedTokenizer.ipTokenImplementation()), address(newIPTokenImplementation));

upgradedTokenizer.setPermissioner(new BlindPermissioner());

deployCodeTo("Permissioner.sol:BlindPermissioner", "", address(upgradedTokenizer.permissioner()));
vm.stopPrank();

assertEq(ipnftMainnetInstance.ownerOf(valleyDaoIpnftId), valleyDaoMultisig);
Expand Down
24 changes: 6 additions & 18 deletions test/Tokenizer.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { IPNFT } from "../src/IPNFT.sol";
import { AcceptAllAuthorizer } from "./helpers/AcceptAllAuthorizer.sol";

import { FakeERC20 } from "../src/helpers/FakeERC20.sol";
import { MustOwnIpnft, AlreadyTokenized, Tokenizer } from "../src/Tokenizer.sol";
import { MustOwnIpnft, AlreadyTokenized, Tokenizer, ZeroAddress } from "../src/Tokenizer.sol";

import { IPToken, OnlyIssuerOrOwner, TokenCapped } from "../src/IPToken.sol";
import { Molecules } from "../src/helpers/test-upgrades/Molecules.sol";
Expand Down Expand Up @@ -82,30 +82,18 @@ contract TokenizerTest is Test {
vm.stopPrank();
}

function testSetPermissioner() public {
vm.startPrank(deployer);
assertEq(address(tokenizer.permissioner()), address(blindPermissioner));
BlindPermissioner newPermissioner = new BlindPermissioner();
tokenizer.setPermissioner(newPermissioner);
assertEq(address(tokenizer.permissioner()), address(newPermissioner));
vm.expectRevert();
tokenizer.setPermissioner(IPermissioner(address(0)));
vm.stopPrank();
vm.startPrank(originalOwner);
vm.expectRevert();
tokenizer.setPermissioner(newPermissioner);
vm.stopPrank();
}
function testSetIPTokenImplementation() public {
vm.startPrank(deployer);
IPToken newIPTokenImplementation = new IPToken();
tokenizer.setIPTokenImplementation(newIPTokenImplementation);
assertEq(address(tokenizer.ipTokenImplementation()), address(newIPTokenImplementation));
vm.expectRevert();
assertEq(address(tokenizer.ipTokenImplementation()), address(newIPTokenImplementation));

vm.expectRevert(ZeroAddress.selector);
tokenizer.setIPTokenImplementation(IPToken(address(0)));
vm.stopPrank();

vm.startPrank(originalOwner);
vm.expectRevert();
vm.expectRevert("Ownable: caller is not the owner");
tokenizer.setIPTokenImplementation(newIPTokenImplementation);
vm.stopPrank();
}
Expand Down

0 comments on commit 1b9c739

Please sign in to comment.