-
Notifications
You must be signed in to change notification settings - Fork 71
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
Add generic order type test suite #86
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great! just a few thoughts
|
||
MockERC20 tokenIn; | ||
MockERC20 tokenOut; | ||
MockFillContract fillContract; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to note, and maybe this can be a different suite but we could test different fillContract strategies in a generic way as well. Would be nice to be sure that the matrix of [reactorType, fillContract] all works properly together
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that would be cool, I'll look into that - what fillContracts do we have so far? Is it just DirectTaker and UniV3Executor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but we def need to add a UR executor and maybe like order matching logic?
vm.expectEmit(false, false, false, true, address(reactor)); | ||
emit Fill(orderHash, address(this), maker, orderInfo.nonce); | ||
// execute order | ||
snapStart(string.concat(name(), "BaseExecuteSingle")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sweet, love the customized name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mark's genius work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking good to me! agree w/ saras comments tho
|
||
MockERC20 tokenIn; | ||
MockERC20 tokenOut; | ||
MockFillContract fillContract; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup
|
||
MockERC20 tokenIn; | ||
MockERC20 tokenOut; | ||
MockFillContract fillContract; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but we def need to add a UR executor and maybe like order matching logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, not sure about @marktoda's comments though
import {Test} from "forge-std/Test.sol"; | ||
import "forge-std/console.sol"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can remove any console imports before merge
* continue Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * continue Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * add snapshot Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * continue Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * write testTwoOrders Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * continue Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * comment Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * write `testFillerHasInsufficientOutput` Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * fix merge main Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * write testSingleOrderWithFee Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * write testThreeOrdersWithFees() Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * remove code duplication Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * make permit2 an address that needs to be casted to appropriate interface Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * make DIRECT_TAKER_FILL constant Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * write testFillerLacksApproval() Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * make DIRECT_TAKER_FILL and internal variable Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * use SafeCast.toUint160 Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * delete DirectTakerExecutor.t.sol Signed-off-by: Allen Lin <allenlin1992@hotmail.com> --------- Signed-off-by: Allen Lin <allenlin1992@hotmail.com>
bc6cc3b
to
c2058a2
Compare
* Add test for NonceReuse to DLO reactor test * Ok have something, testExecute in baseTest passes, but only limit order specific rn * remove comment * Change to createAndSignOrder and use abiEncodedOrder in base tests * Add signature replay base test * Add inputAmount, outputAmount to createAndSignOrder * Add base prefix to BaseReactorTest * Remove extra createReactor call * Add test for BaseExecuteBatch, and createAndSignBatchOrders * Clean up and add comments * Refactor createSginOrder to return SignedOrder and other resolved comments * Remove virtual from base tests * Allow specification of OrderInfo in generic func * compiles! * Update gas snaps * Add NonceReuse base test * Add comments * Add comments * Remove nonceReuse from dutchLimit * forge fmt * Revisions, and add ArrayBuilder to create 1d and 2d arays easier * Add support in LimitOrderReactor.t.sol for batch orders with multiple outputs * Direct taker macro (#77) * continue Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * continue Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * add snapshot Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * continue Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * write testTwoOrders Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * continue Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * comment Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * write `testFillerHasInsufficientOutput` Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * fix merge main Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * write testSingleOrderWithFee Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * write testThreeOrdersWithFees() Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * remove code duplication Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * make permit2 an address that needs to be casted to appropriate interface Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * make DIRECT_TAKER_FILL constant Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * write testFillerLacksApproval() Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * make DIRECT_TAKER_FILL and internal variable Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * use SafeCast.toUint160 Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * delete DirectTakerExecutor.t.sol Signed-off-by: Allen Lin <allenlin1992@hotmail.com> --------- Signed-off-by: Allen Lin <allenlin1992@hotmail.com> * udpate gas snap * Remove redundant testExecutebatch * remove old gas snap * change func in lib type to internal * remove unused initNested * Remove console import and sign * add .gitignore --------- Signed-off-by: Allen Lin <allenlin1992@hotmail.com> Co-authored-by: AzFlin <allenlin1992@hotmail.com>
Fix #83