From dea949e9f6fc804220c838f96dd450879295fa3a Mon Sep 17 00:00:00 2001 From: pharr117 Date: Sun, 28 Jan 2024 16:16:28 -0500 Subject: [PATCH] Tokenfactory csv parsers --- csv/parsers/accointing/accointing.go | 13 +++++++++++++ csv/parsers/cointracker/cointracker.go | 13 +++++++++++++ .../cryptotaxcalculator/cryptotaxcalculator.go | 13 +++++++++++++ csv/parsers/koinly/koinly.go | 13 +++++++++++++ csv/parsers/taxbit/taxbit.go | 13 +++++++++++++ 5 files changed, 65 insertions(+) diff --git a/csv/parsers/accointing/accointing.go b/csv/parsers/accointing/accointing.go index a3d7b78..1eaf81f 100644 --- a/csv/parsers/accointing/accointing.go +++ b/csv/parsers/accointing/accointing.go @@ -16,6 +16,7 @@ import ( "github.com/DefiantLabs/cosmos-tax-cli/osmosis/modules/concentratedliquidity" "github.com/DefiantLabs/cosmos-tax-cli/osmosis/modules/gamm" "github.com/DefiantLabs/cosmos-tax-cli/osmosis/modules/poolmanager" + "github.com/DefiantLabs/cosmos-tax-cli/osmosis/modules/tokenfactory" "github.com/DefiantLabs/cosmos-tax-cli/osmosis/modules/valsetpref" "github.com/DefiantLabs/cosmos-tax-cli/util" ) @@ -256,6 +257,8 @@ func ParseTx(address string, events []db.TaxableTransaction) (rows []parsers.Csv newRow, err = ParseConcentratedLiquidityCollection(event) case valsetpref.MsgDelegateBondedTokens, valsetpref.MsgUndelegateFromValidatorSet, valsetpref.MsgRedelegateValidatorSet, valsetpref.MsgWithdrawDelegationRewards, valsetpref.MsgDelegateToValidatorSet, valsetpref.MsgUndelegateFromRebalancedValidatorSet: newRow, err = ParseValsetPrefRewards(event) + case tokenfactory.MsgMint, tokenfactory.MsgBurn: + newRow, err = ParseTokenFactoryEvents(address, event) default: config.Log.Errorf("no parser for message type '%v'", event.Message.MessageType.MessageType) continue @@ -478,3 +481,13 @@ func ParseValsetPrefRewards(event db.TaxableTransaction) (Row, error) { return *row, nil } + +func ParseTokenFactoryEvents(address string, event db.TaxableTransaction) (Row, error) { + row := &Row{} + err := row.ParseBasic(address, event) + if err != nil { + config.Log.Error("Error with ParseMsgMultiSend.", err) + } + + return *row, nil +} diff --git a/csv/parsers/cointracker/cointracker.go b/csv/parsers/cointracker/cointracker.go index 7a191d0..f55a1c6 100644 --- a/csv/parsers/cointracker/cointracker.go +++ b/csv/parsers/cointracker/cointracker.go @@ -16,6 +16,7 @@ import ( "github.com/DefiantLabs/cosmos-tax-cli/osmosis/modules/concentratedliquidity" "github.com/DefiantLabs/cosmos-tax-cli/osmosis/modules/gamm" "github.com/DefiantLabs/cosmos-tax-cli/osmosis/modules/poolmanager" + "github.com/DefiantLabs/cosmos-tax-cli/osmosis/modules/tokenfactory" "github.com/DefiantLabs/cosmos-tax-cli/osmosis/modules/valsetpref" "github.com/DefiantLabs/cosmos-tax-cli/util" ) @@ -218,6 +219,8 @@ func ParseTx(address string, events []db.TaxableTransaction, fees []db.Fee) (row newRow, err = ParseConcentratedLiquidityCollection(event) case valsetpref.MsgDelegateBondedTokens, valsetpref.MsgUndelegateFromValidatorSet, valsetpref.MsgRedelegateValidatorSet, valsetpref.MsgWithdrawDelegationRewards, valsetpref.MsgDelegateToValidatorSet, valsetpref.MsgUndelegateFromRebalancedValidatorSet: newRow, err = ParseValsetPrefRewards(event) + case tokenfactory.MsgMint, tokenfactory.MsgBurn: + newRow, err = ParseTokenFactoryEvents(address, event) default: config.Log.Errorf("no parser for message type '%v'", event.Message.MessageType.MessageType) continue @@ -458,3 +461,13 @@ func ParseValsetPrefRewards(event db.TaxableTransaction) (Row, error) { return *row, nil } + +func ParseTokenFactoryEvents(address string, event db.TaxableTransaction) (Row, error) { + row := &Row{} + err := row.ParseBasic(address, event) + if err != nil { + config.Log.Error("Error with ParseMsgMultiSend.", err) + } + + return *row, nil +} diff --git a/csv/parsers/cryptotaxcalculator/cryptotaxcalculator.go b/csv/parsers/cryptotaxcalculator/cryptotaxcalculator.go index 6914a83..9e3d4ef 100644 --- a/csv/parsers/cryptotaxcalculator/cryptotaxcalculator.go +++ b/csv/parsers/cryptotaxcalculator/cryptotaxcalculator.go @@ -16,6 +16,7 @@ import ( "github.com/DefiantLabs/cosmos-tax-cli/osmosis/modules/concentratedliquidity" "github.com/DefiantLabs/cosmos-tax-cli/osmosis/modules/gamm" "github.com/DefiantLabs/cosmos-tax-cli/osmosis/modules/poolmanager" + "github.com/DefiantLabs/cosmos-tax-cli/osmosis/modules/tokenfactory" "github.com/DefiantLabs/cosmos-tax-cli/osmosis/modules/valsetpref" "github.com/DefiantLabs/cosmos-tax-cli/util" ) @@ -219,6 +220,8 @@ func ParseTx(address string, events []db.TaxableTransaction) (rows []parsers.Csv newRow, err = ParseConcentratedLiquidityCollection(event) case valsetpref.MsgDelegateBondedTokens, valsetpref.MsgUndelegateFromValidatorSet, valsetpref.MsgRedelegateValidatorSet, valsetpref.MsgWithdrawDelegationRewards, valsetpref.MsgDelegateToValidatorSet, valsetpref.MsgUndelegateFromRebalancedValidatorSet: newRow, err = ParseValsetPrefRewards(event) + case tokenfactory.MsgMint, tokenfactory.MsgBurn: + newRow, err = ParseTokenFactoryEvents(address, event) default: config.Log.Errorf("no parser for message type '%v'", event.Message.MessageType.MessageType) continue @@ -442,3 +445,13 @@ func ParseValsetPrefRewards(event db.TaxableTransaction) (Row, error) { return *row, nil } + +func ParseTokenFactoryEvents(address string, event db.TaxableTransaction) (Row, error) { + row := &Row{} + err := row.ParseBasic(address, event) + if err != nil { + config.Log.Error("Error with ParseMsgMultiSend.", err) + } + + return *row, nil +} diff --git a/csv/parsers/koinly/koinly.go b/csv/parsers/koinly/koinly.go index b63511a..427052a 100644 --- a/csv/parsers/koinly/koinly.go +++ b/csv/parsers/koinly/koinly.go @@ -18,6 +18,7 @@ import ( "github.com/DefiantLabs/cosmos-tax-cli/osmosis/modules/concentratedliquidity" "github.com/DefiantLabs/cosmos-tax-cli/osmosis/modules/gamm" "github.com/DefiantLabs/cosmos-tax-cli/osmosis/modules/poolmanager" + "github.com/DefiantLabs/cosmos-tax-cli/osmosis/modules/tokenfactory" "github.com/DefiantLabs/cosmos-tax-cli/osmosis/modules/valsetpref" "github.com/DefiantLabs/cosmos-tax-cli/util" ) @@ -322,6 +323,8 @@ func ParseTx(address string, events []db.TaxableTransaction) (rows []parsers.Csv newRow, err = ParseConcentratedLiquidityCollection(event) case valsetpref.MsgDelegateBondedTokens, valsetpref.MsgUndelegateFromValidatorSet, valsetpref.MsgRedelegateValidatorSet, valsetpref.MsgWithdrawDelegationRewards, valsetpref.MsgDelegateToValidatorSet, valsetpref.MsgUndelegateFromRebalancedValidatorSet: newRow, err = ParseValsetPrefRewards(event) + case tokenfactory.MsgMint, tokenfactory.MsgBurn: + newRow, err = ParseTokenFactoryEvents(address, event) default: config.Log.Errorf("no parser for message type '%v'", event.Message.MessageType.MessageType) continue @@ -543,3 +546,13 @@ func ParseValsetPrefRewards(event db.TaxableTransaction) (Row, error) { return *row, nil } + +func ParseTokenFactoryEvents(address string, event db.TaxableTransaction) (Row, error) { + row := &Row{} + err := row.ParseBasic(address, event) + if err != nil { + config.Log.Error("Error with ParseMsgMultiSend.", err) + } + + return *row, nil +} diff --git a/csv/parsers/taxbit/taxbit.go b/csv/parsers/taxbit/taxbit.go index 03dda77..2dfbffe 100644 --- a/csv/parsers/taxbit/taxbit.go +++ b/csv/parsers/taxbit/taxbit.go @@ -14,6 +14,7 @@ import ( "github.com/DefiantLabs/cosmos-tax-cli/db" "github.com/DefiantLabs/cosmos-tax-cli/osmosis/modules/gamm" "github.com/DefiantLabs/cosmos-tax-cli/osmosis/modules/poolmanager" + "github.com/DefiantLabs/cosmos-tax-cli/osmosis/modules/tokenfactory" "github.com/DefiantLabs/cosmos-tax-cli/osmosis/modules/valsetpref" ) @@ -249,6 +250,8 @@ func ParseTx(address string, events []db.TaxableTransaction) (rows []parsers.Csv newRow, err = ParsePoolManagerSwap(event) case valsetpref.MsgDelegateBondedTokens, valsetpref.MsgUndelegateFromValidatorSet, valsetpref.MsgRedelegateValidatorSet, valsetpref.MsgWithdrawDelegationRewards, valsetpref.MsgDelegateToValidatorSet, valsetpref.MsgUndelegateFromRebalancedValidatorSet: newRow, err = ParseValsetPrefRewards(event) + case tokenfactory.MsgMint, tokenfactory.MsgBurn: + newRow, err = ParseTokenFactoryEvents(address, event) default: config.Log.Errorf("no parser for message type '%v'", event.Message.MessageType.MessageType) continue @@ -394,3 +397,13 @@ func ParseValsetPrefRewards(event db.TaxableTransaction) (Row, error) { return *row, nil } + +func ParseTokenFactoryEvents(address string, event db.TaxableTransaction) (Row, error) { + row := &Row{} + err := row.ParseBasic(address, event) + if err != nil { + config.Log.Error("Error with ParseMsgMultiSend.", err) + } + + return *row, nil +}