Skip to content

Commit

Permalink
Update accointing parser to remove self-transfer ignore line (#511)
Browse files Browse the repository at this point in the history
* Update accointing parser to remove self-transfer ignore line

* Make tests pass
  • Loading branch information
pharr117 authored Oct 29, 2023
1 parent eaae9b4 commit cf79380
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
2 changes: 1 addition & 1 deletion csv/accounting_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestAccointingIbcMsgTransferSelf(t *testing.T) {
cols := row.GetRowForCsv()
// transfer message should be a 'withdraw' from the sender's perspective
assert.Equal(t, "withdraw", cols[0], "transaction type should be a withdrawal")
assert.Equal(t, "ignored", cols[8], "transaction should not have a classification")
assert.Equal(t, "", cols[8], "transaction should not have a classification")
}
}

Expand Down
14 changes: 0 additions & 14 deletions csv/parsers/accointing/accointing.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"time"

"github.com/DefiantLabs/cosmos-tax-cli/config"
"github.com/DefiantLabs/cosmos-tax-cli/core"
"github.com/DefiantLabs/cosmos-tax-cli/cosmos/modules/bank"
"github.com/DefiantLabs/cosmos-tax-cli/cosmos/modules/distribution"
"github.com/DefiantLabs/cosmos-tax-cli/cosmos/modules/gov"
Expand Down Expand Up @@ -370,19 +369,6 @@ func ParseMsgSwapExactAmountOut(event db.TaxableTransaction) (Row, error) {
func ParseMsgTransfer(address string, event db.TaxableTransaction) (Row, error) {
row := &Row{}
err := row.ParseBasic(address, event)
selfTransfer := false

senderAddrPrefix := core.GetAddressPrefix(event.SenderAddress.Address)
receiverAddrPrefix := core.GetAddressPrefix(event.ReceiverAddress.Address)
if senderAddrPrefix != "" && receiverAddrPrefix != "" {
selfTransfer = core.IsAddressEqual(event.SenderAddress.Address, senderAddrPrefix, event.ReceiverAddress.Address, receiverAddrPrefix)
}

// The base bech32 address was the same, so this was a self transfer and is not taxable
if selfTransfer {
row.Classification = Ignored
}

if err != nil {
config.Log.Error("Error with ParseMsgTransfer.", err)
}
Expand Down

0 comments on commit cf79380

Please sign in to comment.