CW-615-Add-Check-For-Contract-Address (#1387)

* feat: Check if address is a valid Externally Owned Address

* feat: Check if the EVM address received when exchanging tokens is a valid EOA address

* move the contract address check to be only in the case of ThorChain [skip ci]

* some enhancements

* feat: Implement check for contract address for inputAddress when exchanging to ETH

* fix: Remove previous implementation and clean up current implementation for the check for contract address

* chore: Remove unneed space

* chore: Remove unneed space

---------

Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
This commit is contained in:
Adegoke David 2024-04-25 02:14:11 +01:00 committed by GitHub
parent dcfb2b2b73
commit 2ac81250c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 146 additions and 18 deletions

View file

@ -324,14 +324,16 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
Future<PendingTransaction?> createTransaction({ExchangeProvider? provider}) async {
try {
state = IsExecutingState();
pendingTransaction = await wallet.createTransaction(_credentials());
if (provider is ThorChainExchangeProvider) {
final outputCount = pendingTransaction?.outputCount ?? 0;
if (outputCount > 10) {
throw Exception("ThorChain does not support more than 10 outputs");
throw Exception("THORChain does not support more than 10 outputs");
}
if (_hasTaprootInput(pendingTransaction)) {
throw Exception("ThorChain does not support Taproot addresses");
throw Exception("THORChain does not support Taproot addresses");
}
}
state = ExecutedSuccessfullyState();