-
Notifications
You must be signed in to change notification settings - Fork 522
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e1452d
commit 94d081d
Showing
2 changed files
with
64 additions
and
0 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,58 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
pragma solidity ^0.8.0; | ||
|
||
import "../../utils/BaseTest.sol"; | ||
|
||
import { TWProxy } from "contracts/infra/TWProxy.sol"; | ||
|
||
contract MyTokenERC1155 is TokenERC1155 {} | ||
|
||
contract TokenERC1155Test_Owner is BaseTest { | ||
address public implementation; | ||
address public proxy; | ||
|
||
MyTokenERC1155 internal tokenContract; | ||
|
||
function setUp() public override { | ||
super.setUp(); | ||
|
||
// Deploy implementation. | ||
implementation = address(new MyTokenERC1155()); | ||
|
||
// Deploy proxy pointing to implementaion. | ||
vm.prank(deployer); | ||
proxy = address( | ||
new TWProxy( | ||
implementation, | ||
abi.encodeCall( | ||
TokenERC1155.initialize, | ||
( | ||
deployer, | ||
NAME, | ||
SYMBOL, | ||
CONTRACT_URI, | ||
forwarders(), | ||
saleRecipient, | ||
royaltyRecipient, | ||
royaltyBps, | ||
platformFeeBps, | ||
platformFeeRecipient | ||
) | ||
) | ||
) | ||
); | ||
|
||
tokenContract = MyTokenERC1155(proxy); | ||
} | ||
|
||
function test_owner() public { | ||
assertEq(tokenContract.owner(), deployer); | ||
} | ||
|
||
function test_owner_notDefaultAdmin() public { | ||
vm.prank(deployer); | ||
tokenContract.renounceRole(bytes32(0x00), deployer); | ||
|
||
assertEq(tokenContract.owner(), address(0)); | ||
} | ||
} |
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,6 @@ | ||
owner() | ||
├── when private variable `_owner` DEFAULT_ADMIN_ROLE | ||
│ └── it should return `_owner` ✅ | ||
└── when private variable `_owner` doesn't have DEFAULT_ADMIN_ROLE | ||
└── it should return address(0) ✅ | ||
|