Skip to content

Commit

Permalink
ScDeployStep code metadata default
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-marinica committed Jul 14, 2023
1 parent bc1a871 commit b766152
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 19 deletions.
7 changes: 1 addition & 6 deletions contracts/examples/adder/interact/src/adder_interact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ use adder_interact_state::State;
use clap::Parser;
use multiversx_sc_snippets::{
env_logger,
multiversx_sc::{
storage::mappers::SingleValue,
types::{Address, CodeMetadata},
},
multiversx_sc::{storage::mappers::SingleValue, types::Address},
multiversx_sc_scenario::{
api::StaticApi,
bech32,
Expand Down Expand Up @@ -106,7 +103,6 @@ impl AdderInteract {
ScDeployStep::new()
.call(self.state.default_adder().init(BigUint::from(0u64)))
.from(&self.wallet_address)
.code_metadata(CodeMetadata::all())
.code(&self.adder_code)
.gas_limit("5,000,000")
.expect(TxExpect::ok()),
Expand Down Expand Up @@ -138,7 +134,6 @@ impl AdderInteract {
let typed_sc_deploy = ScDeployStep::new()
.call(self.state.default_adder().init(0u32))
.from(&self.wallet_address)
.code_metadata(CodeMetadata::all())
.code(&self.adder_code)
.gas_limit("70,000,000")
.expect(TxExpect::ok());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ use multiversx_sc_scenario::{
use multiversx_sc_snippets::{
dns_address_for_name, env_logger,
multiversx_sc::{
codec::multi_types::MultiValueVec,
storage::mappers::SingleValue,
types::{Address, CodeMetadata},
codec::multi_types::MultiValueVec, storage::mappers::SingleValue, types::Address,
},
multiversx_sc_scenario::{
api::StaticApi, bech32, scenario_format::interpret_trait::InterpreterContext,
Expand Down Expand Up @@ -167,7 +165,6 @@ impl MultisigInteract {
.init(Config::load_config().quorum(), board)
.into_blockchain_call()
.from(&self.wallet_address)
.code_metadata(CodeMetadata::all())
.code(&self.multisig_code)
.gas_limit("70,000,000")
.expect(TxExpect::ok());
Expand Down Expand Up @@ -205,7 +202,6 @@ impl MultisigInteract {
.init(Config::load_config().quorum(), board.clone()),
)
.from(&self.wallet_address)
.code_metadata(CodeMetadata::all())
.code(&self.multisig_code)
.gas_limit("70,000,000")
.expect(TxExpect::ok());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use bf_interact_state::State;
use clap::Parser;
use multiversx_sc_snippets::{
env_logger,
multiversx_sc::types::{Address, CodeMetadata},
multiversx_sc::types::Address,
multiversx_sc_scenario::{
api::StaticApi,
bech32,
Expand Down Expand Up @@ -106,7 +106,6 @@ impl BasicFeaturesInteract {
ScDeployStep::new()
.call(self.state.default_contract().init())
.from(&self.wallet_address)
.code_metadata(CodeMetadata::all())
.code(&self.code_expr)
.gas_limit("4,000,000")
.expect(TxExpect::ok()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use forwarder_queue::ProxyTrait as _;
use multiversx_sc_snippets::{
multiversx_sc::{
codec::multi_types::OptionalValue,
types::{BoxedBytes, CodeMetadata, ManagedBuffer},
types::{BoxedBytes, ManagedBuffer},
},
multiversx_sc_scenario::{
api::StaticApi,
Expand Down Expand Up @@ -84,7 +84,6 @@ impl ComposabilityInteract {
.init(OptionalValue::<BoxedBytes>::None),
)
.from(&self.wallet_address)
.code_metadata(CodeMetadata::all())
.code(&self.vault_code)
.gas_limit("70,000,000")
.expect(TxExpect::ok());
Expand All @@ -104,7 +103,6 @@ impl ComposabilityInteract {
let typed_sc_deploy = ScDeployStep::new()
.call(self.state.default_forwarder_queue_address().init())
.from(&self.wallet_address)
.code_metadata(CodeMetadata::all())
.code(&self.forw_queue_code)
.gas_limit("70,000,000")
.expect(TxExpect::ok());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ impl State {
.init()
.into_blockchain_call()
.from(&self.wallet_address)
.code_metadata(CodeMetadata::all())
.contract_code(
"file:../output/rust-snippets-generator-test.wasm",
&InterpreterContext::default(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ fn write_deploy_method_impl(
.{}({})
.into_blockchain_call()
.from(&self.wallet_address)
.code_metadata(CodeMetadata::all())
.contract_code({}, &InterpreterContext::default())
.gas_limit(DEFAULT_GAS_LIMIT);
Expand Down
19 changes: 18 additions & 1 deletion framework/scenario/src/scenario/model/step/step_sc_deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::multiversx_sc::types::{CodeMetadata, ContractDeploy};

use super::{convert_call_args, TypedScDeploy};

#[derive(Debug, Default, Clone)]
#[derive(Debug, Clone)]
pub struct ScDeployStep {
pub id: String,
pub tx_id: Option<String>,
Expand All @@ -25,6 +25,23 @@ pub struct ScDeployStep {
pub response: Option<TxResponse>,
}

impl Default for ScDeployStep {
fn default() -> Self {
Self {
id: Default::default(),
tx_id: Default::default(),
explicit_tx_hash: Default::default(),
comment: Default::default(),
tx: Box::new(TxDeploy {
code_metadata: CodeMetadata::all(),
..Default::default()
}),
expect: Default::default(),
response: Default::default(),
}
}
}

impl ScDeployStep {
pub fn new() -> Self {
Self::default()
Expand Down

0 comments on commit b766152

Please sign in to comment.