Skip to content

Commit

Permalink
Implement a few gas optimizations (#246)
Browse files Browse the repository at this point in the history
* perf: use a bitmap instead of storage mapping for storing claimed epochs
feat: replace "claimedEpochs" storage var with a view function implementation

* perf: batch token transfers and state updates in "claimMany" function
refactor: remove superfluous assignment of uint256 to 0 in "claimMany" function
docs: add TODO in "claimMany" function

* fix: bug in "claimEpoch" function

* refactor: use "claimedEpochs" function call instead of "_claimedEpochsBitMap" storage mapping
refactor: rename "claimedEpochs" function to "claimedEpoch"
docs: remove TODO at "claimMany" function
test: rename "testClaimMultipleClaims" test function to "testClaimFourIndividualClaims"
test: rename "testClaimMany" test function to "testClaimManyOnce"

* feat: change state mutability of "_claimedEpochsBitMap" from "private" to "internal"

* test: add Foundry unit test for "claimedEpoch" function
test: add balance assertions for "testClaimManyOnce" test
chore: re-generate gas snapshot

* chore: re-generate gas snapshot
  • Loading branch information
scorpion9979 authored Feb 5, 2024
1 parent 37d3eae commit 7194c70
Show file tree
Hide file tree
Showing 4 changed files with 586 additions and 318 deletions.
Loading

0 comments on commit 7194c70

Please sign in to comment.