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

Move feeTo from hardcoded to constructor arg #112

Merged
merged 1 commit into from
Nov 17, 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
87 changes: 44 additions & 43 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,56 +1,57 @@
OptionSettlementTest:testAddOptionsToExistingClaim() (gas: 452638)
OptionSettlementTest:testDecodeTokenId() (gas: 487512)
OptionSettlementTest:testEncodeTokenId() (gas: 487113)
OptionSettlementTest:testEventExercise() (gas: 340796)
OptionSettlementTest:testAddOptionsToExistingClaim() (gas: 452588)
OptionSettlementTest:testAssignMultipleBuckets() (gas: 719739)
OptionSettlementTest:testDecodeTokenId() (gas: 487534)
OptionSettlementTest:testEncodeTokenId() (gas: 487135)
OptionSettlementTest:testEventExercise() (gas: 340839)
OptionSettlementTest:testEventNewOptionType() (gas: 124307)
OptionSettlementTest:testEventRedeem() (gas: 299522)
OptionSettlementTest:testEventSweepFeesWhenFeesAccruedForExercise() (gas: 1206709)
OptionSettlementTest:testEventSweepFeesWhenFeesAccruedForWrite() (gas: 1175972)
OptionSettlementTest:testEventWriteWhenExistingClaim() (gas: 322146)
OptionSettlementTest:testEventWriteWhenNewClaim() (gas: 300701)
OptionSettlementTest:testExerciseBeforeExpiry() (gas: 333473)
OptionSettlementTest:testExerciseIncompleteExercise() (gas: 354620)
OptionSettlementTest:testExerciseMultipleWriteSameChain() (gas: 467341)
OptionSettlementTest:testExerciseWithDifferentDecimals() (gas: 405077)
OptionSettlementTest:testFailAssignMultipleBuckets() (gas: 738993)
OptionSettlementTest:testFailGetClaimForTokenId() (gas: 392082)
OptionSettlementTest:testFailRandomAssignment() (gas: 1204419)
OptionSettlementTest:testFuzzDecodeTokenId(uint256,uint256) (runs: 256, μ: 10844, ~: 10844)
OptionSettlementTest:testEventRedeem() (gas: 299413)
OptionSettlementTest:testEventSweepFeesWhenFeesAccruedForExercise() (gas: 1206725)
OptionSettlementTest:testEventSweepFeesWhenFeesAccruedForWrite() (gas: 1176035)
OptionSettlementTest:testEventWriteWhenExistingClaim() (gas: 322234)
OptionSettlementTest:testEventWriteWhenNewClaim() (gas: 300745)
OptionSettlementTest:testExerciseBeforeExpiry() (gas: 333449)
OptionSettlementTest:testExerciseIncompleteExercise() (gas: 354551)
OptionSettlementTest:testExerciseMultipleWriteSameChain() (gas: 467337)
OptionSettlementTest:testExerciseWithDifferentDecimals() (gas: 405054)
OptionSettlementTest:testFailGetClaimForTokenId() (gas: 392104)
OptionSettlementTest:testFuzzDecodeTokenId(uint256,uint256) (runs: 256, μ: 10866, ~: 10866)
OptionSettlementTest:testFuzzEncodeTokenId(uint256,uint256) (runs: 256, μ: 10770, ~: 10770)
OptionSettlementTest:testFuzzExercise(uint112,uint112) (runs: 256, μ: 402658, ~: 406028)
OptionSettlementTest:testFuzzNewOptionType(uint96,uint96,uint40,uint40) (runs: 256, μ: 124702, ~: 124702)
OptionSettlementTest:testFuzzRedeem(uint112,uint112) (runs: 256, μ: 393471, ~: 397055)
OptionSettlementTest:testFuzzWrite(uint112) (runs: 256, μ: 318375, ~: 318375)
OptionSettlementTest:testFuzzWriteExerciseRedeem(uint32) (runs: 256, μ: 11635799, ~: 11692076)
OptionSettlementTest:testGetOptionForTokenId() (gas: 124631)
OptionSettlementTest:testIsOptionInitialized() (gas: 124854)
OptionSettlementTest:testRedeemNotExercised() (gas: 302961)
OptionSettlementTest:testFuzzExercise(uint112,uint112) (runs: 256, μ: 402699, ~: 406069)
OptionSettlementTest:testFuzzNewOptionType(uint96,uint96,uint40,uint40) (runs: 256, μ: 124724, ~: 124724)
OptionSettlementTest:testFuzzRedeem(uint112,uint112) (runs: 256, μ: 393489, ~: 397073)
OptionSettlementTest:testFuzzWrite(uint112) (runs: 256, μ: 318417, ~: 318417)
OptionSettlementTest:testFuzzWriteExerciseRedeem(uint32) (runs: 256, μ: 11625354, ~: 11717902)
OptionSettlementTest:testGetOptionForTokenId() (gas: 124564)
OptionSettlementTest:testInitial() (gas: 7802)
OptionSettlementTest:testIsOptionInitialized() (gas: 124876)
OptionSettlementTest:testRandomAssignment() (gas: 1599889)
OptionSettlementTest:testRedeemNotExercised() (gas: 303048)
OptionSettlementTest:testRevertExerciseBeforeExcercise() (gas: 401588)
OptionSettlementTest:testRevertExerciseWhenCallerHoldsInsufficientOptions() (gas: 306381)
OptionSettlementTest:testRevertExerciseWhenExerciseTooEarly() (gas: 308003)
OptionSettlementTest:testRevertExerciseWhenCallerHoldsInsufficientOptions() (gas: 306335)
OptionSettlementTest:testRevertExerciseWhenExerciseTooEarly() (gas: 308025)
OptionSettlementTest:testRevertExerciseWhenExpiredOption() (gas: 427764)
OptionSettlementTest:testRevertExerciseWhenInvalidOption() (gas: 294499)
OptionSettlementTest:testRevertNewOptionTypeWhenExerciseWindowTooShort() (gas: 19267)
OptionSettlementTest:testRevertNewOptionTypeWhenExpiryTooSoon() (gas: 20652)
OptionSettlementTest:testRevertNewOptionTypeWhenInvalidAssets() (gas: 20857)
OptionSettlementTest:testRevertNewOptionTypeWhenOptionsTypeExists() (gas: 22574)
OptionSettlementTest:testRevertNewOptionTypeWhenOptionsTypeExists() (gas: 22596)
OptionSettlementTest:testRevertNewOptionTypeWhenTotalSuppliesAreTooLowToExercise() (gas: 48813)
OptionSettlementTest:testRevertRedeemWhenCallerDoesNotOwnClaimId() (gas: 318703)
OptionSettlementTest:testRevertRedeemWhenClaimTooSoon() (gas: 298702)
OptionSettlementTest:testRevertRedeemWhenCallerDoesNotOwnClaimId() (gas: 318633)
OptionSettlementTest:testRevertRedeemWhenClaimTooSoon() (gas: 298679)
OptionSettlementTest:testRevertRedeemWhenInvalidClaim() (gas: 10603)
OptionSettlementTest:testRevertSetFeeToWhenNotCurrentFeeTo() (gas: 11831)
OptionSettlementTest:testRevertSetFeeToWhenNotCurrentFeeTo() (gas: 11875)
OptionSettlementTest:testRevertSetFeeToWhenZeroAddress() (gas: 11689)
OptionSettlementTest:testRevertUnderlyingWhenTokenNotFound() (gas: 11757)
OptionSettlementTest:testRevertUriWhenTokenNotFound() (gas: 18617)
OptionSettlementTest:testRevertUriWhenTokenNotFound() (gas: 18683)
OptionSettlementTest:testRevertWriteExpiredOption() (gas: 16631)
OptionSettlementTest:testRevertWriteWhenAmountWrittenCannotBeZero() (gas: 10926)
OptionSettlementTest:testRevertWriteWhenCallerDoesNotOwnClaimId() (gas: 302895)
OptionSettlementTest:testRevertWriteWhenEncodedOptionIdInClaimIdDoesNotMatchProvidedOptionId() (gas: 11624)
OptionSettlementTest:testRevertWriteWhenExpiredOption() (gas: 295661)
OptionSettlementTest:testRevertWriteWhenInvalidOption() (gas: 13628)
OptionSettlementTest:testSetFeeTo() (gas: 15841)
OptionSettlementTest:testTokenURI() (gas: 480902)
OptionSettlementTest:testUnderlyingAfterExercise() (gas: 375491)
OptionSettlementTest:testUnderlyingForFungibleOptionToken() (gas: 31130)
OptionSettlementTest:testUnderlyingWhenNotExercised() (gas: 304697)
OptionSettlementTest:testWriteMultipleWriteSameOptionType() (gas: 431154)
OptionSettlementTest:testRevertWriteWhenAmountWrittenCannotBeZero() (gas: 10948)
OptionSettlementTest:testRevertWriteWhenCallerDoesNotOwnClaimId() (gas: 302961)
OptionSettlementTest:testRevertWriteWhenEncodedOptionIdInClaimIdDoesNotMatchProvidedOptionId() (gas: 11668)
OptionSettlementTest:testRevertWriteWhenExpiredOption() (gas: 295704)
OptionSettlementTest:testRevertWriteWhenInvalidOption() (gas: 13650)
OptionSettlementTest:testSetFeeTo() (gas: 15817)
OptionSettlementTest:testTokenURI() (gas: 480968)
OptionSettlementTest:testUnderlyingAfterExercise() (gas: 375445)
OptionSettlementTest:testUnderlyingForFungibleOptionToken() (gas: 31042)
OptionSettlementTest:testUnderlyingWhenNotExercised() (gas: 304719)
OptionSettlementTest:testWriteMultipleWriteSameOptionType() (gas: 431129)
12 changes: 11 additions & 1 deletion src/OptionSettlementEngine.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ contract OptionSettlementEngine is ERC1155, IOptionSettlementEngine {
mapping(address => uint256) public feeBalance;

/// @notice The address fees accrue to
address public feeTo = 0x2dbd50A4Ef9B172698596217b7DB0163D3607b41;
address public feeTo;
0xAlcibiades marked this conversation as resolved.
Show resolved Hide resolved

/*//////////////////////////////////////////////////////////////
// State variables - Internal
Expand Down Expand Up @@ -77,6 +77,16 @@ contract OptionSettlementEngine is ERC1155, IOptionSettlementEngine {
/// @notice Accessor for mapping a claim id to its ClaimIndices
mapping(uint256 => OptionLotClaimIndex[]) internal _claimIdToClaimIndexArray;

/*//////////////////////////////////////////////////////////////
// Constructor
//////////////////////////////////////////////////////////////*/

/// @notice OptionSettlementEngine constructor
/// @param _feeTo The address fees accrue to
constructor(address _feeTo) {
feeTo = _feeTo;
}

/*//////////////////////////////////////////////////////////////
// Accessors
//////////////////////////////////////////////////////////////*/
Expand Down
6 changes: 5 additions & 1 deletion test/OptionSettlement.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ contract OptionSettlementTest is Test, NFTreceiver {
vm.createSelectFork(vm.envString("RPC_URL"), 15_000_000); // specify block number to cache for future test runs

// Deploy OptionSettlementEngine
engine = new OptionSettlementEngine();
engine = new OptionSettlementEngine(FEE_TO);

// Setup test option contract
testExerciseTimestamp = uint40(block.timestamp);
Expand Down Expand Up @@ -100,6 +100,10 @@ contract OptionSettlementTest is Test, NFTreceiver {
engine.setApprovalForAll(address(this), true);
}

function testInitial() public {
assertEq(engine.feeTo(), FEE_TO);
}

// **********************************************************************
// PASS TESTS
// **********************************************************************
Expand Down