Skip to content

Commit

Permalink
Merge pull request #120 from valorem-labs-inc/refactor/natspec-and-fo…
Browse files Browse the repository at this point in the history
…undrystd

🔧 Foundry project maintenance and NatSpec
  • Loading branch information
neodaoist authored Nov 18, 2022
2 parents ef6bcf8 + 0ff5948 commit 0a34480
Show file tree
Hide file tree
Showing 18 changed files with 275 additions and 420 deletions.
74 changes: 37 additions & 37 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
OptionSettlementTest:testAddOptionsToExistingClaim() (gas: 452610)
OptionSettlementTest:testAssignMultipleBuckets() (gas: 719761)
OptionSettlementTest:testDecodeTokenId() (gas: 487556)
OptionSettlementTest:testEncodeTokenId() (gas: 487157)
OptionSettlementTest:testEventExercise() (gas: 340861)
OptionSettlementTest:testEventNewOptionType() (gas: 124329)
OptionSettlementTest:testEventRedeem() (gas: 299435)
OptionSettlementTest:testEventSweepFeesWhenFeesAccruedForExercise() (gas: 1206747)
OptionSettlementTest:testEventSweepFeesWhenFeesAccruedForWrite() (gas: 1176035)
OptionSettlementTest:testEventWriteWhenExistingClaim() (gas: 322145)
OptionSettlementTest:testEventWriteWhenNewClaim() (gas: 300745)
OptionSettlementTest:testAssignMultipleBuckets() (gas: 719672)
OptionSettlementTest:testDecodeTokenId() (gas: 487578)
OptionSettlementTest:testEncodeTokenId() (gas: 487179)
OptionSettlementTest:testEventExercise() (gas: 340883)
OptionSettlementTest:testEventNewOptionType() (gas: 124313)
OptionSettlementTest:testEventRedeem() (gas: 299432)
OptionSettlementTest:testEventWriteWhenExistingClaim() (gas: 322142)
OptionSettlementTest:testEventWriteWhenNewClaim() (gas: 300742)
OptionSettlementTest:testExerciseBeforeExpiry() (gas: 333471)
OptionSettlementTest:testExerciseIncompleteExercise() (gas: 354573)
OptionSettlementTest:testExerciseMultipleWriteSameChain() (gas: 467359)
OptionSettlementTest:testExerciseMultipleWriteSameChain() (gas: 467337)
OptionSettlementTest:testExerciseWithDifferentDecimals() (gas: 407125)
OptionSettlementTest:testFuzzDecodeTokenId(uint256,uint256) (runs: 256, μ: 10888, ~: 10888)
OptionSettlementTest:testFuzzEncodeTokenId(uint256,uint256) (runs: 256, μ: 10792, ~: 10792)
OptionSettlementTest:testFuzzExercise(uint112,uint112) (runs: 256, μ: 402721, ~: 406091)
OptionSettlementTest:testFuzzNewOptionType(uint96,uint96,uint40,uint40) (runs: 256, μ: 124635, ~: 124635)
OptionSettlementTest:testFuzzRedeem(uint112,uint112) (runs: 256, μ: 393511, ~: 397095)
OptionSettlementTest:testFuzzWrite(uint112) (runs: 256, μ: 318417, ~: 318417)
OptionSettlementTest:testFuzzWriteExerciseRedeem(uint32) (runs: 256, μ: 11619195, ~: 11689637)
OptionSettlementTest:testGetClaimForTokenId() (gas: 377636)
OptionSettlementTest:testFuzzDecodeTokenId(uint256,uint256) (runs: 256, μ: 11006, ~: 11093)
OptionSettlementTest:testFuzzEncodeTokenId(uint256,uint256) (runs: 256, μ: 10977, ~: 11064)
OptionSettlementTest:testFuzzExercise(uint112,uint112) (runs: 256, μ: 402548, ~: 406142)
OptionSettlementTest:testFuzzNewOptionType(uint96,uint96,uint40,uint40) (runs: 256, μ: 124682, ~: 124682)
OptionSettlementTest:testFuzzRedeem(uint112,uint112) (runs: 256, μ: 393324, ~: 397146)
OptionSettlementTest:testFuzzWrite(uint112) (runs: 256, μ: 318433, ~: 318433)
OptionSettlementTest:testFuzzWriteExerciseRedeem(uint32) (runs: 256, μ: 11528117, ~: 11689637)
OptionSettlementTest:testGetClaimForTokenId() (gas: 377614)
OptionSettlementTest:testGetOptionForTokenId() (gas: 124586)
OptionSettlementTest:testInitial() (gas: 7824)
OptionSettlementTest:testInitial() (gas: 7857)
OptionSettlementTest:testIsOptionInitialized() (gas: 124898)
OptionSettlementTest:testRandomAssignment() (gas: 1599911)
OptionSettlementTest:testRedeemNotExercised() (gas: 303070)
OptionSettlementTest:testRandomAssignment() (gas: 1600049)
OptionSettlementTest:testRedeemNotExercised() (gas: 302981)
OptionSettlementTest:testRevertExerciseBeforeExcercise() (gas: 401610)
OptionSettlementTest:testRevertExerciseWhenCallerHoldsInsufficientOptions() (gas: 306357)
OptionSettlementTest:testRevertExerciseWhenExerciseTooEarly() (gas: 308047)
OptionSettlementTest:testRevertExerciseWhenExerciseTooEarly() (gas: 308069)
OptionSettlementTest:testRevertExerciseWhenExpiredOption() (gas: 427786)
OptionSettlementTest:testRevertExerciseWhenInvalidOption() (gas: 294521)
OptionSettlementTest:testRevertNewOptionTypeWhenExerciseWindowTooShort() (gas: 19289)
OptionSettlementTest:testRevertNewOptionTypeWhenExerciseWindowTooShort() (gas: 19333)
OptionSettlementTest:testRevertNewOptionTypeWhenExpiryTooSoon() (gas: 20674)
OptionSettlementTest:testRevertNewOptionTypeWhenInvalidAssets() (gas: 20879)
OptionSettlementTest:testRevertNewOptionTypeWhenOptionsTypeExists() (gas: 22618)
OptionSettlementTest:testRevertNewOptionTypeWhenTotalSuppliesAreTooLowToExercise() (gas: 48813)
OptionSettlementTest:testRevertNewOptionTypeWhenOptionsTypeExists() (gas: 22640)
OptionSettlementTest:testRevertNewOptionTypeWhenTotalSuppliesAreTooLowToExercise() (gas: 48835)
OptionSettlementTest:testRevertRedeemWhenCallerDoesNotOwnClaimId() (gas: 318655)
OptionSettlementTest:testRevertRedeemWhenClaimTooSoon() (gas: 298679)
OptionSettlementTest:testRevertRedeemWhenClaimTooSoon() (gas: 298657)
OptionSettlementTest:testRevertRedeemWhenInvalidClaim() (gas: 10603)
OptionSettlementTest:testRevertSetFeeToWhenNotCurrentFeeTo() (gas: 11786)
OptionSettlementTest:testRevertSetFeeToWhenZeroAddress() (gas: 11600)
OptionSettlementTest:testRevertSetFeeToWhenNotCurrentFeeTo() (gas: 11841)
OptionSettlementTest:testRevertSetFeeToWhenZeroAddress() (gas: 11633)
OptionSettlementTest:testRevertUnderlyingWhenTokenNotFound() (gas: 11779)
OptionSettlementTest:testRevertUriWhenTokenNotFound() (gas: 18596)
OptionSettlementTest:testRevertUriWhenTokenNotFound() (gas: 18618)
OptionSettlementTest:testRevertWriteExpiredOption() (gas: 16537)
OptionSettlementTest:testRevertWriteWhenAmountWrittenCannotBeZero() (gas: 10881)
OptionSettlementTest:testRevertWriteWhenCallerDoesNotOwnClaimId() (gas: 302983)
OptionSettlementTest:testRevertWriteWhenCallerDoesNotOwnClaimId() (gas: 302904)
OptionSettlementTest:testRevertWriteWhenEncodedOptionIdInClaimIdDoesNotMatchProvidedOptionId() (gas: 11690)
OptionSettlementTest:testRevertWriteWhenExpiredOption() (gas: 295699)
OptionSettlementTest:testRevertWriteWhenInvalidOption() (gas: 13650)
OptionSettlementTest:testSetFeeTo() (gas: 15731)
OptionSettlementTest:testRevertWriteWhenInvalidOption() (gas: 13672)
OptionSettlementTest:testSetFeeTo() (gas: 15797)
OptionSettlementTest:testSweepFeesWhenFeesAccruedForExercise() (gas: 1558429)
OptionSettlementTest:testSweepFeesWhenFeesAccruedForWrite() (gas: 1555682)
OptionSettlementTest:testTokenURI() (gas: 480880)
OptionSettlementTest:testUnderlyingAfterExercise() (gas: 375445)
OptionSettlementTest:testUnderlyingForFungibleOptionToken() (gas: 31064)
OptionSettlementTest:testUnderlyingWhenNotExercised() (gas: 304741)
OptionSettlementTest:testWriteMultipleWriteSameOptionType() (gas: 431129)
OptionSettlementTest:testUnderlyingAfterExercise() (gas: 375432)
OptionSettlementTest:testUnderlyingForFungibleOptionToken() (gas: 31140)
OptionSettlementTest:testUnderlyingWhenNotExercised() (gas: 304654)
OptionSettlementTest:testWriteMultipleWriteSameOptionType() (gas: 431139)
12 changes: 3 additions & 9 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
[submodule "lib/ds-test"]
path = lib/ds-test
url = https://github.com/dapphub/ds-test
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/solmate"]
path = lib/solmate
url = https://github.com/rari-capital/solmate
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/brockelmore/forge-std
[submodule "lib/chainlink"]
path = lib/chainlink
url = https://github.com/smartcontractkit/chainlink
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The structure of an option is as follows:
- **Underlying amount:** the amount of the underlying asset contained within an option of this type.
- **Exercise asset:** the ERC-20 address of the asset needed for exercise.
- **Exercise amount:** the amount of the exercise asset required to exercise this option.
- **Earliest exercise timestamp:** the timestamp after which this option can be exercised and physically settled.
- **Exercise timestamp:** the timestamp after which this option can be exercised and physically settled.
- **Expiry timestamp:** the timestamp before which this option can be exercised.

The Core is unopinionated on the type of option (call vs. put), where, when, or for how much an option is bought/sold, and whether or not the option is profitable when exercised. Because all options written with Valorem are fully collateralized, physical settlement at exercise or redeem time is instant and gas-efficient.
Expand Down
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
src = 'src'
out = 'out'
libs = ['lib']
remappings = ['ds-test/=lib/ds-test/src/']
remappings = ['forge-std/=lib/forge-std/src/', 'solmate/=lib/solmate/src/']

[fuzz]
max_test_rejects = 100000
2 changes: 1 addition & 1 deletion lib/base64/src/Base64.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Base64.sol)

pragma solidity ^0.8.0;
pragma solidity 0.8.11;

/**
* @dev Provides a set of functions to operate with Base64 strings.
Expand Down
1 change: 0 additions & 1 deletion lib/chainlink
Submodule chainlink deleted from ac9fc3
1 change: 0 additions & 1 deletion lib/ds-test
Submodule ds-test deleted from 9310e8
97 changes: 0 additions & 97 deletions poetry.lock

This file was deleted.

15 changes: 0 additions & 15 deletions pyproject.toml

This file was deleted.

Loading

0 comments on commit 0a34480

Please sign in to comment.