Grant application: Integration CoW Swap trading history into Rotki


Grant Title:

Rotki support for CoW Swap trading history


Author:

@celkacelka


About You:

rotki is an open source portfolio tracking, analytics, accounting and tax reporting tool that protects your privacy. The mission of rotki is to bring transparency into the crypto and financial sectors through the use of open source. Most importantly unlike virtually every other competing service which consists of closed source SaaS onto which you are forced to hand over all your financial data, with rotki your data is stored encrypted locally in your computer. It enables you to take ownership of your financial data!

Tech Stack:
Backend: Python

Frontend: Vue JS\Typescript


Additional Links:

Website: https://rotki.com

Github: https://github.com/rotki/rotki

Usage guide: (link had to be edited out due to the new user link limit, but can be found in the website)

Discord: (link had to be edited out due to the new user link limit, but can be found in the website)


Grant Category:

CoWmunity growth


Grant Description:

This integration will allow all Rotki users to clearly view their trading history from CoW Swap. Once completed a user of rotki should be able to go to their transaction view and see all the CoW Swap transactions properly decoded.

Furthermore when creating a PnL report those trades should be taken into account and the user should be able to figure out their profit and loss made through those in any given time.


Grant Goals and impact:

The main goal of this grant is creating a trusted verifiable and privacy preserving venue for CoW traders to track their trading history.


Milestones:

Milestone Due (Date) Payment
Open source decoders for CoW Swap trades Once the grant is approved. -
Integration into Rotki Once finished included in the next release. 6K$

Milestone 1

Implementation of transaction decoders for CoW Swap transactions in the Ethereum chain. Testing for those decoders.

Milestone 2

Front end and UI for CoW Swap decoders in rotki. Integration of the entire feature and inclusion in an actual rotki production release.


Funding Request:

For integrating cowswap in rotki it will take 1 backend dev 2 weeks and 1 frontend dev 1 week.
With a 50% markup for paying taxes on the grant and for handling other unforeseen problems it’s $9k after which all historical transaction accounting for cowswap should be integrated in rotki and the open source decoders for CoW Swap trades will be developed.

CoW Grants will cover $6k ($3k in advance, and $3k upon completion)

Rotki will cover the remaining $3k


Budget Breakdown:

Development: $9k xDAI


Gnosis Chain Address (to receive the grant):

0x9531C059098e3d194fF87FebB587aB07B30B1306


Referral:

Proposal was developed in collaboration with middleway.eth


Terms and conditions:

By applying for this grant, I agree to be bound by the CowDAO Participation Agreement and the COWDAO Grant Terms and Conditions.

4 Likes

Rokti is a fantastic tool and believe this integration will help users of CoW Swap track their trading history. I am in support of this grant application.

3 Likes

This looks great, and glad that Cowswap users will be able to benefit from it. I’m in favour of tighter integration between Cowswap and Rotki.

3 Likes

Since sufficient time has passed and no objections have been raised I have proceeded with submitting it for snapshot voting:
https://snapshot.org/#/cowgrants.eth/proposal/0x16c12c023ef6216198571f137aca0d78ba3c3c4071945d18c9e31223d2e4e83b

2 Likes

Our team has started working on the integration this week!

3 Likes

The up-front component of this grant has been paid: Gnosis Transaction Hash (Txhash) Details | GnosisScan

2 Likes

We have just made the release including CoW Swap integration! :partying_face: :partying_face: :partying_face: :partying_face: :partying_face: :bird: :cupid: :cow:

Download the newest version from our website or when logging in to your account in the app.

2 Likes

Thanks for the update! Exciting!
Can you please also point up to the github repo and code section of the integration so the grant committee can evaluate the delivery in preparation of processing the final payment?

I unfortunately seem to be unable to post links, but:
github: github(dot)com/rotki/rotki/tree/develop/rotkehlchen/chain/ethereum/modules/cowswap

new release: github(dot)com/rotki/rotki/releases/tag/v1.28.0

and a visual tl;dr :wink:

3 Likes

Hi,
Thanks, I’ve recently been going through and testing this integration for Cowswap as you mentioned.

Looking at the decode that’s been done, it seems that there are some decoded information that is missing. Notably, the fee isn’t being displayed, and therefore this can affect PnL / tax calculations with respect to capital gains tax / net cost calculations depending on the taxation jurisdiction.

Can this be adjusted to display the swap, including a line transaction showing the fee being split out?

Hey,

Apart from the fee is there anything else you think is missing or could be added? For the PnL report it makes no difference as the fee is part of the amount and as such both the amount you spend and the cost basis of the corresponding asset you buy is correct.

If we can find the fee on-chain we can add it in a subsequent release.

Hey,
Yes the fee amount is definitely available on-chain, in the form of the Trade event:

    event Trade(
        address indexed owner,
        IERC20 sellToken,
        IERC20 buyToken,
        uint256 sellAmount,
        uint256 buyAmount,
        uint256 feeAmount,
        bytes orderUid
    );

From a PnL perspective, I agree that you’re right that it doesn’t make a difference if it’s in the base cost or not. Just trying to make sure that those that use Rotki for tax calculations (and ensuring a “cover-all” case), can determine what they need to with respect to their CoW Swap transactions (they may be required to be placed in the cost base of the asset, or some jurisdictions may require/allow them to be broken out separately).

The concluding payment for this grant has been executed in the following transaction

We’d love to collaborate and see the accounting improvements included in the next release

2 Likes

Hey @mfw78 @middleway.eth I spent the weekend adding the fee as extra information. It turned out being (as usual :sweat_smile:) more complicated than I expected. The PR is here and is merged: cowswap trade fees by LefterisJP · Pull Request #6277 · rotki/rotki · GitHub

That means it will be included in 1.29, the next major release.

The result of this is that cowswap fees will be seen as a separate event and taken separately into account in the PnL calculation. Though result should be the same for the PnL settings.

Most nice is that when you look at a cowswap trade you will see the fee. For comparison here is a trade from my account. Before:

1 Like

And after: (putting it in a different post due to “new user limitations”)

2 Likes

Super nice! appreciate it!

Hey, this is great! Thanks for this improvement :pray: