Gnosis minimal implementation #11
                
     Draft
            
            
          
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
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 aUSDC in gnosis chain.
You can use Cowswap! Create a buy order for 20.01 0xc6B7AcA6DE8a6044E0e32d0c841a89244A10D284
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.
Additional info
To verify the script is doing the right thing, you can compare signatures with the following solidity unit test: