Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dupe functions #119

Merged
merged 1 commit into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions src/OptionSettlementEngine.sol
Original file line number Diff line number Diff line change
Expand Up @@ -220,21 +220,6 @@ contract OptionSettlementEngine is ERC1155, IOptionSettlementEngine {
claimNum = uint96(tokenId & claimNumMask);
}

/**
* @notice Return the option for the supplied token id
* @dev See encodeTokenId() for encoding scheme
* @param tokenId The token id of the Option
* @return The stored Option
*/
function getOptionForTokenId(uint256 tokenId) public view returns (Option memory) {
(uint160 optionKey,) = decodeTokenId(tokenId);
return _option[optionKey];
}

function getClaimForTokenId(uint256 tokenId) public view returns (OptionLotClaim memory) {
return _claim[tokenId];
}

/*//////////////////////////////////////////////////////////////
// Write Options
//////////////////////////////////////////////////////////////*/
Expand Down
9 changes: 3 additions & 6 deletions test/OptionSettlement.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ contract OptionSettlementTest is Test, NFTreceiver {
option.settlementSeed = optionKey; // settlement seed is initially equal to option key
option.nextClaimNum = 1; // next claim num has been incremented

assertEq(engine.getOptionForTokenId(optionId), option);
assertEq(engine.option(optionId), option);
}

function testGetClaimForTokenId() public {
Expand All @@ -632,10 +632,7 @@ contract OptionSettlementTest is Test, NFTreceiver {
vm.prank(ALICE);
uint256 claimId = engine.write(optionId, 7);

IOptionSettlementEngine.OptionLotClaim memory claim = engine.getClaimForTokenId(claimId);

emit log_named_uint("Amount written", claim.amountWritten);
// emit log_named_boolean("Claimed", claim.claimed);
IOptionSettlementEngine.OptionLotClaim memory claim = engine.claim(claimId);

assertEq(claim.amountWritten, 7);
assertEq(claim.claimed, false);
Expand Down Expand Up @@ -1580,7 +1577,7 @@ contract OptionSettlementTest is Test, NFTreceiver {

function _assertClaimAmountExercised(uint256 claimId, uint112 amount) internal {
IOptionSettlementEngine.Underlying memory underlying = engine.underlying(claimId);
IOptionSettlementEngine.Option memory option = engine.getOptionForTokenId(claimId);
IOptionSettlementEngine.Option memory option = engine.option(claimId);
uint112 amountExercised = uint112(uint256(underlying.exercisePosition) / option.exerciseAmount);
assertEq(amount, amountExercised);
}
Expand Down