Skip to content

Commit 5366a02

Browse files
authored
redistribution: refund_identity field (#636)
## 📝 Summary Adds refund identity ## 💡 Motivation and Context <!--- (Optional) Why is this change required? What problem does it solve? Remove this section if not applicable. --> --- ## ✅ I have completed the following steps: * [ ] Run `make lint` * [ ] Run `make test` * [ ] Added tests (if applicable)
1 parent d9f15f5 commit 5366a02

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

crates/rbuilder/src/backtest/build_block/synthetic_orders.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ impl<ConfigType: LiveBuilderConfig> SyntheticOrdersSource<ConfigType> {
9595
signer: None,
9696
metadata: Metadata {
9797
received_at_timestamp: time::OffsetDateTime::from_unix_timestamp(0).unwrap(),
98+
refund_identity: None,
9899
},
99100
dropping_tx_hashes: Default::default(),
100101
refund: None,

crates/rbuilder/src/backtest/redistribute/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,6 +1180,10 @@ fn order_redistribution_address(
11801180
order: &Order,
11811181
protect_signers: &[Address],
11821182
) -> Option<(Address, bool)> {
1183+
if let Some(refund_identity) = order.metadata().refund_identity {
1184+
return Some((refund_identity, false));
1185+
}
1186+
11831187
let signer = match order.signer() {
11841188
Some(signer) => signer,
11851189
None => {

crates/rbuilder/src/primitives/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@ use uuid::Uuid;
3636
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3737
pub struct Metadata {
3838
pub received_at_timestamp: time::OffsetDateTime,
39+
pub refund_identity: Option<Address>,
3940
}
4041

4142
impl Metadata {
4243
pub fn with_current_received_at() -> Self {
4344
Self {
4445
received_at_timestamp: time::OffsetDateTime::now_utc(),
46+
refund_identity: None,
4547
}
4648
}
4749
}

0 commit comments

Comments
 (0)