Skip to content

Commit

Permalink
Pack Contract (#175)
Browse files Browse the repository at this point in the history
* new pack content struct

* update pack interface

* mock pack implementation

* update pack interface with amountToDistributePerOpen

* foundry

* update Pack interface comments

* implementation up till openPack

* transfer pack contents into the contract on createPack

* handle native token transfer case

* up till compile

* costly implementation, but works

* cleanup

* move pack to a directory

* Add design doc

* feature imports

* update CurrencyTransferLib usage

* format table in doc

* created TempPack and ITempPack

* refactor TempPack and ITempPack

* PackInfo struct update

* createPack test for TempPack

* tests for TempPack

* fix issues in Pack; tests for Pack and TempPack

* benchmark test

* remove twFee from Pack

* remove unused imports from Pack

* cleanup Pack

* compile and run prettier

* remove twFee

* rename to nextTokenIdToMint

* cleanup TempPack

* avoid stack too deep error

* update TempPack in tests

* fix issue: getRewardUnits returning zero amount

* forge updates

* make createPack payable, to allow native tokens

* add asset role

* unit tests for TempPack

* fuzz tests for TempPack

* return rewardUnits from openPack in TempPack

* fuzz test for openPack

* separate function for random value generation

* Fix bug: calculate pack total supply correctly

* logs for tests

* handling native tokens for pack

* receive and withdraw functions for native token transfers

* fuzz tests, and test logs

* update currentTotalSupply in openPack

* comment-out Pack -- not deleting yet

* update tests

* run prettier

* update tests

* scenario test -- reentrancy

* perUnitAmounts -> numOfRewardUnits

* run prettier

* restrict receive() to native token wrapper

* rename TempPack to Pack; delete older Pack

* update tests

* pull from main and update initialze fn

* pkg update

* deployment script for Pack

* remove unused caller

* fix import path

Co-authored-by: Krishang Nadgauda <nkrishang@Krishangs-MacBook-Pro.local>
Co-authored-by: Krishang Nadgauda <nkrishang@Krishangs-MBP.lan>
  • Loading branch information
3 people authored Jun 28, 2022
1 parent 2abaa42 commit 93c8815
Show file tree
Hide file tree
Showing 22 changed files with 2,264 additions and 1,520 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
url = https://github.com/brockelmore/forge-std
[submodule "lib/ds-test"]
path = lib/ds-test
url = https://github.com/dapphub/ds-test
url = https://github.com/dapphub/ds-test
Binary file added assets/pack-diag-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/pack-diag-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/pack-diag-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 93c8815

Please sign in to comment.