Skip to content

Commit

Permalink
move url getters to HasUrl trait impl
Browse files Browse the repository at this point in the history
  • Loading branch information
tbro committed Jul 9, 2024
1 parent 5f03627 commit d46a2e3
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions sequencer/src/auction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ use committable::{Commitment, Committable};
use ethers::types::Signature;
use hotshot_types::{
data::ViewNumber,
traits::{node_implementation::ConsensusTime, signature_key::BuilderSignatureKey},
traits::{
auction_results_provider::HasUrl, node_implementation::ConsensusTime,
signature_key::BuilderSignatureKey,
},
};
use serde::{Deserialize, Serialize};
use std::str::FromStr;
Expand Down Expand Up @@ -121,10 +124,6 @@ impl BidTxBody {
pub fn with_url(self, url: Url) -> Self {
Self { url, ..self }
}
/// Get the `url` field.
pub fn url(&self) -> Url {
self.url.clone()
}
}

impl Default for BidTxBody {
Expand Down Expand Up @@ -238,10 +237,6 @@ impl BidTx {
let body = self.body.with_url(url);
Self { body, ..self }
}
/// Get the `url` field from the body
pub fn url(&self) -> Url {
self.body.url()
}
/// get gas price
pub fn gas_price(&self) -> FeeAmount {
self.body.gas_price
Expand All @@ -256,6 +251,20 @@ impl BidTx {
}
}

impl HasUrl for BidTx {
/// Get the `url` field from the body.
fn url(&self) -> Url {
self.body.url()
}
}

impl HasUrl for BidTxBody {
/// Get the cloned `url` field.
fn url(&self) -> Url {
self.url.clone()
}
}

pub fn mock_full_network_txs(key: Option<EthKeyPair>) -> Vec<FullNetworkTx> {
// if no key is supplied, use `test_key_pair`. Since default `BidTxBody` is
// signed with `test_key_pair`, it will verify successfully
Expand Down

0 comments on commit d46a2e3

Please sign in to comment.