diff --git a/services/wallet/router/pathprocessor/common.go b/services/wallet/router/pathprocessor/common.go index ff8b5741e..3194b28e2 100644 --- a/services/wallet/router/pathprocessor/common.go +++ b/services/wallet/router/pathprocessor/common.go @@ -3,6 +3,7 @@ package pathprocessor import ( "fmt" "math/big" + "strings" ethTypes "github.com/ethereum/go-ethereum/core/types" @@ -25,3 +26,10 @@ func makeKey(fromChain, toChain uint64, fromTokenSymbol, toTokenSymbol string) s } return fmt.Sprintf("%d-%d", fromChain, toChain) } + +func getNameFromEnsUsername(ensUsername string) string { + if strings.HasSuffix(ensUsername, StatusDomain) { + return ensUsername[:len(ensUsername)-len(StatusDomain)] + } + return ensUsername +} diff --git a/services/wallet/router/pathprocessor/common_test.go b/services/wallet/router/pathprocessor/common_test.go new file mode 100644 index 000000000..ea0a5f3ef --- /dev/null +++ b/services/wallet/router/pathprocessor/common_test.go @@ -0,0 +1,21 @@ +package pathprocessor + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestGettingNameFromEnsUsername(t *testing.T) { + ensName := "test" + name := getNameFromEnsUsername(ensName) + require.Equal(t, ensName, name) + + ensStatusName := "test.stateofus.eth" + name = getNameFromEnsUsername(ensStatusName) + require.Equal(t, ensName, name) + + ensNotStatusName := "test.eth" + name = getNameFromEnsUsername(ensNotStatusName) + require.Equal(t, ensNotStatusName, name) +} diff --git a/services/wallet/router/pathprocessor/constants.go b/services/wallet/router/pathprocessor/constants.go index 0d4ad4a9a..7b128e515 100644 --- a/services/wallet/router/pathprocessor/constants.go +++ b/services/wallet/router/pathprocessor/constants.go @@ -4,6 +4,9 @@ const ( IncreaseEstimatedGasFactor = 1.1 SevenDaysInSeconds = 60 * 60 * 24 * 7 + StatusDomain = ".stateofus.eth" + EthDomain = ".eth" + EthSymbol = "ETH" SntSymbol = "SNT" SttSymbol = "STT" diff --git a/services/wallet/router/pathprocessor/processor_ens_release.go b/services/wallet/router/pathprocessor/processor_ens_release.go index e269e7a29..eea13b6e2 100644 --- a/services/wallet/router/pathprocessor/processor_ens_release.go +++ b/services/wallet/router/pathprocessor/processor_ens_release.go @@ -57,7 +57,8 @@ func (s *ENSReleaseProcessor) PackTxInputData(params ProcessorInputParams) ([]by return []byte{}, createENSReleaseErrorResponse(err) } - return registrarABI.Pack("release", ens.UsernameToLabel(params.Username)) + name := getNameFromEnsUsername(params.Username) + return registrarABI.Pack("release", ens.UsernameToLabel(name)) } func (s *ENSReleaseProcessor) EstimateGas(params ProcessorInputParams) (uint64, error) { diff --git a/services/wallet/router/sendtype/send_type.go b/services/wallet/router/sendtype/send_type.go index c6f8381a9..e69232b0e 100644 --- a/services/wallet/router/sendtype/send_type.go +++ b/services/wallet/router/sendtype/send_type.go @@ -128,7 +128,7 @@ func (s SendType) ProcessZeroAmountInProcessor(amountIn *big.Int, amountOut *big if amountOut.Cmp(walletCommon.ZeroBigIntValue()) == 0 { return false } - } else { + } else if s != ENSRelease { return false } }