Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
buck54321 committed Feb 26, 2025
1 parent 53230b9 commit f5882f4
Show file tree
Hide file tree
Showing 51 changed files with 1,760 additions and 1,428 deletions.
1 change: 1 addition & 0 deletions client/asset/bch/bch.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ var (
rpcWalletDefinition,
// electrumWalletDefinition, // getinfo RPC needs backport: https://github.com/Electron-Cash/Electron-Cash/pull/2399
},
BlockchainClass: asset.BlockchainClassUTXO,
}

externalFeeRate = btc.BitcoreRateFetcher("BCH")
Expand Down
1 change: 1 addition & 0 deletions client/asset/btc/btc.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ var (
electrumWalletDefinition,
},
LegacyWalletIndex: 1,
BlockchainClass: asset.BlockchainClassUTXO,
}
)

Expand Down
1 change: 1 addition & 0 deletions client/asset/dash/dash.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ var (
ConfigOpts: configOpts,
},
},
BlockchainClass: asset.BlockchainClassUTXO,
}
)

Expand Down
1 change: 1 addition & 0 deletions client/asset/dcr/dcr.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ var (
MultiFundingOpts: multiFundingOpts,
},
},
BlockchainClass: asset.BlockchainClassUTXO,
}
swapFeeBumpKey = "swapfeebump"
splitKey = "swapsplit"
Expand Down
1 change: 1 addition & 0 deletions client/asset/dgb/dgb.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ var (
DefaultConfigPath: dexbtc.SystemConfigPath("digibyte"),
ConfigOpts: configOpts,
}},
BlockchainClass: asset.BlockchainClassUTXO,
}
)

Expand Down
1 change: 1 addition & 0 deletions client/asset/doge/doge.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ var (
DefaultConfigPath: dexbtc.SystemConfigPath("dogecoin"),
ConfigOpts: configOpts,
}},
BlockchainClass: asset.BlockchainClassUTXO,
}
)

Expand Down
5 changes: 3 additions & 2 deletions client/asset/eth/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ var (
// MaxSwapsInTx and MaxRedeemsInTx are set in (Wallet).Info, since
// the value cannot be known until we connect and get network info.
},
IsAccountBased: true,
BlockchainClass: asset.BlockchainClassEVM,
}

// unlimitedAllowance is the maximum supported allowance for an erc20
Expand Down Expand Up @@ -660,7 +660,7 @@ func CreateEVMWallet(chainID int64, createWalletParams *asset.CreateWalletParams
func newWallet(assetCFG *asset.WalletConfig, logger dex.Logger, net dex.Network) (w *ETHWallet, err error) {
chainCfg, err := ChainConfig(net)
if err != nil {
return nil, fmt.Errorf("failed to locate Ethereum genesis configuration for network %s", net)
return nil, fmt.Errorf("failed to locate Ethereum genesis configuration for network %s: %v", net, err)
}
comp, err := NetworkCompatibilityData(net)
if err != nil {
Expand Down Expand Up @@ -1284,6 +1284,7 @@ func (w *ETHWallet) OpenTokenWallet(tokenCfg *asset.TokenConfig) (asset.Wallet,
Name: token.Name,
SupportedVersions: w.wi.SupportedVersions,
UnitInfo: token.UnitInfo,
BlockchainClass: asset.BlockchainClassEVM,
},
pendingTxCheckBal: new(big.Int),
}
Expand Down
1 change: 1 addition & 0 deletions client/asset/firo/firo.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ var (
ConfigOpts: append(btc.ElectrumConfigOpts, btc.CommonConfigOpts("FIRO", true)...),
},
},
BlockchainClass: asset.BlockchainClassUTXO,
}
)

Expand Down
17 changes: 13 additions & 4 deletions client/asset/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,17 @@ type Token struct {
ContractAddress string `json:"contractAddress"` // Set in SetNetwork
}

type BlockchainClass string

const (
BlockchainClassUTXO BlockchainClass = "UTXO"
BlockchainClassEVM BlockchainClass = "EVM"
)

func (c BlockchainClass) IsEVM() bool {
return c == BlockchainClassEVM
}

// WalletInfo is auxiliary information about an ExchangeWallet.
type WalletInfo struct {
// Name is the display name for the currency, e.g. "Decred"
Expand Down Expand Up @@ -331,10 +342,8 @@ type WalletInfo struct {
// MaxRedeemsInTx is the max amount of redemptions that this wallet can do
// in a single transaction.
MaxRedeemsInTx uint64
// IsAccountBased should be set to true for account-based (EVM) assets, so
// that a common seed will be generated and wallets will generate the
// same address.
IsAccountBased bool
// BlockchainClass is the type of the wallet's blockchain.
BlockchainClass BlockchainClass
}

// ConfigOption is a wallet configuration option.
Expand Down
1 change: 1 addition & 0 deletions client/asset/ltc/ltc.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ var (
rpcWalletDefinition,
electrumWalletDefinition,
},
BlockchainClass: asset.BlockchainClassUTXO,
}
)

Expand Down
2 changes: 1 addition & 1 deletion client/asset/polygon/polygon.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ var (
// MaxSwapsInTx and MaxRedeemsInTx are set in (Wallet).Info, since
// the value cannot be known until we connect and get network info.
},
IsAccountBased: true,
BlockchainClass: asset.BlockchainClassEVM,
}
)

Expand Down
1 change: 1 addition & 0 deletions client/asset/zcl/zcl.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ var (
ConfigOpts: configOpts,
NoAuth: true,
}},
BlockchainClass: asset.BlockchainClassUTXO,
}
)

Expand Down
1 change: 1 addition & 0 deletions client/asset/zec/zec.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ var (
ConfigOpts: configOpts,
NoAuth: true,
}},
BlockchainClass: asset.BlockchainClassUTXO,
}

feeReservesPerLot = dexzec.TxFeesZIP317(dexbtc.RedeemP2PKHInputSize+1, 2*dexbtc.P2PKHOutputSize+1, 0, 0, 0, 0)
Expand Down
Loading

0 comments on commit f5882f4

Please sign in to comment.