chore_: move path constants to wallet common location
This commit is contained in:
parent
f76cff7e3f
commit
4a7031b455
|
@ -1,6 +1,7 @@
|
||||||
package common
|
package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"math/big"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -32,8 +33,6 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ZeroAddress = ethCommon.HexToAddress("0x0000000000000000000000000000000000000000")
|
|
||||||
|
|
||||||
SupportedNetworks = map[uint64]bool{
|
SupportedNetworks = map[uint64]bool{
|
||||||
EthereumMainnet: true,
|
EthereumMainnet: true,
|
||||||
OptimismMainnet: true,
|
OptimismMainnet: true,
|
||||||
|
@ -56,6 +55,14 @@ const (
|
||||||
ContractTypeERC1155
|
ContractTypeERC1155
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func ZeroAddress() ethCommon.Address {
|
||||||
|
return ethCommon.Address{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func ZeroBigIntValue() *big.Int {
|
||||||
|
return big.NewInt(0)
|
||||||
|
}
|
||||||
|
|
||||||
func (c ChainID) String() string {
|
func (c ChainID) String() string {
|
||||||
return strconv.FormatUint(uint64(c), 10)
|
return strconv.FormatUint(uint64(c), 10)
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ func (p *MercuryoProvider) GetURL(ctx context.Context, parameters Parameters) (s
|
||||||
widgetSecret = "AZ5fmxmrgyrXH3zre6yHU2Vw9fPqEw82" // #nosec G101
|
widgetSecret = "AZ5fmxmrgyrXH3zre6yHU2Vw9fPqEw82" // #nosec G101
|
||||||
)
|
)
|
||||||
|
|
||||||
if parameters.DestAddress == nil || *parameters.DestAddress == walletCommon.ZeroAddress {
|
if parameters.DestAddress == nil || *parameters.DestAddress == walletCommon.ZeroAddress() {
|
||||||
return "", errors.New("destination address is required")
|
return "", errors.New("destination address is required")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,8 +123,8 @@ func (i *RouteInputParams) Validate() error {
|
||||||
|
|
||||||
if i.AmountIn != nil &&
|
if i.AmountIn != nil &&
|
||||||
i.AmountOut != nil &&
|
i.AmountOut != nil &&
|
||||||
i.AmountIn.ToInt().Cmp(pathprocessor.ZeroBigIntValue) > 0 &&
|
i.AmountIn.ToInt().Cmp(walletCommon.ZeroBigIntValue()) > 0 &&
|
||||||
i.AmountOut.ToInt().Cmp(pathprocessor.ZeroBigIntValue) > 0 {
|
i.AmountOut.ToInt().Cmp(walletCommon.ZeroBigIntValue()) > 0 {
|
||||||
return ErrSwapAmountInAmountOutMustBeExclusive
|
return ErrSwapAmountInAmountOutMustBeExclusive
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||||
"github.com/status-im/status-go/services/wallet/common"
|
"github.com/status-im/status-go/services/wallet/common"
|
||||||
"github.com/status-im/status-go/services/wallet/router/pathprocessor"
|
walletCommon "github.com/status-im/status-go/services/wallet/common"
|
||||||
"github.com/status-im/status-go/services/wallet/router/routes"
|
"github.com/status-im/status-go/services/wallet/router/routes"
|
||||||
|
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
@ -108,7 +108,7 @@ func setupRouteValidationMaps(fromLockedAmount map[uint64]*hexutil.Big) (map[uin
|
||||||
fromExcluded := make(map[uint64]bool)
|
fromExcluded := make(map[uint64]bool)
|
||||||
|
|
||||||
for chainID, amount := range fromLockedAmount {
|
for chainID, amount := range fromLockedAmount {
|
||||||
if amount.ToInt().Cmp(pathprocessor.ZeroBigIntValue) <= 0 {
|
if amount.ToInt().Cmp(walletCommon.ZeroBigIntValue()) <= 0 {
|
||||||
fromExcluded[chainID] = false
|
fromExcluded[chainID] = false
|
||||||
} else {
|
} else {
|
||||||
fromIncluded[chainID] = false
|
fromIncluded[chainID] = false
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||||
|
|
||||||
"github.com/status-im/status-go/params"
|
"github.com/status-im/status-go/params"
|
||||||
"github.com/status-im/status-go/services/wallet/router/pathprocessor"
|
walletCommon "github.com/status-im/status-go/services/wallet/common"
|
||||||
"github.com/status-im/status-go/services/wallet/router/routes"
|
"github.com/status-im/status-go/services/wallet/router/routes"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
@ -94,9 +94,9 @@ func TestSetupRouteValidationMaps(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "Mixed zero and non-zero amounts",
|
name: "Mixed zero and non-zero amounts",
|
||||||
fromLockedAmount: map[uint64]*hexutil.Big{
|
fromLockedAmount: map[uint64]*hexutil.Big{
|
||||||
1: (*hexutil.Big)(pathprocessor.ZeroBigIntValue),
|
1: (*hexutil.Big)(walletCommon.ZeroBigIntValue()),
|
||||||
2: (*hexutil.Big)(big.NewInt(200)),
|
2: (*hexutil.Big)(big.NewInt(200)),
|
||||||
3: (*hexutil.Big)(pathprocessor.ZeroBigIntValue),
|
3: (*hexutil.Big)(walletCommon.ZeroBigIntValue()),
|
||||||
4: (*hexutil.Big)(big.NewInt(400)),
|
4: (*hexutil.Big)(big.NewInt(400)),
|
||||||
},
|
},
|
||||||
expectedIncluded: map[uint64]bool{
|
expectedIncluded: map[uint64]bool{
|
||||||
|
@ -123,8 +123,8 @@ func TestSetupRouteValidationMaps(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "All zero amounts",
|
name: "All zero amounts",
|
||||||
fromLockedAmount: map[uint64]*hexutil.Big{
|
fromLockedAmount: map[uint64]*hexutil.Big{
|
||||||
1: (*hexutil.Big)(pathprocessor.ZeroBigIntValue),
|
1: (*hexutil.Big)(walletCommon.ZeroBigIntValue()),
|
||||||
2: (*hexutil.Big)(pathprocessor.ZeroBigIntValue),
|
2: (*hexutil.Big)(walletCommon.ZeroBigIntValue()),
|
||||||
},
|
},
|
||||||
expectedIncluded: map[uint64]bool{},
|
expectedIncluded: map[uint64]bool{},
|
||||||
expectedExcluded: map[uint64]bool{
|
expectedExcluded: map[uint64]bool{
|
||||||
|
@ -145,7 +145,7 @@ func TestSetupRouteValidationMaps(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "Single zero amount",
|
name: "Single zero amount",
|
||||||
fromLockedAmount: map[uint64]*hexutil.Big{
|
fromLockedAmount: map[uint64]*hexutil.Big{
|
||||||
1: (*hexutil.Big)(pathprocessor.ZeroBigIntValue),
|
1: (*hexutil.Big)(walletCommon.ZeroBigIntValue()),
|
||||||
},
|
},
|
||||||
expectedIncluded: map[uint64]bool{},
|
expectedIncluded: map[uint64]bool{},
|
||||||
expectedExcluded: map[uint64]bool{
|
expectedExcluded: map[uint64]bool{
|
||||||
|
|
|
@ -1,16 +1,5 @@
|
||||||
package pathprocessor
|
package pathprocessor
|
||||||
|
|
||||||
import (
|
|
||||||
"math/big"
|
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
ZeroAddress = common.Address{}
|
|
||||||
ZeroBigIntValue = big.NewInt(0)
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
IncreaseEstimatedGasFactor = 1.1
|
IncreaseEstimatedGasFactor = 1.1
|
||||||
SevenDaysInSeconds = 60 * 60 * 24 * 7
|
SevenDaysInSeconds = 60 * 60 * 24 * 7
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/status-im/status-go/eth-node/types"
|
"github.com/status-im/status-go/eth-node/types"
|
||||||
|
walletCommon "github.com/status-im/status-go/services/wallet/common"
|
||||||
"github.com/status-im/status-go/transactions"
|
"github.com/status-im/status-go/transactions"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -31,7 +32,7 @@ func (t *MultipathProcessorTxArgs) Value() *big.Int {
|
||||||
return t.ERC1155TransferTx.Amount.ToInt()
|
return t.ERC1155TransferTx.Amount.ToInt()
|
||||||
}
|
}
|
||||||
|
|
||||||
return ZeroBigIntValue
|
return walletCommon.ZeroBigIntValue()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *MultipathProcessorTxArgs) From() types.Address {
|
func (t *MultipathProcessorTxArgs) From() types.Address {
|
||||||
|
|
|
@ -23,6 +23,7 @@ import (
|
||||||
"github.com/status-im/status-go/rpc"
|
"github.com/status-im/status-go/rpc"
|
||||||
|
|
||||||
"github.com/status-im/status-go/params"
|
"github.com/status-im/status-go/params"
|
||||||
|
walletCommon "github.com/status-im/status-go/services/wallet/common"
|
||||||
"github.com/status-im/status-go/services/wallet/router/pathprocessor/cbridge"
|
"github.com/status-im/status-go/services/wallet/router/pathprocessor/cbridge"
|
||||||
"github.com/status-im/status-go/services/wallet/thirdparty"
|
"github.com/status-im/status-go/services/wallet/thirdparty"
|
||||||
"github.com/status-im/status-go/services/wallet/token"
|
"github.com/status-im/status-go/services/wallet/token"
|
||||||
|
@ -203,7 +204,7 @@ func (s *CelerBridgeProcessor) CalculateFees(params ProcessorInputParams) (*big.
|
||||||
return nil, nil, ErrFailedToParsePercentageFee
|
return nil, nil, ErrFailedToParsePercentageFee
|
||||||
}
|
}
|
||||||
|
|
||||||
return ZeroBigIntValue, new(big.Int).Add(baseFee, percFee), nil
|
return walletCommon.ZeroBigIntValue(), new(big.Int).Add(baseFee, percFee), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CelerBridgeProcessor) PackTxInputData(params ProcessorInputParams) ([]byte, error) {
|
func (c *CelerBridgeProcessor) PackTxInputData(params ProcessorInputParams) ([]byte, error) {
|
||||||
|
|
|
@ -377,7 +377,7 @@ func (h *HopBridgeProcessor) CalculateFees(params ProcessorInputParams) (*big.In
|
||||||
Deadline: time.Now().Add(SevenDaysInSeconds).Unix(),
|
Deadline: time.Now().Add(SevenDaysInSeconds).Unix(),
|
||||||
}
|
}
|
||||||
h.bonderFee.Store(bonderKey, bonderFee)
|
h.bonderFee.Store(bonderKey, bonderFee)
|
||||||
return val, ZeroBigIntValue, nil
|
return val, walletCommon.ZeroBigIntValue(), nil
|
||||||
}
|
}
|
||||||
return nil, nil, ErrNoBonderFeeFound
|
return nil, nil, ErrNoBonderFeeFound
|
||||||
}
|
}
|
||||||
|
@ -471,7 +471,7 @@ func (h *HopBridgeProcessor) packL1BridgeTx(abi abi.ABI, toChainID uint64, to co
|
||||||
bonderFee.AmountOutMin.Int,
|
bonderFee.AmountOutMin.Int,
|
||||||
big.NewInt(bonderFee.Deadline),
|
big.NewInt(bonderFee.Deadline),
|
||||||
common.Address{},
|
common.Address{},
|
||||||
ZeroBigIntValue)
|
walletCommon.ZeroBigIntValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *HopBridgeProcessor) sendL1BridgeTx(contractAddress common.Address, ethClient chain.ClientInterface, toChainID uint64,
|
func (h *HopBridgeProcessor) sendL1BridgeTx(contractAddress common.Address, ethClient chain.ClientInterface, toChainID uint64,
|
||||||
|
@ -493,7 +493,7 @@ func (h *HopBridgeProcessor) sendL1BridgeTx(contractAddress common.Address, ethC
|
||||||
bonderFee.AmountOutMin.Int,
|
bonderFee.AmountOutMin.Int,
|
||||||
big.NewInt(bonderFee.Deadline),
|
big.NewInt(bonderFee.Deadline),
|
||||||
common.Address{},
|
common.Address{},
|
||||||
ZeroBigIntValue)
|
walletCommon.ZeroBigIntValue())
|
||||||
}
|
}
|
||||||
|
|
||||||
if token.Symbol == HopSymbol {
|
if token.Symbol == HopSymbol {
|
||||||
|
@ -513,7 +513,7 @@ func (h *HopBridgeProcessor) sendL1BridgeTx(contractAddress common.Address, ethC
|
||||||
bonderFee.AmountOutMin.Int,
|
bonderFee.AmountOutMin.Int,
|
||||||
big.NewInt(bonderFee.Deadline),
|
big.NewInt(bonderFee.Deadline),
|
||||||
common.Address{},
|
common.Address{},
|
||||||
ZeroBigIntValue)
|
walletCommon.ZeroBigIntValue())
|
||||||
}
|
}
|
||||||
|
|
||||||
contractInstance, err := hopL1Erc20Bridge.NewHopL1Erc20Bridge(
|
contractInstance, err := hopL1Erc20Bridge.NewHopL1Erc20Bridge(
|
||||||
|
@ -532,7 +532,7 @@ func (h *HopBridgeProcessor) sendL1BridgeTx(contractAddress common.Address, ethC
|
||||||
bonderFee.AmountOutMin.Int,
|
bonderFee.AmountOutMin.Int,
|
||||||
big.NewInt(bonderFee.Deadline),
|
big.NewInt(bonderFee.Deadline),
|
||||||
common.Address{},
|
common.Address{},
|
||||||
ZeroBigIntValue)
|
walletCommon.ZeroBigIntValue())
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ func (s *ENSPublicKeyProcessor) AvailableFor(params ProcessorInputParams) (bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ENSPublicKeyProcessor) CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error) {
|
func (s *ENSPublicKeyProcessor) CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error) {
|
||||||
return ZeroBigIntValue, ZeroBigIntValue, nil
|
return walletCommon.ZeroBigIntValue(), walletCommon.ZeroBigIntValue(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ENSPublicKeyProcessor) PackTxInputData(params ProcessorInputParams) ([]byte, error) {
|
func (s *ENSPublicKeyProcessor) PackTxInputData(params ProcessorInputParams) ([]byte, error) {
|
||||||
|
@ -89,7 +89,7 @@ func (s *ENSPublicKeyProcessor) EstimateGas(params ProcessorInputParams) (uint64
|
||||||
msg := ethereum.CallMsg{
|
msg := ethereum.CallMsg{
|
||||||
From: params.FromAddr,
|
From: params.FromAddr,
|
||||||
To: &contractAddress,
|
To: &contractAddress,
|
||||||
Value: ZeroBigIntValue,
|
Value: walletCommon.ZeroBigIntValue(),
|
||||||
Data: input,
|
Data: input,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ func (s *ENSPublicKeyProcessor) GetContractAddress(params ProcessorInputParams)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return common.Address{}, createENSPublicKeyErrorResponse(err)
|
return common.Address{}, createENSPublicKeyErrorResponse(err)
|
||||||
}
|
}
|
||||||
if *addr == ZeroAddress {
|
if *addr == walletCommon.ZeroAddress() {
|
||||||
return common.Address{}, ErrENSResolverNotFound
|
return common.Address{}, ErrENSResolverNotFound
|
||||||
}
|
}
|
||||||
return *addr, nil
|
return *addr, nil
|
||||||
|
|
|
@ -64,7 +64,7 @@ func (s *ENSRegisterProcessor) AvailableFor(params ProcessorInputParams) (bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ENSRegisterProcessor) CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error) {
|
func (s *ENSRegisterProcessor) CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error) {
|
||||||
return ZeroBigIntValue, ZeroBigIntValue, nil
|
return walletCommon.ZeroBigIntValue(), walletCommon.ZeroBigIntValue(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ENSRegisterProcessor) PackTxInputData(params ProcessorInputParams) ([]byte, error) {
|
func (s *ENSRegisterProcessor) PackTxInputData(params ProcessorInputParams) ([]byte, error) {
|
||||||
|
@ -125,7 +125,7 @@ func (s *ENSRegisterProcessor) EstimateGas(params ProcessorInputParams) (uint64,
|
||||||
msg := ethereum.CallMsg{
|
msg := ethereum.CallMsg{
|
||||||
From: params.FromAddr,
|
From: params.FromAddr,
|
||||||
To: &contractAddress,
|
To: &contractAddress,
|
||||||
Value: ZeroBigIntValue,
|
Value: walletCommon.ZeroBigIntValue(),
|
||||||
Data: input,
|
Data: input,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ func (s *ENSReleaseProcessor) AvailableFor(params ProcessorInputParams) (bool, e
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ENSReleaseProcessor) CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error) {
|
func (s *ENSReleaseProcessor) CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error) {
|
||||||
return ZeroBigIntValue, ZeroBigIntValue, nil
|
return walletCommon.ZeroBigIntValue(), walletCommon.ZeroBigIntValue(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ENSReleaseProcessor) PackTxInputData(params ProcessorInputParams) ([]byte, error) {
|
func (s *ENSReleaseProcessor) PackTxInputData(params ProcessorInputParams) ([]byte, error) {
|
||||||
|
@ -88,7 +88,7 @@ func (s *ENSReleaseProcessor) EstimateGas(params ProcessorInputParams) (uint64,
|
||||||
msg := ethereum.CallMsg{
|
msg := ethereum.CallMsg{
|
||||||
From: params.FromAddr,
|
From: params.FromAddr,
|
||||||
To: &contractAddress,
|
To: &contractAddress,
|
||||||
Value: ZeroBigIntValue,
|
Value: walletCommon.ZeroBigIntValue(),
|
||||||
Data: input,
|
Data: input,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ func (s *ENSReleaseProcessor) GetContractAddress(params ProcessorInputParams) (c
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return common.Address{}, err
|
return common.Address{}, err
|
||||||
}
|
}
|
||||||
if addr == ZeroAddress {
|
if addr == walletCommon.ZeroAddress() {
|
||||||
return common.Address{}, ErrENSRegistrarNotFound
|
return common.Address{}, ErrENSRegistrarNotFound
|
||||||
}
|
}
|
||||||
return addr, nil
|
return addr, nil
|
||||||
|
|
|
@ -16,6 +16,7 @@ import (
|
||||||
"github.com/status-im/status-go/contracts/ierc1155"
|
"github.com/status-im/status-go/contracts/ierc1155"
|
||||||
"github.com/status-im/status-go/eth-node/types"
|
"github.com/status-im/status-go/eth-node/types"
|
||||||
"github.com/status-im/status-go/rpc"
|
"github.com/status-im/status-go/rpc"
|
||||||
|
walletCommon "github.com/status-im/status-go/services/wallet/common"
|
||||||
"github.com/status-im/status-go/transactions"
|
"github.com/status-im/status-go/transactions"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -48,7 +49,7 @@ func (s *ERC1155Processor) AvailableFor(params ProcessorInputParams) (bool, erro
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ERC1155Processor) CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error) {
|
func (s *ERC1155Processor) CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error) {
|
||||||
return ZeroBigIntValue, ZeroBigIntValue, nil
|
return walletCommon.ZeroBigIntValue(), walletCommon.ZeroBigIntValue(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ERC1155Processor) PackTxInputData(params ProcessorInputParams) ([]byte, error) {
|
func (s *ERC1155Processor) PackTxInputData(params ProcessorInputParams) ([]byte, error) {
|
||||||
|
|
|
@ -18,6 +18,7 @@ import (
|
||||||
"github.com/status-im/status-go/eth-node/types"
|
"github.com/status-im/status-go/eth-node/types"
|
||||||
"github.com/status-im/status-go/params"
|
"github.com/status-im/status-go/params"
|
||||||
"github.com/status-im/status-go/rpc"
|
"github.com/status-im/status-go/rpc"
|
||||||
|
walletCommon "github.com/status-im/status-go/services/wallet/common"
|
||||||
"github.com/status-im/status-go/services/wallet/token"
|
"github.com/status-im/status-go/services/wallet/token"
|
||||||
"github.com/status-im/status-go/transactions"
|
"github.com/status-im/status-go/transactions"
|
||||||
)
|
)
|
||||||
|
@ -55,7 +56,7 @@ func (s *ERC721Processor) AvailableFor(params ProcessorInputParams) (bool, error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ERC721Processor) CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error) {
|
func (s *ERC721Processor) CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error) {
|
||||||
return ZeroBigIntValue, ZeroBigIntValue, nil
|
return walletCommon.ZeroBigIntValue(), walletCommon.ZeroBigIntValue(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ERC721Processor) packTxInputDataInternally(params ProcessorInputParams, functionName string) ([]byte, error) {
|
func (s *ERC721Processor) packTxInputDataInternally(params ProcessorInputParams, functionName string) ([]byte, error) {
|
||||||
|
|
|
@ -50,7 +50,7 @@ func (s *StickersBuyProcessor) AvailableFor(params ProcessorInputParams) (bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StickersBuyProcessor) CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error) {
|
func (s *StickersBuyProcessor) CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error) {
|
||||||
return ZeroBigIntValue, ZeroBigIntValue, nil
|
return walletCommon.ZeroBigIntValue(), walletCommon.ZeroBigIntValue(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StickersBuyProcessor) PackTxInputData(params ProcessorInputParams) ([]byte, error) {
|
func (s *StickersBuyProcessor) PackTxInputData(params ProcessorInputParams) ([]byte, error) {
|
||||||
|
@ -117,7 +117,7 @@ func (s *StickersBuyProcessor) EstimateGas(params ProcessorInputParams) (uint64,
|
||||||
msg := ethereum.CallMsg{
|
msg := ethereum.CallMsg{
|
||||||
From: params.FromAddr,
|
From: params.FromAddr,
|
||||||
To: &contractAddress,
|
To: &contractAddress,
|
||||||
Value: ZeroBigIntValue,
|
Value: walletCommon.ZeroBigIntValue(),
|
||||||
Data: input,
|
Data: input,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,8 +109,8 @@ func (s *SwapParaswapProcessor) AvailableFor(params ProcessorInputParams) (bool,
|
||||||
s.paraswapClient.SetPartnerAddress(partnerAddress)
|
s.paraswapClient.SetPartnerAddress(partnerAddress)
|
||||||
s.paraswapClient.SetPartnerFeePcnt(partnerFeePcnt)
|
s.paraswapClient.SetPartnerFeePcnt(partnerFeePcnt)
|
||||||
|
|
||||||
searchForToken := params.FromToken.Address == ZeroAddress
|
searchForToken := params.FromToken.Address == walletCommon.ZeroAddress()
|
||||||
searchForToToken := params.ToToken.Address == ZeroAddress
|
searchForToToken := params.ToToken.Address == walletCommon.ZeroAddress()
|
||||||
if searchForToToken || searchForToken {
|
if searchForToToken || searchForToken {
|
||||||
tokensList, err := s.paraswapClient.FetchTokensList(context.Background())
|
tokensList, err := s.paraswapClient.FetchTokensList(context.Background())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -136,7 +136,7 @@ func (s *SwapParaswapProcessor) AvailableFor(params ProcessorInputParams) (bool,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if params.FromToken.Address == ZeroAddress || params.ToToken.Address == ZeroAddress {
|
if params.FromToken.Address == walletCommon.ZeroAddress() || params.ToToken.Address == walletCommon.ZeroAddress() {
|
||||||
return false, ErrCannotResolveTokens
|
return false, ErrCannotResolveTokens
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ func calcReceivedAmountAndFee(baseDestAmount *big.Int, feePcnt float64) (destAmo
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SwapParaswapProcessor) CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error) {
|
func (s *SwapParaswapProcessor) CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error) {
|
||||||
return ZeroBigIntValue, ZeroBigIntValue, nil
|
return walletCommon.ZeroBigIntValue(), walletCommon.ZeroBigIntValue(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SwapParaswapProcessor) PackTxInputData(params ProcessorInputParams) ([]byte, error) {
|
func (s *SwapParaswapProcessor) PackTxInputData(params ProcessorInputParams) ([]byte, error) {
|
||||||
|
@ -180,7 +180,7 @@ func (s *SwapParaswapProcessor) EstimateGas(params ProcessorInputParams) (uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
swapSide := paraswap.SellSide
|
swapSide := paraswap.SellSide
|
||||||
if params.AmountOut != nil && params.AmountOut.Cmp(ZeroBigIntValue) > 0 {
|
if params.AmountOut != nil && params.AmountOut.Cmp(walletCommon.ZeroBigIntValue()) > 0 {
|
||||||
swapSide = paraswap.BuySide
|
swapSide = paraswap.BuySide
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ func TestParaswapWithPartnerFee(t *testing.T) {
|
||||||
|
|
||||||
partnerAddress, partnerFeePcnt := getPartnerAddressAndFeePcnt(chainID)
|
partnerAddress, partnerFeePcnt := getPartnerAddressAndFeePcnt(chainID)
|
||||||
|
|
||||||
if partnerAddress != walletCommon.ZeroAddress {
|
if partnerAddress != walletCommon.ZeroAddress() {
|
||||||
require.Greater(t, partnerFeePcnt, 0.0)
|
require.Greater(t, partnerFeePcnt, 0.0)
|
||||||
|
|
||||||
expectedFee := uint64(float64(testPriceRoute.DestAmount.Uint64()) * partnerFeePcnt / 100.0)
|
expectedFee := uint64(float64(testPriceRoute.DestAmount.Uint64()) * partnerFeePcnt / 100.0)
|
||||||
|
|
|
@ -13,6 +13,7 @@ import (
|
||||||
"github.com/status-im/status-go/contracts/ierc20"
|
"github.com/status-im/status-go/contracts/ierc20"
|
||||||
"github.com/status-im/status-go/eth-node/types"
|
"github.com/status-im/status-go/eth-node/types"
|
||||||
"github.com/status-im/status-go/rpc"
|
"github.com/status-im/status-go/rpc"
|
||||||
|
walletCommon "github.com/status-im/status-go/services/wallet/common"
|
||||||
"github.com/status-im/status-go/transactions"
|
"github.com/status-im/status-go/transactions"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -47,7 +48,7 @@ func (s *TransferProcessor) AvailableFor(params ProcessorInputParams) (bool, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TransferProcessor) CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error) {
|
func (s *TransferProcessor) CalculateFees(params ProcessorInputParams) (*big.Int, *big.Int, error) {
|
||||||
return ZeroBigIntValue, ZeroBigIntValue, nil
|
return walletCommon.ZeroBigIntValue(), walletCommon.ZeroBigIntValue(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TransferProcessor) PackTxInputData(params ProcessorInputParams) ([]byte, error) {
|
func (s *TransferProcessor) PackTxInputData(params ProcessorInputParams) ([]byte, error) {
|
||||||
|
|
|
@ -242,7 +242,7 @@ func (r *Router) SuggestedRoutes(ctx context.Context, input *requests.RouteInput
|
||||||
// return only if there are no balances, otherwise try to resolve the candidates for chains we know the balances for
|
// return only if there are no balances, otherwise try to resolve the candidates for chains we know the balances for
|
||||||
noBalanceOnAnyChain := true
|
noBalanceOnAnyChain := true
|
||||||
r.activeBalanceMap.Range(func(key, value interface{}) bool {
|
r.activeBalanceMap.Range(func(key, value interface{}) bool {
|
||||||
if value.(*big.Int).Cmp(pathprocessor.ZeroBigIntValue) > 0 {
|
if value.(*big.Int).Cmp(walletCommon.ZeroBigIntValue()) > 0 {
|
||||||
noBalanceOnAnyChain = false
|
noBalanceOnAnyChain = false
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -406,7 +406,7 @@ func (r *Router) getOptionsForAmoutToSplitAccrossChainsForProcessingChain(input
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if tokenBalance.Cmp(pathprocessor.ZeroBigIntValue) > 0 {
|
if tokenBalance.Cmp(walletCommon.ZeroBigIntValue()) > 0 {
|
||||||
if tokenBalance.Cmp(amountToSplit) <= 0 {
|
if tokenBalance.Cmp(amountToSplit) <= 0 {
|
||||||
crossChainAmountOptions[chain.ChainID] = append(crossChainAmountOptions[chain.ChainID], amountOption{
|
crossChainAmountOptions[chain.ChainID] = append(crossChainAmountOptions[chain.ChainID], amountOption{
|
||||||
amount: tokenBalance,
|
amount: tokenBalance,
|
||||||
|
@ -414,7 +414,7 @@ func (r *Router) getOptionsForAmoutToSplitAccrossChainsForProcessingChain(input
|
||||||
subtractFees: true, // for chains where we're taking the full balance, we want to subtract the fees
|
subtractFees: true, // for chains where we're taking the full balance, we want to subtract the fees
|
||||||
})
|
})
|
||||||
amountToSplit = new(big.Int).Sub(amountToSplit, tokenBalance)
|
amountToSplit = new(big.Int).Sub(amountToSplit, tokenBalance)
|
||||||
} else if amountToSplit.Cmp(pathprocessor.ZeroBigIntValue) > 0 {
|
} else if amountToSplit.Cmp(walletCommon.ZeroBigIntValue()) > 0 {
|
||||||
crossChainAmountOptions[chain.ChainID] = append(crossChainAmountOptions[chain.ChainID], amountOption{
|
crossChainAmountOptions[chain.ChainID] = append(crossChainAmountOptions[chain.ChainID], amountOption{
|
||||||
amount: amountToSplit,
|
amount: amountToSplit,
|
||||||
locked: false,
|
locked: false,
|
||||||
|
@ -438,7 +438,7 @@ func (r *Router) getCrossChainsOptionsForSendingAmount(input *requests.RouteInpu
|
||||||
amountLocked := false
|
amountLocked := false
|
||||||
amountToSend := input.AmountIn.ToInt()
|
amountToSend := input.AmountIn.ToInt()
|
||||||
|
|
||||||
if amountToSend.Cmp(pathprocessor.ZeroBigIntValue) == 0 {
|
if amountToSend.Cmp(walletCommon.ZeroBigIntValue()) == 0 {
|
||||||
finalCrossChainAmountOptions[selectedFromChain.ChainID] = append(finalCrossChainAmountOptions[selectedFromChain.ChainID], amountOption{
|
finalCrossChainAmountOptions[selectedFromChain.ChainID] = append(finalCrossChainAmountOptions[selectedFromChain.ChainID], amountOption{
|
||||||
amount: amountToSend,
|
amount: amountToSend,
|
||||||
locked: false,
|
locked: false,
|
||||||
|
@ -459,7 +459,7 @@ func (r *Router) getCrossChainsOptionsForSendingAmount(input *requests.RouteInpu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if amountToSend.Cmp(pathprocessor.ZeroBigIntValue) > 0 {
|
if amountToSend.Cmp(walletCommon.ZeroBigIntValue()) > 0 {
|
||||||
// add full amount always, cause we want to check for balance errors at the end of the routing algorithm
|
// add full amount always, cause we want to check for balance errors at the end of the routing algorithm
|
||||||
// TODO: once we introduce bettwer error handling and start checking for the balance at the beginning of the routing algorithm
|
// TODO: once we introduce bettwer error handling and start checking for the balance at the beginning of the routing algorithm
|
||||||
// we can remove this line and optimize the routing algorithm more
|
// we can remove this line and optimize the routing algorithm more
|
||||||
|
@ -796,7 +796,7 @@ func (r *Router) checkBalancesForTheBestRoute(ctx context.Context, bestRoute rou
|
||||||
for _, path := range bestRoute {
|
for _, path := range bestRoute {
|
||||||
tokenKey := makeBalanceKey(path.FromChain.ChainID, path.FromToken.Symbol)
|
tokenKey := makeBalanceKey(path.FromChain.ChainID, path.FromToken.Symbol)
|
||||||
if tokenBalance, ok := balanceMapCopy[tokenKey]; ok {
|
if tokenBalance, ok := balanceMapCopy[tokenKey]; ok {
|
||||||
if tokenBalance.Cmp(pathprocessor.ZeroBigIntValue) > 0 {
|
if tokenBalance.Cmp(walletCommon.ZeroBigIntValue()) > 0 {
|
||||||
hasPositiveBalance = true
|
hasPositiveBalance = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -807,7 +807,7 @@ func (r *Router) checkBalancesForTheBestRoute(ctx context.Context, bestRoute rou
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if path.RequiredTokenBalance != nil && path.RequiredTokenBalance.Cmp(pathprocessor.ZeroBigIntValue) > 0 {
|
if path.RequiredTokenBalance != nil && path.RequiredTokenBalance.Cmp(walletCommon.ZeroBigIntValue()) > 0 {
|
||||||
if tokenBalance, ok := balanceMapCopy[tokenKey]; ok {
|
if tokenBalance, ok := balanceMapCopy[tokenKey]; ok {
|
||||||
if tokenBalance.Cmp(path.RequiredTokenBalance) == -1 {
|
if tokenBalance.Cmp(path.RequiredTokenBalance) == -1 {
|
||||||
err := &errors.ErrorResponse{
|
err := &errors.ErrorResponse{
|
||||||
|
@ -911,12 +911,12 @@ func (r *Router) resolveRoutes(ctx context.Context, input *requests.RouteInputPa
|
||||||
for _, path := range bestRoute {
|
for _, path := range bestRoute {
|
||||||
if path.SubtractFees && path.FromToken.IsNative() {
|
if path.SubtractFees && path.FromToken.IsNative() {
|
||||||
path.AmountIn.ToInt().Sub(path.AmountIn.ToInt(), path.TxFee.ToInt())
|
path.AmountIn.ToInt().Sub(path.AmountIn.ToInt(), path.TxFee.ToInt())
|
||||||
if path.TxL1Fee.ToInt().Cmp(pathprocessor.ZeroBigIntValue) > 0 {
|
if path.TxL1Fee.ToInt().Cmp(walletCommon.ZeroBigIntValue()) > 0 {
|
||||||
path.AmountIn.ToInt().Sub(path.AmountIn.ToInt(), path.TxL1Fee.ToInt())
|
path.AmountIn.ToInt().Sub(path.AmountIn.ToInt(), path.TxL1Fee.ToInt())
|
||||||
}
|
}
|
||||||
if path.ApprovalRequired {
|
if path.ApprovalRequired {
|
||||||
path.AmountIn.ToInt().Sub(path.AmountIn.ToInt(), path.ApprovalFee.ToInt())
|
path.AmountIn.ToInt().Sub(path.AmountIn.ToInt(), path.ApprovalFee.ToInt())
|
||||||
if path.ApprovalL1Fee.ToInt().Cmp(pathprocessor.ZeroBigIntValue) > 0 {
|
if path.ApprovalL1Fee.ToInt().Cmp(walletCommon.ZeroBigIntValue()) > 0 {
|
||||||
path.AmountIn.ToInt().Sub(path.AmountIn.ToInt(), path.ApprovalL1Fee.ToInt())
|
path.AmountIn.ToInt().Sub(path.AmountIn.ToInt(), path.ApprovalL1Fee.ToInt())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ func (r *Router) requireApproval(ctx context.Context, sendType sendtype.SendType
|
||||||
return false, nil, err
|
return false, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if approvalContractAddress == nil || *approvalContractAddress == pathprocessor.ZeroAddress {
|
if approvalContractAddress == nil || *approvalContractAddress == walletCommon.ZeroAddress() {
|
||||||
return false, nil, nil
|
return false, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ func (r *Router) requireApproval(ctx context.Context, sendType sendtype.SendType
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Router) packApprovalInputData(amountIn *big.Int, approvalContractAddress *common.Address) ([]byte, error) {
|
func (r *Router) packApprovalInputData(amountIn *big.Int, approvalContractAddress *common.Address) ([]byte, error) {
|
||||||
if approvalContractAddress == nil || *approvalContractAddress == pathprocessor.ZeroAddress {
|
if approvalContractAddress == nil || *approvalContractAddress == walletCommon.ZeroAddress {
|
||||||
return []byte{}, nil
|
return []byte{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ func (r *Router) estimateGasForApproval(params pathprocessor.ProcessorInputParam
|
||||||
return ethClient.EstimateGas(context.Background(), ethereum.CallMsg{
|
return ethClient.EstimateGas(context.Background(), ethereum.CallMsg{
|
||||||
From: params.FromAddr,
|
From: params.FromAddr,
|
||||||
To: ¶ms.FromToken.Address,
|
To: ¶ms.FromToken.Address,
|
||||||
Value: pathprocessor.ZeroBigIntValue,
|
Value: walletCommon.ZeroBigIntValue(),
|
||||||
Data: data,
|
Data: data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/status-im/status-go/services/wallet/common"
|
"github.com/status-im/status-go/services/wallet/common"
|
||||||
"github.com/status-im/status-go/services/wallet/router/pathprocessor"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Route []*Path
|
type Route []*Path
|
||||||
|
@ -25,19 +24,19 @@ func FindBestRoute(routes []Route, tokenPrice float64, nativeTokenPrice float64)
|
||||||
txFeeInEth := common.GweiToEth(common.WeiToGwei(path.TxFee.ToInt()))
|
txFeeInEth := common.GweiToEth(common.WeiToGwei(path.TxFee.ToInt()))
|
||||||
pathCost := new(big.Float).Mul(txFeeInEth, nativeTokenPrice)
|
pathCost := new(big.Float).Mul(txFeeInEth, nativeTokenPrice)
|
||||||
|
|
||||||
if path.TxL1Fee.ToInt().Cmp(pathprocessor.ZeroBigIntValue) > 0 {
|
if path.TxL1Fee.ToInt().Cmp(common.ZeroBigIntValue()) > 0 {
|
||||||
txL1FeeInEth := common.GweiToEth(common.WeiToGwei(path.TxL1Fee.ToInt()))
|
txL1FeeInEth := common.GweiToEth(common.WeiToGwei(path.TxL1Fee.ToInt()))
|
||||||
pathCost.Add(pathCost, new(big.Float).Mul(txL1FeeInEth, nativeTokenPrice))
|
pathCost.Add(pathCost, new(big.Float).Mul(txL1FeeInEth, nativeTokenPrice))
|
||||||
}
|
}
|
||||||
|
|
||||||
if path.TxBonderFees != nil && path.TxBonderFees.ToInt().Cmp(pathprocessor.ZeroBigIntValue) > 0 {
|
if path.TxBonderFees != nil && path.TxBonderFees.ToInt().Cmp(common.ZeroBigIntValue()) > 0 {
|
||||||
pathCost.Add(pathCost, new(big.Float).Mul(
|
pathCost.Add(pathCost, new(big.Float).Mul(
|
||||||
new(big.Float).Quo(new(big.Float).SetInt(path.TxBonderFees.ToInt()), tokenDenominator),
|
new(big.Float).Quo(new(big.Float).SetInt(path.TxBonderFees.ToInt()), tokenDenominator),
|
||||||
new(big.Float).SetFloat64(tokenPrice)))
|
new(big.Float).SetFloat64(tokenPrice)))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if path.TxTokenFees != nil && path.TxTokenFees.ToInt().Cmp(pathprocessor.ZeroBigIntValue) > 0 && path.FromToken != nil {
|
if path.TxTokenFees != nil && path.TxTokenFees.ToInt().Cmp(common.ZeroBigIntValue()) > 0 && path.FromToken != nil {
|
||||||
pathCost.Add(pathCost, new(big.Float).Mul(
|
pathCost.Add(pathCost, new(big.Float).Mul(
|
||||||
new(big.Float).Quo(new(big.Float).SetInt(path.TxTokenFees.ToInt()), tokenDenominator),
|
new(big.Float).Quo(new(big.Float).SetInt(path.TxTokenFees.ToInt()), tokenDenominator),
|
||||||
new(big.Float).SetFloat64(tokenPrice)))
|
new(big.Float).SetFloat64(tokenPrice)))
|
||||||
|
@ -48,7 +47,7 @@ func FindBestRoute(routes []Route, tokenPrice float64, nativeTokenPrice float64)
|
||||||
approvalFeeInEth := common.GweiToEth(common.WeiToGwei(path.ApprovalFee.ToInt()))
|
approvalFeeInEth := common.GweiToEth(common.WeiToGwei(path.ApprovalFee.ToInt()))
|
||||||
pathCost.Add(pathCost, new(big.Float).Mul(approvalFeeInEth, nativeTokenPrice))
|
pathCost.Add(pathCost, new(big.Float).Mul(approvalFeeInEth, nativeTokenPrice))
|
||||||
|
|
||||||
if path.ApprovalL1Fee.ToInt().Cmp(pathprocessor.ZeroBigIntValue) > 0 {
|
if path.ApprovalL1Fee.ToInt().Cmp(common.ZeroBigIntValue()) > 0 {
|
||||||
approvalL1FeeInEth := common.GweiToEth(common.WeiToGwei(path.ApprovalL1Fee.ToInt()))
|
approvalL1FeeInEth := common.GweiToEth(common.WeiToGwei(path.ApprovalL1Fee.ToInt()))
|
||||||
pathCost.Add(pathCost, new(big.Float).Mul(approvalL1FeeInEth, nativeTokenPrice))
|
pathCost.Add(pathCost, new(big.Float).Mul(approvalL1FeeInEth, nativeTokenPrice))
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,13 +119,13 @@ func (s SendType) CanUseProcessor(p pathprocessor.PathProcessor) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s SendType) ProcessZeroAmountInProcessor(amountIn *big.Int, amountOut *big.Int, processorName string) bool {
|
func (s SendType) ProcessZeroAmountInProcessor(amountIn *big.Int, amountOut *big.Int, processorName string) bool {
|
||||||
if amountIn.Cmp(pathprocessor.ZeroBigIntValue) == 0 {
|
if amountIn.Cmp(walletCommon.ZeroBigIntValue()) == 0 {
|
||||||
if s == Transfer {
|
if s == Transfer {
|
||||||
if processorName != pathprocessor.ProcessorTransferName {
|
if processorName != pathprocessor.ProcessorTransferName {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
} else if s == Swap {
|
} else if s == Swap {
|
||||||
if amountOut.Cmp(pathprocessor.ZeroBigIntValue) == 0 {
|
if amountOut.Cmp(walletCommon.ZeroBigIntValue()) == 0 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -50,7 +50,7 @@ func (c *ClientV5) BuildTransaction(ctx context.Context, srcTokenAddress common.
|
||||||
params["destAmount"] = destAmountWei.String()
|
params["destAmount"] = destAmountWei.String()
|
||||||
}
|
}
|
||||||
params["partner"] = c.partnerID
|
params["partner"] = c.partnerID
|
||||||
if c.partnerAddress != walletCommon.ZeroAddress && c.partnerFeePcnt > 0 {
|
if c.partnerAddress != walletCommon.ZeroAddress() && c.partnerFeePcnt > 0 {
|
||||||
params["partnerAddress"] = c.partnerAddress.Hex()
|
params["partnerAddress"] = c.partnerAddress.Hex()
|
||||||
params["partnerFeeBps"] = uint(c.partnerFeePcnt * 100)
|
params["partnerFeeBps"] = uint(c.partnerFeePcnt * 100)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue