Skip to content
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

Add prediction market and swaps proxies #1038

Merged
merged 5 commits into from
Jul 17, 2023
Merged

Add prediction market and swaps proxies #1038

merged 5 commits into from
Jul 17, 2023

Conversation

Chralt98
Copy link
Member

@Chralt98 Chralt98 commented Jul 6, 2023

What does it do?

Fixes #970

It allows to delegate a call on behalf of an account to another account.

It adds enum variants of the ProxyType in order to use them for different calls of zrml_prediction_markets or zrml_swaps.

What important points should reviewers know?

Is there something left for follow-up PRs?

What alternative implementations were considered?

Are there relevant PRs or issues?

References

@Chralt98 Chralt98 added the s:review-needed The pull request requires reviews label Jul 6, 2023
@Chralt98 Chralt98 requested a review from sea212 as a code owner July 6, 2023 11:43
@Chralt98 Chralt98 self-assigned this Jul 6, 2023
@codecov-commenter
Copy link

codecov-commenter commented Jul 6, 2023

Codecov Report

Merging #1038 (8ad96ca) into main (00262ca) will decrease coverage by 0.03%.
The diff coverage is n/a.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##             main    #1038      +/-   ##
==========================================
- Coverage   94.52%   94.49%   -0.03%     
==========================================
  Files          92       92              
  Lines       20987    21072      +85     
==========================================
+ Hits        19838    19913      +75     
- Misses       1149     1159      +10     
Flag Coverage Δ
tests 94.49% <ø> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
primitives/src/proxy_type.rs 0.00% <ø> (ø)

... and 3 files with indirect coverage changes

@@ -36,6 +37,11 @@ pub enum ProxyType {
CancelProxy,
Governance,
Staking,
CreateMarket,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can a proxy only have one type? Meaning if you want to grant a user the ability to create markets and report outcomes but not provide liquidity or trade you have to have two proxy accounts of the individual types?

Copy link
Member Author

@Chralt98 Chralt98 Jul 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://wiki.polkadot.network/docs/learn-proxies

You can have multiple proxies for one account.

Means: As delegator you can add a "CreateMarket" proxy for account A (delegatee) and then you can add a "ReportOutcome" proxy for the same account A.

Now account A can create markets and do oracle reports on your behalf.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I guess when the proxy transaction is wrapped using polkadotjs we have to specify the correct proxy type for the extrinsic like this?

sdk.api.tx.proxy.proxy(proxy?.address, "CreateMarket", createMarketExtrinsic);
sdk.api.tx.proxy.proxy(proxy?.address, "ReportOutcome", reportExtrinsic);

@Chralt98 Chralt98 requested a review from yornaath July 7, 2023 08:03
Copy link
Member

@sea212 sea212 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some comments, I think @maltekliemann should evaluate them as well before taking action.

runtime/common/src/lib.rs Outdated Show resolved Hide resolved
runtime/common/src/lib.rs Outdated Show resolved Hide resolved
@sea212 sea212 added this to the v0.4.0 milestone Jul 7, 2023
Copy link
Member

@maltekliemann maltekliemann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about redeem_shares? I think that should go both into Trading and Liquidity, because both "roles" need to redeem shares when the market is done.

primitives/src/proxy_type.rs Show resolved Hide resolved
primitives/src/proxy_type.rs Show resolved Hide resolved
runtime/common/src/lib.rs Outdated Show resolved Hide resolved
runtime/common/src/lib.rs Outdated Show resolved Hide resolved
runtime/common/src/lib.rs Outdated Show resolved Hide resolved
runtime/common/src/lib.rs Outdated Show resolved Hide resolved
runtime/common/src/lib.rs Outdated Show resolved Hide resolved
runtime/common/src/lib.rs Outdated Show resolved Hide resolved
maltekliemann
maltekliemann previously approved these changes Jul 13, 2023
primitives/src/proxy_type.rs Outdated Show resolved Hide resolved
runtime/common/src/lib.rs Outdated Show resolved Hide resolved
Co-authored-by: Malte Kliemann <mail@maltekliemann.com>
runtime/common/src/lib.rs Outdated Show resolved Hide resolved
@sea212 sea212 added s:accepted This pull request is ready for merge and removed s:review-needed The pull request requires reviews labels Jul 14, 2023
@Chralt98 Chralt98 merged commit 257932c into main Jul 17, 2023
12 checks passed
@Chralt98 Chralt98 deleted the chralt98-pm-proxies branch July 17, 2023 07:57
sea212 added a commit that referenced this pull request Jul 17, 2023
@sea212
Copy link
Member

sea212 commented Jul 17, 2023

Missclick in regards to the Revert commit (undone).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s:accepted This pull request is ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Properly configure Proxies
5 participants