Skip to content

Commit

Permalink
feat(eth-swap): maker tpu v2 implementation (#2211)
Browse files Browse the repository at this point in the history
  • Loading branch information
laruh authored Nov 8, 2024
1 parent a1b02c1 commit 99cb87a
Show file tree
Hide file tree
Showing 18 changed files with 1,642 additions and 425 deletions.
17 changes: 10 additions & 7 deletions mm2src/coins/coin_errors.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use crate::eth::eth_swap_v2::{PaymentStatusErr, ValidatePaymentV2Err};
use crate::eth::nft_swap_v2::errors::{Erc721FunctionError, HtlcParamsError, PrepareTxDataError};
use crate::eth::eth_swap_v2::{PaymentStatusErr, PrepareTxDataError, ValidatePaymentV2Err};
use crate::eth::nft_swap_v2::errors::{Erc721FunctionError, HtlcParamsError};
use crate::eth::{EthAssocTypesError, EthNftAssocTypesError, Web3RpcError};
use crate::{utxo::rpc_clients::UtxoRpcError, NumConversError, UnexpectedDerivationMethod};
use enum_derives::EnumFromStringify;
use futures01::Future;
use mm2_err_handle::prelude::MmError;
use spv_validation::helpers_validation::SPVError;
use std::num::TryFromIntError;
use std::{array::TryFromSliceError, num::TryFromIntError};

/// Helper type used as result for swap payment validation function(s)
pub type ValidatePaymentFut<T> = Box<dyn Future<Item = T, Error = MmError<ValidatePaymentError>> + Send>;
Expand All @@ -24,7 +24,9 @@ pub enum ValidatePaymentError {
"NumConversError",
"UnexpectedDerivationMethod",
"keys::Error",
"PrepareTxDataError"
"PrepareTxDataError",
"ethabi::Error",
"TryFromSliceError"
)]
InternalError(String),
/// Problem with deserializing the transaction, or one of the transaction parts is invalid.
Expand All @@ -49,8 +51,7 @@ pub enum ValidatePaymentError {
WatcherRewardError(String),
/// Input payment timelock overflows the type used by specific coin.
TimelockOverflow(TryFromIntError),
#[display(fmt = "Nft Protocol is not supported yet!")]
NftProtocolNotSupported,
ProtocolNotSupported(String),
InvalidData(String),
}

Expand All @@ -77,7 +78,9 @@ impl From<Web3RpcError> for ValidatePaymentError {
| Web3RpcError::Timeout(internal)
| Web3RpcError::NumConversError(internal)
| Web3RpcError::InvalidGasApiConfig(internal) => ValidatePaymentError::InternalError(internal),
Web3RpcError::NftProtocolNotSupported => ValidatePaymentError::NftProtocolNotSupported,
Web3RpcError::NftProtocolNotSupported => {
ValidatePaymentError::ProtocolNotSupported("Nft protocol is not supported".to_string())
},
}
}
}
Expand Down
Loading

0 comments on commit 99cb87a

Please sign in to comment.