github.com/status-im/status-go@v1.1.0/services/wallet/router/routes/router_path.go (about)

     1  package routes
     2  
     3  import (
     4  	"math/big"
     5  
     6  	"github.com/ethereum/go-ethereum/common"
     7  	"github.com/ethereum/go-ethereum/common/hexutil"
     8  	"github.com/status-im/status-go/params"
     9  	"github.com/status-im/status-go/services/wallet/router/fees"
    10  	walletToken "github.com/status-im/status-go/services/wallet/token"
    11  )
    12  
    13  type Path struct {
    14  	ProcessorName  string
    15  	FromChain      *params.Network    // Source chain
    16  	ToChain        *params.Network    // Destination chain
    17  	FromToken      *walletToken.Token // Source token
    18  	ToToken        *walletToken.Token // Destination token, set if applicable
    19  	AmountIn       *hexutil.Big       // Amount that will be sent from the source chain
    20  	AmountInLocked bool               // Is the amount locked
    21  	AmountOut      *hexutil.Big       // Amount that will be received on the destination chain
    22  
    23  	SuggestedLevelsForMaxFeesPerGas *fees.MaxFeesLevels // Suggested max fees for the transaction (in ETH WEI)
    24  	MaxFeesPerGas                   *hexutil.Big        // Max fees per gas (determined by client via GasFeeMode, in ETH WEI)
    25  
    26  	TxBaseFee     *hexutil.Big // Base fee for the transaction (in ETH WEI)
    27  	TxPriorityFee *hexutil.Big // Priority fee for the transaction (in ETH WEI)
    28  	TxGasAmount   uint64       // Gas used for the transaction
    29  	TxBonderFees  *hexutil.Big // Bonder fees for the transaction - used for Hop bridge (in selected token)
    30  	TxTokenFees   *hexutil.Big // Token fees for the transaction - used for bridges (represent the difference between the amount in and the amount out, in selected token)
    31  
    32  	TxFee   *hexutil.Big // fee for the transaction (includes tx fee only, doesn't include approval fees, l1 fees, l1 approval fees, token fees or bonders fees, in ETH WEI)
    33  	TxL1Fee *hexutil.Big // L1 fee for the transaction - used for for transactions placed on L2 chains (in ETH WEI)
    34  
    35  	ApprovalRequired        bool            // Is approval required for the transaction
    36  	ApprovalAmountRequired  *hexutil.Big    // Amount required for the approval transaction
    37  	ApprovalContractAddress *common.Address // Address of the contract that needs to be approved
    38  	ApprovalBaseFee         *hexutil.Big    // Base fee for the approval transaction (in ETH WEI)
    39  	ApprovalPriorityFee     *hexutil.Big    // Priority fee for the approval transaction (in ETH WEI)
    40  	ApprovalGasAmount       uint64          // Gas used for the approval transaction
    41  
    42  	ApprovalFee   *hexutil.Big // Total fee for the approval transaction (includes approval tx fees only, doesn't include approval l1 fees, in ETH WEI)
    43  	ApprovalL1Fee *hexutil.Big // L1 fee for the approval transaction - used for for transactions placed on L2 chains (in ETH WEI)
    44  
    45  	TxTotalFee *hexutil.Big // Total fee for the transaction (includes tx fees, approval fees, l1 fees, l1 approval fees, in ETH WEI)
    46  
    47  	EstimatedTime fees.TransactionEstimation
    48  
    49  	RequiredTokenBalance  *big.Int // (in selected token)
    50  	RequiredNativeBalance *big.Int // (in ETH WEI)
    51  	SubtractFees          bool
    52  }
    53  
    54  func (p *Path) Equal(o *Path) bool {
    55  	return p.FromChain.ChainID == o.FromChain.ChainID && p.ToChain.ChainID == o.ToChain.ChainID
    56  }