* New README with images
* Move readme to example 2, and add old readme for example 1
* example-1: fix merge conflict
* Update README.md
* Update README.md
* example-2: fix README and images
* example-2: fix README formulas and image
Co-authored-by: A5 Pickle <a5-pickle@users.noreply.github.com>
* Set up contracts for second example (#8)
Co-authored-by: gator-boi <gator-boi@users.noreply.github.com>
* Set up contract state (#11)
* Set up contracts for second example
* Delete README
* Define interface and contract state
Co-authored-by: gator-boi <gator-boi@users.noreply.github.com>
* Hub messages (#12)
* Update HubMessages.sol
* Update HubStructs.sol
* finish decode msgs (#13)
* Update HubMessages.sol
* Update HubStructs.sol
* write decode messages
Co-authored-by: derpy-duck <115193320+derpy-duck@users.noreply.github.com>
* Add .vscode to gitignore (#14)
Co-authored-by: derpy-duck <akadaveru@guse4c-ossdev-akl1.jumpisolated.com>
* Fixing some compile errors in HubMessages (#15)
* Fixing some compile errors in HubMessages
* Add Register Spoke method to register spokes on hub
* Implement completeRegisterSpoke
* Add chainId to message header, and add a check function to ensure the spoke that a message comes from is registered
* Add getWormholePayload function
* Remove registerSpoke as a wormhole message, and only allow on the hub as owner
Co-authored-by: derpy-duck <akadaveru@guse4c-ossdev-akl1.jumpisolated.com>
* Test files (#16)
* Fixing some compile errors in HubMessages
* Basic test
Co-authored-by: derpy-duck <akadaveru@guse4c-ossdev-akl1.jumpisolated.com>
* first pass at lending Hub completeDeposit (#17)
* first pass at lending Hub completeDeposit
* added barebones logic to completeWithdraw
* add some skeleton for repay & liquidation
* added some comments
* Progress 12:30-1:30
* forge install: forge-std
* fixed errors
* derpy-ducks's fixes
Co-authored-by: wrinkled-latherer
Co-authored-by: derpy-duck <115193320+derpy-duck@users.noreply.github.com>
* Adding encoding and decoding payload tests (#20)
* Derpy duck refactor and borrow (#21)
* Borrow
* transfer tokens empty function
* sign fix
* added collateralization ratio precision
* Liquidation and register msg (#19)
* mock Pyth
* shot myself in the foot
* tried fixing comment
* test
* set vault and global amounts
Co-authored-by: wrinkled-latherer <114771197+wrinkledLatherer@users.noreply.github.com>
Co-authored-by: derpy-duck <115193320+derpy-duck@users.noreply.github.com>
* cleanup (#22)
* Reorganized into HubUtilities and added docstrings to HubUtilities (#23)
* Reorganized into HubUtilities and added docstrings to HubUtilities
* Move the helper functions from Hub into HubUtilities
* Adding back a TODO
* Hub docstrings (#25)
* Hub specs
* Fixed allowedToWithdraw to add another check of making sure that there is enough total supply in the protocol before going ahead with a withdrawal
* Writing hub tests (#26)
* dump of testing
* makefile
* evm: fix token transfer encoding
* fixed slice issues, deposit test working
* tad
* refactored testing code to be cleaner
* updated tests with index accrual precision updated
* Seperated tests into helper file and main file
* enable manual oracle setting
* begin borrow testing
* Borrow test passes!
* resolved some todos
* addressed low decimals exploit
* add comment
Co-authored-by: wrinkledLatherer
Co-authored-by: A5 Pickle <a5-pickle@users.noreply.github.com>
* Test updates (#27)
* Fix compile error
* Max decimals
* test updates
* Changing the tests that fail to fail tests
* Cleaning up price code in tests
* CLEAN testing file!
* Removing some redundant comments
* Repay tests
* make decimals part of adaptive state
* added some comments
* fixed max liquidation bonus setting
* fix liquidation test
Co-authored-by: wrinkledLatherer
* Spoke (#24)
* Implementation of spoke methods without tokenbridge
* Added token bridge portion
* Implementation of spoke methods without tokenbridge
* Added token bridge portion
* Remove merge conflict
* Check valid address
* Swap token bridge payload to wormhole payload
* Lending detail (#29)
* add interest rate model params to asset info
* add liquidation max portion repayable as param
* add reserve factor usage
* add multiple collat ratios
* figure out some todos
Co-authored-by: wrinkledLatherer <asuresh@dub2t-btcdevl1.w2k.jumptrading.com>
* Derpy duck changes (#30)
* Move functions from Spoke to SpokeUtilities
* Fix address we are signing wormhole message with, and add a 'check duplicates' function for asset arrays passed into liquidation
* Token transfers (#31)
* implement transferTokens function
* Approve token transfers and fix compile errors
* Token transfers more
* Testing prank mint (#32)
* Testing prank mint
* Remove changes to MyERC20
* fixed fake minting
* Changed hardcoded addresses to refer to asset[0] and asset[1], and also changed testFail to use vm.expectRevert
Co-authored-by: wrinkledLatherer
* First integration test (#33)
* Real oracle (#34)
* Mock Pyth working
* add confidence computation to price
* add pyth docs link in comments
* made nConf intervals a param
* consolidated diff oracleMode update price feed fns into one fn
Co-authored-by: wrinkledLatherer
* Cleaned up price calls (#36)
* More integration tests (#35)
* Slight cleaning of first integration test
* some fixes
* attempt token bridge integration test deposit
* Working deposit testgit add .git add .!
* Nicer hub only tests
* Fix compile errors
* initialize publishtime
* remove comments
* Decimals (#37)
* decimal overflow error huh
* pushed some console msgs
* tests pass!
* put division at the end for rounding reasons
Co-authored-by: wrinkledLatherer <asuresh@dub2t-btcdevl1.w2k.jumptrading.com>
* Cleaning integration tests (#39)
* add the integration tests
* Reorganization of test file progress
* Testing files giant reorg
* Combine deposit repay withdraw borrow test methods
* Integration tests pass!
* Remove completeRegisterAsset and all asset state on spoke
* requires in the test methods
* Verify sender is spoke for token bridge messages
* lint fixes (#40)
* Prettier formatting, and normalize hub amounts in test before checking validity (#41)
* Native token transfer (#38)
* add initial native token tfer tests
* add WETH interface
* got native token tfer working
* added tests for repay native
* added reversion for repayments
* get rid of some unnecessary TODOs
* Repay check
* testRDBL passes; removed some redundant requires
Co-authored-by: wrinkledLatherer <wrinkledLatherer>
Co-authored-by: derpy-duck <115193320+derpy-duck@users.noreply.github.com>
* Derpy duck testing improvements (#44)
* doLiquidate and liquidation checks
* move nativeeth requires into helper method, and combine doAction and doActionNative
* AddAsset struct around adding assets
* Move set price to helper function
* Combine test methods with their fail counterparts
* liquidation additional require statement about global supply
* Hub spoke cleanup combining methods (#45)
* Remove unnecessary variables
* Combine deposit borrow withdraw and repay structs and methods on hub; prevents relayer from choosing which functions to relay message to
* Remove unused test utility files related to creating signed WH messages for testing purposes
* Remove unnecessary spoke methods setters adn getters
* Remove unnecessary spoke imports
* Far cleaner Hub file
* Generalize HubMessages and HubStructs, and account for dust in Hub logging (#46)
* Remove transfer result struct (#47)
* Generalize HubMessages and HubStructs, and account for dust in Hub logging
* remove one struct
* remove one struct
* Hub specs (#48)
* Remove unnecessary test method
* Rename nConf to priceStandardDeviations
* Specs
* fix parse error
* subtract messageFee from amount when doing check
* Careful thinking about divisions as it relates to interest rates (#49)
* More specs (#50)
* More specs
* Add price specs
* prettier formatting
* docstring fix
* Successful interest rate and price conf tests (#52)
* Spoke spec for constructor
* Correct typo in spec
* Tidying and interest rate additions (#54)
* tidy up checks in completeAction on hub
* add some documentation around the double round up in allowedToRepay
* add piecewise linear interest rate model
* remove rate intercept and rate coefficient
* add checks for kinks and rates to be valid
* Test helper fix (#53)
* Consider dust in test, and use public getters or acocunt balances (#55)
* evm: fix yarn.lock
* evm: fix guardian set index
* evm: fix Makefile
* evm: fix stack too deep
* evm: fix README
* evm: remove lib/forge-std
Co-authored-by: Reptile <43194093+gator-boi@users.noreply.github.com>
Co-authored-by: gator-boi <gator-boi@users.noreply.github.com>
Co-authored-by: wrinkledLatherer <114771197+wrinkledLatherer@users.noreply.github.com>
Co-authored-by: derpy-duck <akadaveru@guse4c-ossdev-akl1.jumpisolated.com>
Co-authored-by: A5 Pickle <a5-pickle@users.noreply.github.com>
Co-authored-by: wrinkledLatherer <asuresh@dub2t-btcdevl1.w2k.jumptrading.com>