-
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.
- Loading branch information
Showing
11 changed files
with
81 additions
and
55 deletions.
There are no files selected for viewing
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,40 @@ | ||
use std::sync::Arc; | ||
|
||
use alloy::rpc::types::eth::{TransactionInput, TransactionRequest}; | ||
use alloy_primitives::{address, Address, Bytes}; | ||
use alloy_provider::Provider; | ||
use alloy_sol_macro::sol; | ||
use alloy_sol_types::SolCall; | ||
use futures_util::StreamExt; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use crate::chain_list::ChainListProvider; | ||
|
||
pub static PREMINT_FACTORY_ADDR: Address = address!("7777773606e7e46C8Ba8B98C08f5cD218e31d340"); | ||
|
||
sol! { | ||
#[derive(Debug, Serialize, Deserialize, PartialEq)] | ||
IZoraPremintERC20V1, | ||
"src/premints/zora_premint/zora1155PremintExecutor_erc20v1.json" | ||
} | ||
|
||
pub async fn contract_call<T>(call: T, provider: &Arc<ChainListProvider>) -> eyre::Result<T::Return> | ||
where | ||
T: SolCall, | ||
{ | ||
provider | ||
.call( | ||
&TransactionRequest { | ||
to: Some(PREMINT_FACTORY_ADDR), | ||
input: TransactionInput::new(Bytes::from(call.abi_encode())), | ||
..Default::default() | ||
}, | ||
None, | ||
) | ||
.await | ||
.map_err(|err| eyre::eyre!("Error calling contract: {:?}", err)) | ||
.and_then(|response| { | ||
T::abi_decode_returns(&response, false) | ||
.map_err(|err| eyre::eyre!("Error decoding contract response: {:?}", err)) | ||
}) | ||
} |
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
pub mod contract; | ||
pub mod erc20v1; | ||
pub mod rules; | ||
pub mod types; | ||
pub mod v2; |
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
File renamed without changes.
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