Conversation
anxolin
left a comment
There was a problem hiding this comment.
I didn't get is why you opted out of the SDKs. The code should be way simpler (for appData generation, posting orders, etc.
Ideally, AAVE uses the SDK. If there's any issue with the SDK we can easily address. For example, if the hint is not there in the appData project, there's ways to still use the SDK and add it (I showed how in the PR used to kickstart your PoC).
This is a PoC so, its not like I care a lot, but if we don't dogfood the SDK, we migh make it harder for others to us too. AAVE uses it in the ui, and the code it generates is safer and accounts many of the pitfalls we observed over time.
I didn't see you getting a quote. Wouldn't it be important to test it too? If you use the SDK for this, you will be end-to-end testing with the right slippage tolerances, and would be getting things as close as it gets to production. This takes me to the next point, why BARN? (can we test it in PROD?)
Also, is the EOA signature mocked? How can that work?
// @ts-ignore The flash-loan hint is still not added officially to https://github.com/cowprotocol/app-dataThis didn't work for me. SDK rejected the order creation.
Using quote directly means different parameters which changed the deterministic address. I went with limit order to make the order creation reproducible.
Backend change is not in prod yet. |
GIST
This is a very hardcoded script to create a limit order to test the flashloan logic e2e.
This is not supposed to be merged.
This script will send an order to gnosis staging.
HOWTO RUN
Setup your wallet/position
Use your deployer wallet to test.
You will need to hold 20 aWXDAI in gnosis chain.
You can use Cowswap!
Once you get your collateral, get some debt.
Go to aave: https://app.aave.com/reserve-overview/?underlyingAsset=0x9c58bacc331c9aa871afd802db6379a98e80cedb&marketName=proto_gnosis_v3
and borrow 0.01 GNO.
Borrowing tokens in aave will lock your full collateral to be moved.
Create an .env file with:
Modify the script to use a valid
VALID_FORSince the deterministic contract depends on
VALID_FORit's better to hardcode a value to avoid approving a contract over and over again. Get a value in the future from https://www.epochconverter.com/I usually do 4hs. I think the backend has an error when it's too many days ahead in the future.
Run with the script
You will need to have node and dependencies and you can run with:
It will ask you to approve the token to the deterministic helper address for the order parameters.
You should do this only once per order.
NOTE: The order creation will fail. The error you will get is the following:
This is a bug in the backend and needs to be fixed.
To continue testing without the fix, transfer 1 wei of your sell token into the helper contract.
Go here:
https://gnosisscan.io/address/0xc6B7AcA6DE8a6044E0e32d0c841a89244A10D284#writeProxyContract#F10
and do something like this after connecting your wallet:
Re-run the script and you will see a 201. The order should be created but I am not seeing the order reaching solvers.