Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge rc/0.42 to feat/whitebox #1153

Merged
merged 22 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
978d89d
multisig interactor nft scenario test
andrei-marinica Jun 5, 2023
f62dc6a
system sc stub
andrei-marinica Jun 5, 2023
b3e3107
handle token issue and set special role
ovstinga Jun 28, 2023
4e4b28b
clippy fixes
ovstinga Jun 28, 2023
d50a80f
Merge branch 'rc/v0.42' into system-sc
ovstinga Jun 30, 2023
9b4b2d0
fixes after merge, random token identifier generation method
ovstinga Jun 30, 2023
21dc513
handle issued token identifiers for blockchain update part 1
ovstinga Jun 30, 2023
9b29ada
handle issued token identifiers for blockchain update part 2
ovstinga Jul 3, 2023
0fc5ee8
remove bech32 crate from vm and group unimplemented fns from system_sc
ovstinga Jul 4, 2023
a30201d
find first token identifier matching ticker and add some tests
ovstinga Jul 4, 2023
27e617c
fix clippy issues
ovstinga Jul 4, 2023
46bf06b
Merge pull request #1100 from multiversx/system-sc
ovstinga Jul 4, 2023
2e95bd3
add cli for issue nft with all roles and new trace for scenarios
ovstinga Jul 5, 2023
3671cd3
test-gen with new version
ovstinga Jul 5, 2023
1b786f7
system_mock register and set all roles and refactor
ovstinga Jul 5, 2023
2daacf8
Merge pull request #1146 from multiversx/interactor-nft-all-roles-trace
andrei-marinica Jul 10, 2023
00679f1
Merge branch 'rc/v0.42' into feat/whitebox (without system-sc)
andrei-marinica Jul 10, 2023
3022b06
Merge branch 'rc/v0.42' into feat/whitebox (system-sc)
andrei-marinica Jul 10, 2023
def10e5
vm refactor - VMTokenType enum
andrei-marinica Jul 10, 2023
6fa2d67
clippy fix
andrei-marinica Jul 10, 2023
715b0a9
fix after merge - BlockchainUpdate apply
andrei-marinica Jul 10, 2023
1e5114b
Merge branch 'feat/whitebox' into whitebox-merge
andrei-marinica Jul 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/examples/multisig/interact-rs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
state.toml

# Trace file of interactor tooling
interactor_trace.scen.json
interactor*.scen.json
11 changes: 9 additions & 2 deletions contracts/examples/multisig/interact-rs/src/multisig_interact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,17 @@ async fn main() {
Some(multisig_interact_cli::InteractCliCommand::MultiDeploy(args)) => {
multisig_interact.multi_deploy(&args.count).await;
},
Some(multisig_interact_cli::InteractCliCommand::NftFullAllRoles) => {
multisig_interact
.issue_multisig_and_collection_with_all_roles_full()
.await;
},
Some(multisig_interact_cli::InteractCliCommand::NftFull) => {
multisig_interact.issue_multisig_and_collection_full().await;
},
Some(multisig_interact_cli::InteractCliCommand::NftIssueAllRoles) => {
multisig_interact.issue_collection_with_all_roles().await;
},
Some(multisig_interact_cli::InteractCliCommand::NftIssue) => {
multisig_interact.issue_collection().await;
},
Expand Down Expand Up @@ -107,8 +115,7 @@ impl MultisigInteract {
interactor,
wallet_address,
system_sc_address: bech32::decode(SYSTEM_SC_BECH32),
collection_token_identifier: multisig_interact_nfts::COLLECTION_TOKEN_IDENTIFIER
.to_string(),
collection_token_identifier: String::new(),
state: State::load_state(),
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,18 @@ pub enum InteractCliCommand {
Feed,
#[command(name = "multi-deploy", about = "Multiple deploy contracts")]
MultiDeploy(MultiDeployArgs),
#[command(
name = "nft-full-all-roles",
about = "Issue multisig and collection with all roles"
)]
NftFullAllRoles,
#[command(name = "nft-full", about = "Issue multisig and collection")]
NftFull,
#[command(
name = "nft-issue-all-roles",
about = "Issue collection with all roles"
)]
NftIssueAllRoles,
#[command(name = "nft-issue", about = "Issue collection")]
NftIssue,
#[command(name = "nft-items", about = "Create items")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const ISSUE_COST: u64 = 50000000000000000; // 0.05 EGLD

const COLLECTION_NAME: &str = "TestCollection1";
const COLLECTION_TICKER: &str = "TESTCOLL1";
pub const COLLECTION_TOKEN_IDENTIFIER: &str = "TESTCOLL1-4096bf";
const TOKEN_TYPE: &str = "NFT";

const NUM_ITEMS: usize = 3;
const ROYALTIES: usize = 3000;
const METADATA: &str = "tags:test,rust-interactor";
Expand All @@ -23,6 +24,94 @@ impl MultisigInteract {
self.create_items().await;
}

pub async fn issue_multisig_and_collection_with_all_roles_full(&mut self) {
self.deploy().await;
self.feed_contract_egld().await;
self.issue_collection_with_all_roles().await;
self.interactor.sleep(Duration::from_secs(15)).await;
self.create_items().await;
}

pub async fn propose_issue_collection_with_all_roles(&mut self) -> Option<usize> {
let system_sc_address = bech32::decode(SYSTEM_SC_BECH32);
let mut typed_sc_call = self
.state
.multisig()
.propose_async_call(
system_sc_address,
ISSUE_COST,
"registerAndSetAllRoles".to_string(),
MultiValueVec::from([
COLLECTION_NAME.as_bytes(),
COLLECTION_TICKER.as_bytes(),
TOKEN_TYPE.as_bytes(),
top_encode_to_vec_u8_or_panic(&0u32).as_slice(),
]),
)
.into_blockchain_call()
.from(&self.wallet_address)
.gas_limit("10,000,000")
.expect(TxExpect::ok());

self.interactor.sc_call(&mut typed_sc_call).await;

let result = typed_sc_call.result();
if result.is_err() {
println!(
"propose issue collection with roles failed with: {}",
result.err().unwrap()
);
return None;
}

let action_id = result.unwrap();
println!("successfully proposed issue colllection with roles action `{action_id}`");
Some(action_id)
}

pub async fn issue_collection_with_all_roles(&mut self) {
println!("proposing issue collection with all roles...");
let action_id = self.propose_issue_collection_with_all_roles().await;
if action_id.is_none() {
return;
}

let action_id = action_id.unwrap();
println!("perfoming issue collection with all roles action `{action_id}`...");

if !self.quorum_reached(action_id).await && !self.sign(action_id).await {
return;
}
println!("quorum reached for action `{action_id}`");

let mut typed_sc_call = self
.state
.multisig()
.perform_action_endpoint(action_id)
.into_blockchain_call()
.from(&self.wallet_address)
.gas_limit("80,000,000");

self.interactor.sc_call(&mut typed_sc_call).await;

let result = typed_sc_call
.response()
.issue_non_fungible_new_token_identifier();
if result.is_err() {
println!(
"perform issue collection with all roles failed with: {}",
result.err().unwrap()
);
return;
}

self.collection_token_identifier = result.unwrap();
println!(
"collection token identifier: {}",
self.collection_token_identifier
);
}

pub async fn propose_issue_collection(&mut self) -> Option<usize> {
let system_sc_address = bech32::decode(SYSTEM_SC_BECH32);
let mut typed_sc_call = self
Expand Down
Loading
Loading