Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
d9277483
Commit
d9277483
authored
Mar 31, 2023
by
James Kim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use mock calls
parent
c6cd3881
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
22 deletions
+27
-22
Optimist.t.sol
...ontracts-periphery/contracts/foundry-tests/Optimist.t.sol
+27
-22
No files found.
packages/contracts-periphery/contracts/foundry-tests/Optimist.t.sol
View file @
d9277483
...
@@ -161,6 +161,8 @@ contract Optimist_Initializer is Test {
...
@@ -161,6 +161,8 @@ contract Optimist_Initializer is Test {
abi.encodeWithSelector(OptimistAllowlist.isAllowedToMint.selector, _claimer),
abi.encodeWithSelector(OptimistAllowlist.isAllowedToMint.selector, _claimer),
abi.encode(true)
abi.encode(true)
);
);
assertTrue(optimist.isOnAllowList(_claimer));
}
}
/**
/**
...
@@ -213,6 +215,9 @@ contract Optimist_Initializer is Test {
...
@@ -213,6 +215,9 @@ contract Optimist_Initializer is Test {
}
}
contract OptimistTest is Optimist_Initializer {
contract OptimistTest is Optimist_Initializer {
/**
* @notice Check that constructor and initializer parameters are correctly set.
*/
function test_initialize_success() external {
function test_initialize_success() external {
// expect name to be set
// expect name to be set
assertEq(optimist.name(), name);
assertEq(optimist.name(), name);
...
@@ -482,6 +487,28 @@ contract OptimistTest is Optimist_Initializer {
...
@@ -482,6 +487,28 @@ contract OptimistTest is Optimist_Initializer {
assertEq(optimist.getApproved(_getTokenId(bob)), address(0));
assertEq(optimist.getApproved(_getTokenId(bob)), address(0));
}
}
/**
* @notice setApprovalForAll should revert since Optimist is a SBT.
*/
function test_setApprovalForAll_reverts() external {
_mockAllowlistTrueFor(bob);
// mint as bob
vm.prank(bob);
optimist.mint(bob);
vm.prank(alice_allowlistAttestor);
vm.expectRevert(bytes("Optimist: soul bound token"));
optimist.setApprovalForAll(alice_allowlistAttestor, true);
// expect approval amount to stil be 0
assertEq(optimist.getApproved(_getTokenId(bob)), address(0));
// isApprovedForAll should return false
assertEq(
optimist.isApprovedForAll(alice_allowlistAttestor, alice_allowlistAttestor),
false
);
}
/**
/**
* @notice Only Owner should be able to burn token.
* @notice Only Owner should be able to burn token.
*/
*/
...
@@ -519,28 +546,6 @@ contract OptimistTest is Optimist_Initializer {
...
@@ -519,28 +546,6 @@ contract OptimistTest is Optimist_Initializer {
assertEq(optimist.balanceOf(bob), 1);
assertEq(optimist.balanceOf(bob), 1);
}
}
/**
* @notice setApprovalForAll should revert since Optimist is a SBT.
*/
function test_setApprovalForAll_reverts() external {
_mockAllowlistTrueFor(bob);
// mint as bob
vm.prank(bob);
optimist.mint(bob);
vm.prank(alice_allowlistAttestor);
vm.expectRevert(bytes("Optimist: soul bound token"));
optimist.setApprovalForAll(alice_allowlistAttestor, true);
// expect approval amount to stil be 0
assertEq(optimist.getApproved(_getTokenId(bob)), address(0));
// isApprovedForAll should return false
assertEq(
optimist.isApprovedForAll(alice_allowlistAttestor, alice_allowlistAttestor),
false
);
}
/**
/**
* @notice Should support ERC-721 interface.
* @notice Should support ERC-721 interface.
*/
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment