-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathcomp_interact_main.rs
More file actions
71 lines (58 loc) · 1.96 KB
/
comp_interact_main.rs
File metadata and controls
71 lines (58 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#![allow(clippy::too_many_arguments)]
#![allow(unused)]
mod call_tree;
mod call_tree_calling_functions;
mod call_tree_deploy;
mod comp_interact_cli;
mod comp_interact_config;
mod comp_interact_controller;
mod comp_interact_state;
mod forwarder_proxy;
mod forwarder_queue_proxy;
mod vault_proxy;
use call_tree::CallState;
use clap::Parser;
use comp_interact_controller::ComposabilityInteract;
use multiversx_sc_snippets::imports::*;
const FUNGIBLE_TOKEN_ID: TestTokenIdentifier = TestTokenIdentifier::new("TOKEN-0000");
#[tokio::main]
async fn main() {
env_logger::init();
let mut composability_interact = ComposabilityInteract::init().await;
let cli = comp_interact_cli::InteractCli::parse();
match &cli.command {
Some(comp_interact_cli::InteractCliCommand::Full(args)) => {
composability_interact
.full_scenario(&args.endpoint_name, &args.endpoint_args)
.await;
},
None => {},
}
}
#[tokio::test]
#[ignore = "needs changes. to do when chain simulator set state is implemented"]
pub async fn transf_exec_by_user_cs_test() {
let mut composability_interact = ComposabilityInteract::init().await;
let wallet_address = composability_interact.wallet_address.clone();
// set state for wallet address on chain simulator (esdt balance)
let call_state = CallState::simple_example_1();
let (vault, forwarder) = composability_interact
.deploy_call_tree_contracts(&call_state)
.await;
let logs = composability_interact
.interactor
.tx()
.from(wallet_address)
.to(forwarder.first().unwrap())
.typed(forwarder_proxy::ForwarderProxy)
.forward_transf_exec_by_user_accept_funds(vault.first().unwrap())
.single_esdt(
&FUNGIBLE_TOKEN_ID.to_token_identifier(),
0,
&BigUint::from(100u64),
)
.returns(ReturnsLogs)
.run()
.await;
println!("Logs: {logs:?}");
}