-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix e2e tests * Fix compiler errors * Don't create numbers that can't be converted to i64
- Loading branch information
Showing
11 changed files
with
151 additions
and
16 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
use alloy_primitives::{Address, U256}; | ||
use mintpool::types::SimplePremint; | ||
use rand::{Rng, RngCore}; | ||
|
||
pub trait Factory<O> | ||
where | ||
Self: Sized, | ||
O: Default, | ||
{ | ||
fn build(options: O) -> Self; | ||
fn build_default() -> Self { | ||
Self::build(O::default()) | ||
} | ||
} | ||
|
||
#[derive(Default)] | ||
pub struct SimplePremintOptions { | ||
chain_id: Option<u64>, | ||
sender: Option<Address>, | ||
media: Option<String>, | ||
token_id: Option<u64>, | ||
} | ||
|
||
impl Factory<SimplePremintOptions> for SimplePremint { | ||
fn build(options: SimplePremintOptions) -> Self { | ||
let mut rng = rand::thread_rng(); | ||
|
||
Self::new( | ||
U256::from( | ||
options | ||
.chain_id | ||
.unwrap_or(rng.gen_range(1..=i64::MAX as u64)), | ||
), | ||
options | ||
.sender | ||
.unwrap_or(Address::from(rng.gen::<[u8; 20]>())), | ||
options.token_id.unwrap_or(rng.next_u64()), | ||
options | ||
.media | ||
.unwrap_or("http://example.com/token".to_string()), | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod factories; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters