Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
175 changes: 112 additions & 63 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ prometheus-metric-storage = "0.5.0"
rand = "0.8.5"
regex = "1.10.4"
reqwest = "0.11.27"
rstest = "0.26"
secp256k1 = "0.27.0"
serde = { version = "1.0.203", features = ["derive"] }
serde_json = "1.0.117"
Expand Down
1 change: 1 addition & 0 deletions crates/e2e/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ web3 = { workspace = true, features = ["http"] }

[dev-dependencies]
refunder = { workspace = true }
rstest = { workspace = true }

[lints]
workspace = true
25 changes: 4 additions & 21 deletions crates/e2e/tests/e2e/ethflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ use {
trade::Trade,
},
number::{nonzero::NonZeroU256, units::EthUnit},
refunder::refund_service::{INVALIDATED_OWNER, NO_OWNER},
refunder::RefundStatus,
reqwest::Client,
shared::signature_validator::check_erc1271_result,
};
Expand Down Expand Up @@ -424,7 +424,7 @@ async fn submit_order(
) {
assert_eq!(
ethflow_order.status(contracts, ethflow_contract).await,
EthFlowOrderOnchainStatus::Free
RefundStatus::Invalid
);

let result = ethflow_order
Expand All @@ -433,7 +433,7 @@ async fn submit_order(
assert!(result.status()); // success
assert_eq!(
ethflow_order.status(contracts, ethflow_contract).await,
EthFlowOrderOnchainStatus::Created(user, ethflow_order.0.validTo)
RefundStatus::NotYetRefunded(user)
);
}

Expand Down Expand Up @@ -676,7 +676,7 @@ impl ExtendedEthFlowOrder {
&self,
contracts: &Contracts,
ethflow_contract: &CoWSwapEthFlow::Instance,
) -> EthFlowOrderOnchainStatus {
) -> RefundStatus {
ethflow_contract
.orders(self.hash(contracts, ethflow_contract).await)
.call()
Expand Down Expand Up @@ -786,23 +786,6 @@ impl ExtendedEthFlowOrder {
}
}

#[derive(Debug, PartialEq, Eq)]
pub enum EthFlowOrderOnchainStatus {
Invalidated,
Created(Address, u32),
Free,
}

impl From<CoWSwapEthFlow::CoWSwapEthFlow::ordersReturn> for EthFlowOrderOnchainStatus {
fn from(value: CoWSwapEthFlow::CoWSwapEthFlow::ordersReturn) -> Self {
match value.owner {
owner if owner == NO_OWNER => Self::Free,
owner if owner == INVALIDATED_OWNER => Self::Invalidated,
_ => Self::Created(value.owner, value.validTo),
}
}
}

pub struct EthFlowTradeIntent {
pub sell_amount: alloy::primitives::U256,
pub buy_token: Address,
Expand Down
Loading
Loading