Skip to content

Matchstick settle call handler test #58

@anxolin

Description

@anxolin

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!

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions