-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1514 from multiversx/builtin-func-sc
builtin func sc migration to new proxies and unified syntax
- Loading branch information
Showing
2 changed files
with
73 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 65 additions & 7 deletions
72
contracts/feature-tests/composability/builtin-func-features/src/builtin_func_proxy.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,68 @@ | ||
multiversx_sc::imports!(); | ||
// Code generated by the multiversx-sc proxy generator. DO NOT EDIT. | ||
|
||
#[multiversx_sc::derive::proxy] | ||
pub trait UserBuiltin { | ||
#[endpoint(SetUserName)] | ||
fn set_user_name(&self, name: &ManagedBuffer); | ||
//////////////////////////////////////////////////// | ||
////////////////// AUTO-GENERATED ////////////////// | ||
//////////////////////////////////////////////////// | ||
|
||
#[endpoint(DeleteUserName)] | ||
fn delete_user_name(&self); | ||
#![allow(dead_code)] | ||
#![allow(clippy::all)] | ||
|
||
use multiversx_sc::proxy_imports::*; | ||
|
||
pub struct UserBuiltinProxy; | ||
|
||
impl<Env, From, To, Gas> TxProxyTrait<Env, From, To, Gas> for UserBuiltinProxy | ||
where | ||
Env: TxEnv, | ||
From: TxFrom<Env>, | ||
To: TxTo<Env>, | ||
Gas: TxGas<Env>, | ||
{ | ||
type TxProxyMethods = UserBuiltinProxyMethods<Env, From, To, Gas>; | ||
|
||
fn proxy_methods(self, tx: Tx<Env, From, To, (), Gas, (), ()>) -> Self::TxProxyMethods { | ||
UserBuiltinProxyMethods { wrapped_tx: tx } | ||
} | ||
} | ||
|
||
pub struct UserBuiltinProxyMethods<Env, From, To, Gas> | ||
where | ||
Env: TxEnv, | ||
From: TxFrom<Env>, | ||
To: TxTo<Env>, | ||
Gas: TxGas<Env>, | ||
{ | ||
wrapped_tx: Tx<Env, From, To, (), Gas, (), ()>, | ||
} | ||
|
||
#[rustfmt::skip] | ||
impl<Env, From, To, Gas> UserBuiltinProxyMethods<Env, From, To, Gas> | ||
where | ||
Env: TxEnv, | ||
Env::Api: VMApi, | ||
From: TxFrom<Env>, | ||
To: TxTo<Env>, | ||
Gas: TxGas<Env>, | ||
{ | ||
pub fn set_user_name< | ||
Arg0: CodecInto<ManagedBuffer<Env::Api>>, | ||
>( | ||
self, | ||
name: Arg0, | ||
) -> TxProxyCall<Env, From, To, Gas, ()> { | ||
self.wrapped_tx | ||
.raw_call() | ||
.function_name("SetUserName") | ||
.argument(&name) | ||
.original_result() | ||
} | ||
|
||
pub fn delete_user_name( | ||
self, | ||
) -> TxProxyCall<Env, From, To, Gas, ()> { | ||
self.wrapped_tx | ||
.raw_call() | ||
.function_name("DeleteUserName") | ||
.original_result() | ||
} | ||
} |