Skip to content
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

Matchstick settle call handler test #58

Open
anxolin opened this issue Aug 23, 2022 · 0 comments
Open

Matchstick settle call handler test #58

anxolin opened this issue Aug 23, 2022 · 0 comments
Assignees
Labels
Protofire Subgraph Subgraph related task

Comments

@anxolin
Copy link
Contributor

anxolin commented Aug 23, 2022

Start indexing and testing the contract settle call.
Decoding Signed Orders
We need to decode the settlement, and get all the order information and attach it to the Order entity. All + are missing fields that should be added in ther order

struct Data {
       uint256 sellTokenIndex;
       uint256 buyTokenIndex;
       address receiver; +
       uint256 sellAmount; +
       uint256 buyAmount; +
       uint32 validTo; +
       bytes32 appData; +
           --> convert hash into a CID (the hashing algo and size is implied)
           ---> query JSON in IPFS
       uint256 feeAmount;
       uint256 flags; + (sell/buy order + partiallyFillable + signingScheme + some fields for using internal balancer vault balances wich is less relevant right now, might be in the future)
       uint256 executedAmount;
       bytes signature;
   }
 

Decode the calldata from Settlement event. Example
Then [encode appData into IPFS CID](https://github.com/cowprotocol/cow-sdk/blob/0708de8067d0560d1cfe66d0908b821ee81330bf/src/api/metadata/index.ts#L47=
Actual decoding here https://github.com/cowprotocol/cow-sdk/blob/0708de8067d0560d1cfe66d0908b821ee81330bf/src/utils/appData.ts#L27)
Sample app minimal app with that logic
Where is this info coming from?
https://github.com/cowprotocol/contracts/blob/4ce7a9e54b9ff11593e22d10e2852b734e6abe23/src/contracts/GPv2Settlement.sol#L121

We need to test this as soon as we start and ask for @anxolin and @alfetopito for examples for this calls for being able to test the mapping before deploying anything. The idea is to deliver as fast as we can!

@anxolin anxolin transferred this issue from cowprotocol/cowswap Aug 23, 2022
@GabrielCamba GabrielCamba self-assigned this Aug 23, 2022
@GabrielCamba GabrielCamba added the Subgraph Subgraph related task label Aug 23, 2022
@GabrielCamba GabrielCamba changed the title Matchstick settlement call handler test Matchstick settle call handler test Aug 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Protofire Subgraph Subgraph related task
Projects
None yet
Development

No branches or pull requests

2 participants