-
Notifications
You must be signed in to change notification settings - Fork 102
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
contracts migration to new proxies and unified syntax #1522
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
e8c3c3f
migration to unified syntax
mihaicalinluca e626ba6
proxy pause sc migration to new proxy and unified syntax
mihaicalinluca c924c49
encode error from basic features migration to new proxy and unified s…
mihaicalinluca c4627e7
parent child migration and new proxy
mihaicalinluca 1852432
promises-features migration to new proxy
mihaicalinluca c4ae976
fix after review
mihaicalinluca ccaa7ab
proxy test first new proxy and migration to unified
mihaicalinluca 9ecb3ec
new proxy and migration for recursive caller
mihaicalinluca 3bb6cec
proxy test first fix
andrei-marinica 9fd7383
removed init and upgrade from builtin proxy functions
mihaicalinluca 5604d75
Merge pull request #1519 from multiversx/proxy-test-first
mihaicalinluca 81aae14
Merge pull request #1514 from multiversx/builtin-func-sc
mihaicalinluca 2665c3a
removed init and upgrade from proxy
mihaicalinluca 25fd2ae
removed encode error proxy
mihaicalinluca a320dca
fix after review
mihaicalinluca d02b4a4
Merge pull request #1516 from multiversx/encode-error-basic-features
mihaicalinluca e3f758a
removed generated tag and allows
mihaicalinluca 30e0665
Merge pull request #1515 from multiversx/proxy-pause-sc
mihaicalinluca 3ee9e95
Merge pull request #1517 from multiversx/composability-migration
mihaicalinluca File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
use multiversx_sc::proxy_imports::*; | ||
|
||
pub struct PausableProxy; | ||
|
||
impl<Env, From, To, Gas> TxProxyTrait<Env, From, To, Gas> for PausableProxy | ||
where | ||
Env: TxEnv, | ||
From: TxFrom<Env>, | ||
To: TxTo<Env>, | ||
Gas: TxGas<Env>, | ||
{ | ||
type TxProxyMethods = PausableProxyMethods<Env, From, To, Gas>; | ||
|
||
fn proxy_methods(self, tx: Tx<Env, From, To, (), Gas, (), ()>) -> Self::TxProxyMethods { | ||
PausableProxyMethods { wrapped_tx: tx } | ||
} | ||
} | ||
|
||
pub struct PausableProxyMethods<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> PausableProxyMethods<Env, From, To, Gas> | ||
where | ||
Env: TxEnv, | ||
Env::Api: VMApi, | ||
From: TxFrom<Env>, | ||
To: TxTo<Env>, | ||
Gas: TxGas<Env>, | ||
{ | ||
pub fn pause( | ||
self, | ||
) -> TxProxyCall<Env, From, To, Gas, ()> { | ||
self.wrapped_tx | ||
.raw_call() | ||
.function_name("pause") | ||
.original_result() | ||
} | ||
|
||
pub fn unpause( | ||
self, | ||
) -> TxProxyCall<Env, From, To, Gas, ()> { | ||
self.wrapped_tx | ||
.raw_call() | ||
.function_name("unpause") | ||
.original_result() | ||
} | ||
} |
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
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
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() | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...acts/feature-tests/composability/execute-on-dest-esdt-issue-callback/child/sc-config.toml
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[settings] | ||
proxy-paths = ["../parent/src/child_proxy.rs"] |
102 changes: 102 additions & 0 deletions
102
...feature-tests/composability/execute-on-dest-esdt-issue-callback/parent/src/child_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 |
---|---|---|
@@ -0,0 +1,102 @@ | ||
// Code generated by the multiversx-sc proxy generator. DO NOT EDIT. | ||
|
||
//////////////////////////////////////////////////// | ||
////////////////// AUTO-GENERATED ////////////////// | ||
//////////////////////////////////////////////////// | ||
|
||
#![allow(dead_code)] | ||
#![allow(clippy::all)] | ||
|
||
use multiversx_sc::proxy_imports::*; | ||
|
||
pub struct ChildProxy; | ||
|
||
impl<Env, From, To, Gas> TxProxyTrait<Env, From, To, Gas> for ChildProxy | ||
where | ||
Env: TxEnv, | ||
From: TxFrom<Env>, | ||
To: TxTo<Env>, | ||
Gas: TxGas<Env>, | ||
{ | ||
type TxProxyMethods = ChildProxyMethods<Env, From, To, Gas>; | ||
|
||
fn proxy_methods(self, tx: Tx<Env, From, To, (), Gas, (), ()>) -> Self::TxProxyMethods { | ||
ChildProxyMethods { wrapped_tx: tx } | ||
} | ||
} | ||
|
||
pub struct ChildProxyMethods<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, Gas> ChildProxyMethods<Env, From, (), Gas> | ||
where | ||
Env: TxEnv, | ||
Env::Api: VMApi, | ||
From: TxFrom<Env>, | ||
Gas: TxGas<Env>, | ||
{ | ||
pub fn init( | ||
self, | ||
) -> TxProxyDeploy<Env, From, Gas, ()> { | ||
self.wrapped_tx | ||
.raw_deploy() | ||
.original_result() | ||
} | ||
} | ||
|
||
#[rustfmt::skip] | ||
impl<Env, From, To, Gas> ChildProxyMethods<Env, From, To, Gas> | ||
where | ||
Env: TxEnv, | ||
Env::Api: VMApi, | ||
From: TxFrom<Env>, | ||
To: TxTo<Env>, | ||
Gas: TxGas<Env>, | ||
{ | ||
} | ||
|
||
#[rustfmt::skip] | ||
impl<Env, From, To, Gas> ChildProxyMethods<Env, From, To, Gas> | ||
where | ||
Env: TxEnv, | ||
Env::Api: VMApi, | ||
From: TxFrom<Env>, | ||
To: TxTo<Env>, | ||
Gas: TxGas<Env>, | ||
{ | ||
pub fn issue_wrapped_egld< | ||
Arg0: CodecInto<ManagedBuffer<Env::Api>>, | ||
Arg1: CodecInto<ManagedBuffer<Env::Api>>, | ||
Arg2: CodecInto<BigUint<Env::Api>>, | ||
>( | ||
self, | ||
token_display_name: Arg0, | ||
token_ticker: Arg1, | ||
initial_supply: Arg2, | ||
) -> TxProxyCall<Env, From, To, Gas, ()> { | ||
self.wrapped_tx | ||
.raw_call() | ||
.function_name("issueWrappedEgld") | ||
.argument(&token_display_name) | ||
.argument(&token_ticker) | ||
.argument(&initial_supply) | ||
.original_result() | ||
} | ||
|
||
pub fn wrapped_egld_token_identifier( | ||
self, | ||
) -> TxProxyCall<Env, From, To, Gas, TokenIdentifier<Env::Api>> { | ||
self.wrapped_tx | ||
.raw_call() | ||
.function_name("getWrappedEgldTokenIdentifier") | ||
.original_result() | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an example where there should be no prefix, but I'll fix it myself later today.