Skip to content

Commit

Permalink
updated to use new contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
NanezX committed Dec 15, 2023
1 parent c845f78 commit e135775
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 28 deletions.
21 changes: 0 additions & 21 deletions subgraph/tests/utils/deploy/meta_getter/mod.rs

This file was deleted.

2 changes: 0 additions & 2 deletions subgraph/tests/utils/deploy/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
mod erc20;
mod meta_getter;
mod orderbook;
mod registry1820;
mod touch_deployer;

pub use erc20::deploy_erc20;
pub use meta_getter::get_authoring_meta;
pub use orderbook::{get_orderbook, get_orderbook_meta};
pub use registry1820::deploy1820;
pub use touch_deployer::touch_deployer;
28 changes: 23 additions & 5 deletions subgraph/tests/utils/deploy/touch_deployer/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use crate::generated::{
Rainterpreter, RainterpreterExpressionDeployer, RainterpreterStore,
Rainterpreter, RainterpreterExpressionDeployer, RainterpreterParser, RainterpreterStore,
RAINTERPRETEREXPRESSIONDEPLOYER_ABI, RAINTERPRETEREXPRESSIONDEPLOYER_BYTECODE,
};
use crate::utils::deploy::get_authoring_meta;
use crate::utils::setup::get_wallets_handler;
use anyhow::Result;
use ethers::{
Expand All @@ -19,8 +18,13 @@ pub async fn touch_deployer(
) -> Result<RainterpreterExpressionDeployer<SignerMiddleware<Provider<Http>, Wallet<SigningKey>>>> {
let rainterpreter = rainterpreter_deploy().await?;
let store = rainterpreter_store_deploy().await?;
let expression_deployer =
rainterpreter_expression_deployer_deploy(rainterpreter.address(), store.address()).await?;
let parser = rainterpreter_parser_deploy().await?;
let expression_deployer = rainterpreter_expression_deployer_deploy(
rainterpreter.address(),
store.address(),
parser.address(),
)
.await?;

Ok(expression_deployer)
}
Expand All @@ -37,14 +41,22 @@ pub async fn rainterpreter_store_deploy(
Ok(RainterpreterStore::deploy(deployer, ())?.send().await?)
}

pub async fn rainterpreter_parser_deploy(
) -> Result<RainterpreterParser<SignerMiddleware<Provider<Http>, Wallet<SigningKey>>>> {
let deployer = get_wallets_handler().get_client(0).await?;
Ok(RainterpreterParser::deploy(deployer, ())?.send().await?)
}

pub async fn rainterpreter_expression_deployer_deploy(
rainiterpreter_address: H160,
store_address: H160,
parser_address: H160,
) -> Result<RainterpreterExpressionDeployer<SignerMiddleware<Provider<Http>, Wallet<SigningKey>>>> {
let meta_bytes = get_authoring_meta().await?.to_vec();
let meta_bytes = get_construction_meta()?;
let args = vec![Token::Tuple(vec![
Token::Address(rainiterpreter_address),
Token::Address(store_address),
Token::Address(parser_address),
Token::Bytes(meta_bytes),
])];

Expand All @@ -62,3 +74,9 @@ pub async fn rainterpreter_expression_deployer_deploy(
deployer,
))
}

pub fn get_construction_meta() -> anyhow::Result<Vec<u8>> {
Ok(std::fs::read(
"../lib/rain.interpreter/meta/RainterpreterExpressionDeployerNPE2.rain.meta",
)?)
}

0 comments on commit e135775

Please sign in to comment.