When using dynamic_link macro, users cannot make mocks impls of dynamic callee functions in the caller contract. Enable it with an attribute of the macro.
// if `user_defined_mock` is false, this macro generates `impl Bar for Foo` for all targets.
// if it is true, this generates impl for wasm32 target only.
#[dynamic_link(Foo, user_defined_mock = true)]
trait Bar: Contract {
fn foobar(...) { ... }
}
// mock impl
#[cfg(not(target_arch = "wasm32"))]
impl Bar for Foo {
fn foobar(...) { ... }
}
When using dynamic_link macro, users cannot make mocks impls of dynamic callee functions in the caller contract. Enable it with an attribute of the macro.