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

Add accounting rules for new wrapped event subtypes #161

Merged
merged 1 commit into from
Feb 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 114 additions & 6 deletions updates/accounting_rules/v5.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,131 @@
"count_cost_basis_pnl": false,
"accounting_treatment": null
},
{
"event_type": "spend",
"event_subtype": "clawback",
"counterparty": null,
"taxable": true,
"count_entire_amount_spend": true,
"count_cost_basis_pnl": true,
"accounting_treatment": null
},
{
"event_type": "deposit",
"event_subtype": "deposit asset",
"counterparty": "aave-v2",
"event_subtype": "deposit for wrapped",
"counterparty": null,
"taxable": false,
"count_entire_amount_spend": false,
"count_cost_basis_pnl": true,
"accounting_treatment": null
},
{
"event_type": "spend",
"event_subtype": "clawback",
"event_type": "withdrawal",
"event_subtype": "redeem wrapped",
"counterparty": null,
"taxable": true,
"count_entire_amount_spend": true,
"taxable": false,
"count_entire_amount_spend": false,
"count_cost_basis_pnl": true,
"accounting_treatment": null
},
{
"event_type": "staking",
"event_subtype": "deposit for wrapped",
"counterparty": null,
"taxable": false,
"count_entire_amount_spend": false,
"count_cost_basis_pnl": false,
"accounting_treatment": null
},
{
"event_type": "staking",
"event_subtype": "redeem wrapped",
"counterparty": null,
"taxable": false,
"count_entire_amount_spend": false,
"count_cost_basis_pnl": false,
"accounting_treatment": null
},
{
"event_type": "deposit",
"event_subtype": "deposit for wrapped",
"counterparty": "aave-v1",
"taxable": false,
"count_entire_amount_spend": false,
"count_cost_basis_pnl": true,
"accounting_treatment": "SWAP"
},
{
"event_type": "deposit",
"event_subtype": "deposit for wrapped",
"counterparty": "aave-v3",
"taxable": false,
"count_entire_amount_spend": false,
"count_cost_basis_pnl": true,
"accounting_treatment": "SWAP"
Comment on lines +77 to +82
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aave v2 is missing here too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've skipped aave-v2 on purpose here. If you notice the aave-v2 deposit rule is being modified here: 73c7160 to not be treated as a SWAP, since aave v2 has its own accountant logic.
This actually makes it identical to the general (null counterparty) deposit/deposit for wrapped rule - so we shouldn't need any special rule for aave-v2.

Now I'm also realizing that the "edit" to the deposit asset rule for aave-v2 added in the PR I linked is no longer actually needed since its now deposit for wrapped and will be handled correctly by the general deposit for wrapped rule as explained above, so I'm removing that.

},
{
"event_type": "deposit",
"event_subtype": "deposit for wrapped",
"counterparty": "compound",
"taxable": false,
"count_entire_amount_spend": false,
"count_cost_basis_pnl": true,
"accounting_treatment": "SWAP"
},
{
"event_type": "deposit",
"event_subtype": "deposit for wrapped",
"counterparty": "compound-v3",
"taxable": false,
"count_entire_amount_spend": false,
"count_cost_basis_pnl": true,
"accounting_treatment": "SWAP"
},
{
"event_type": "deposit",
"event_subtype": "deposit for wrapped",
"counterparty": "Locked GNO",
"taxable": false,
"count_entire_amount_spend": false,
"count_cost_basis_pnl": true,
"accounting_treatment": "SWAP"
Comment on lines +103 to +109
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems that we have a rule also for remove asset... since you get a wrapped I guess you also need the redeem wrapped

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the existing rule for Locked GNO withdraw/remove asset is identical to the general withdraw/remove asset rule. I'm not sure why this counterparty specific rule was added when it doesn't specify anything different than what the general rule does. So I don't think we need anything special for Locked GNO with the new subtype. Also the old Locked GNO withdraw/remove asset rule should probably also be removed in the db upgrade you mentioned. Or is there something I'm not considering here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, then we need to remove it if it is identical to the general rule

},
{
"event_type": "deposit",
"event_subtype": "deposit for wrapped",
"counterparty": "yearn-v1",
"taxable": false,
"count_entire_amount_spend": false,
"count_cost_basis_pnl": true,
"accounting_treatment": "SWAP"
},
{
"event_type": "deposit",
"event_subtype": "deposit for wrapped",
"counterparty": "yearn-v2",
"taxable": false,
"count_entire_amount_spend": false,
"count_cost_basis_pnl": false,
"accounting_treatment": "SWAP"
},
{
"event_type": "withdrawal",
"event_subtype": "redeem wrapped",
"counterparty": "yearn-v1",
"taxable": false,
"count_entire_amount_spend": false,
"count_cost_basis_pnl": false,
"accounting_treatment": "SWAP"
},
{
"event_type": "withdrawal",
"event_subtype": "redeem wrapped",
"counterparty": "yearn-v2",
"taxable": false,
"count_entire_amount_spend": false,
"count_cost_basis_pnl": false,
"accounting_treatment": "SWAP"
}
]
}
Loading