Skip to content

Commit

Permalink
removed sc_deploy_use_new_address
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-marinica committed Jul 14, 2023
1 parent d340783 commit f2de263
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ fn adder_scenario_constructed_raw() {
.put_account(owner_address, Account::new().nonce(1))
.new_address(owner_address, 1, "sc:adder"),
)
.sc_deploy_use_new_address(
.sc_deploy_use_result(

Check failure on line 27 in contracts/examples/adder/tests/adder_mandos_constructed_with_calls_test.rs

View workflow job for this annotation

GitHub Actions / clippy

[clippy] contracts/examples/adder/tests/adder_mandos_constructed_with_calls_test.rs#L27

error[E0283]: type annotations needed for `multiversx_sc_scenario::scenario_model::TypedResponse<RequestedResult>` --> contracts/examples/adder/tests/adder_mandos_constructed_with_calls_test.rs:34:27 | 27 | .sc_deploy_use_result( | -------------------- type must be known at this point ... 34 | |new_address, _| { | ^ | = note: multiple `impl`s satisfying `_: multiversx_sc::multiversx_sc_codec::CodecFrom<()>` found in the `multiversx_sc_codec` crate: - impl<T, U> multiversx_sc::multiversx_sc_codec::CodecFrom<U> for multiversx_sc::multiversx_sc_codec::multi_types::OptionalValue<T> where T: multiversx_sc::multiversx_sc_codec::TopEncodeMulti, T: multiversx_sc::multiversx_sc_codec::TopDecodeMulti, U: multiversx_sc::multiversx_sc_codec::CodecFrom<T>, U: multiversx_sc::multiversx_sc_codec::CodecFromSelf, U: multiversx_sc::multiversx_sc_codec::TopEncodeMulti, U: multiversx_sc::multiversx_sc_codec::TopDecodeMulti; - impl<T> multiversx_sc::multiversx_sc_codec::CodecFrom<T> for T where T: multiversx_sc::multiversx_sc_codec::TopEncodeMulti, T: multiversx_sc::multiversx_sc_codec::TopDecodeMulti, T: multiversx_sc::multiversx_sc_codec::CodecFromSelf; - impl<T> multiversx_sc::multiversx_sc_codec::CodecFrom<T> for multiversx_sc::multiversx_sc_codec::multi_types::PlaceholderOutput where T: multiversx_sc::multiversx_sc_codec::TopEncodeMulti, T: multiversx_sc::multiversx_sc_codec::CodecFromSelf; note: required by a bound in `multiversx_sc_scenario::facade::scenario_world_steps::<impl multiversx_sc_scenario::ScenarioWorld>::sc_deploy_use_result` --> /home/runner/work/mx-sdk-rs/mx-sdk-rs/framework/scenario/src/facade/scenario_world_steps.rs:169:26 | 169 | RequestedResult: CodecFrom<OriginalResult>, | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `multiversx_sc_scenario::facade::scenario_world_steps::<impl ScenarioWorld>::sc_deploy_use_result` help: consider giving this closure parameter an explicit type, where the type for type parameter `RequestedResult` is specified | 34 | |new_address, _: multiversx_sc_scenario::scenario_model::TypedResponse<RequestedResult>| { | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Raw output
contracts/examples/adder/tests/adder_mandos_constructed_with_calls_test.rs:27:10:e:error[E0283]: type annotations needed for `multiversx_sc_scenario::scenario_model::TypedResponse<RequestedResult>`
   --> contracts/examples/adder/tests/adder_mandos_constructed_with_calls_test.rs:34:27
    |
27  |         .sc_deploy_use_result(
    |          -------------------- type must be known at this point
...
34  |             |new_address, _| {
    |                           ^
    |
    = note: multiple `impl`s satisfying `_: multiversx_sc::multiversx_sc_codec::CodecFrom<()>` found in the `multiversx_sc_codec` crate:
            - impl<T, U> multiversx_sc::multiversx_sc_codec::CodecFrom<U> for multiversx_sc::multiversx_sc_codec::multi_types::OptionalValue<T>
              where T: multiversx_sc::multiversx_sc_codec::TopEncodeMulti, T: multiversx_sc::multiversx_sc_codec::TopDecodeMulti, U: multiversx_sc::multiversx_sc_codec::CodecFrom<T>, U: multiversx_sc::multiversx_sc_codec::CodecFromSelf, U: multiversx_sc::multiversx_sc_codec::TopEncodeMulti, U: multiversx_sc::multiversx_sc_codec::TopDecodeMulti;
            - impl<T> multiversx_sc::multiversx_sc_codec::CodecFrom<T> for T
              where T: multiversx_sc::multiversx_sc_codec::TopEncodeMulti, T: multiversx_sc::multiversx_sc_codec::TopDecodeMulti, T: multiversx_sc::multiversx_sc_codec::CodecFromSelf;
            - impl<T> multiversx_sc::multiversx_sc_codec::CodecFrom<T> for multiversx_sc::multiversx_sc_codec::multi_types::PlaceholderOutput
              where T: multiversx_sc::multiversx_sc_codec::TopEncodeMulti, T: multiversx_sc::multiversx_sc_codec::CodecFromSelf;
note: required by a bound in `multiversx_sc_scenario::facade::scenario_world_steps::<impl multiversx_sc_scenario::ScenarioWorld>::sc_deploy_use_result`
   --> /home/runner/work/mx-sdk-rs/mx-sdk-rs/framework/scenario/src/facade/scenario_world_steps.rs:169:26
    |
169 |         RequestedResult: CodecFrom<OriginalResult>,
    |                          ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `multiversx_sc_scenario::facade::scenario_world_steps::<impl ScenarioWorld>::sc_deploy_use_result`
help: consider giving this closure parameter an explicit type, where the type for type parameter `RequestedResult` is specified
    |
34  |             |new_address, _: multiversx_sc_scenario::scenario_model::TypedResponse<RequestedResult>| {
    |                            ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


__END__
ScDeployStep::new()
.from(owner_address)
.contract_code("file:output/adder.wasm", &ic)
.call(adder_contract.init(5u32))
.gas_limit("5,000,000")
.expect(TxExpect::ok().no_result()),
|new_address| {
|new_address, _| {

Check failure on line 34 in contracts/examples/adder/tests/adder_mandos_constructed_with_calls_test.rs

View workflow job for this annotation

GitHub Actions / Contracts / Rust tests

type annotations needed for `TypedResponse<RequestedResult>`

Check failure on line 34 in contracts/examples/adder/tests/adder_mandos_constructed_with_calls_test.rs

View workflow job for this annotation

GitHub Actions / Contracts / Wasm tests

type annotations needed for `TypedResponse<RequestedResult>`
assert_eq!(new_address, adder_contract.to_address());
},
)
Expand Down
11 changes: 0 additions & 11 deletions framework/scenario/src/facade/scenario_world_steps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,17 +191,6 @@ impl ScenarioWorld {
(new_address, typed_response.result.unwrap())
}

pub fn sc_deploy_use_new_address<S, F>(&mut self, step: S, use_new_address: F) -> &mut Self
where
S: AsMut<ScDeployStep>,
F: FnOnce(Address),
{
self.sc_deploy_use_raw_response(step, |response| {
let new_address = unwrap_new_address(response);
use_new_address(new_address);
})
}

/// Adds a simple transfer step, then executes it.
pub fn transfer_step(&mut self, step: TransferStep) -> &mut Self {
self.run_transfer_step(&step);
Expand Down
16 changes: 0 additions & 16 deletions framework/snippets/src/interactor_sc_extra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,22 +134,6 @@ impl Interactor {
})
.await
}

pub async fn sc_deploy_use_new_address<S, F>(
&mut self,
step: S,
use_new_address: F,
) -> &mut Self
where
S: AsMut<ScDeployStep>,
F: FnOnce(Address),
{
self.sc_deploy_use_raw_response(step, |response| {
let new_address = unwrap_new_address(response);
use_new_address(new_address);
})
.await
}
}

fn unwrap_response(opt_response: &Option<TxResponse>) -> &TxResponse {
Expand Down

0 comments on commit f2de263

Please sign in to comment.