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

feat(jellyfish-transaction): add on-chain governance dftx #1851

Merged
merged 15 commits into from
Dec 2, 2022

Conversation

delphk
Copy link
Contributor

@delphk delphk commented Nov 7, 2022

What this PR does / why we need it:

/kind feature

Which issue(s) does this PR fixes?:

Fixes #1822 and fixes #1890

Additional comments?:

@github-actions github-actions bot added area/packages kind/feature New feature request labels Nov 7, 2022
@netlify
Copy link

netlify bot commented Nov 7, 2022

Deploy Preview for jellyfishsdk ready!

Name Link
🔨 Latest commit b34bbc8
🔍 Latest deploy log https://app.netlify.com/sites/jellyfishsdk/deploys/6386c58b644f1c000849a409
😎 Deploy Preview https://deploy-preview-1851--jellyfishsdk.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@codeclimate
Copy link

codeclimate bot commented Nov 7, 2022

Code Climate has analyzed commit b34bbc8 and detected 0 issues on this pull request.

View more on Code Climate.

@codecov
Copy link

codecov bot commented Nov 7, 2022

Codecov Report

Base: 89.95% // Head: 94.12% // Increases project coverage by +4.17% 🎉

Coverage data is based on head (b34bbc8) compared to base (256e3ef).
Patch coverage: 90.47% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1851      +/-   ##
==========================================
+ Coverage   89.95%   94.12%   +4.17%     
==========================================
  Files         358      361       +3     
  Lines       10432    10487      +55     
  Branches     1317     1322       +5     
==========================================
+ Hits         9384     9871     +487     
+ Misses       1012      592     -420     
+ Partials       36       24      -12     
Impacted Files Coverage Δ
...nsaction-builder/src/txn/txn_builder_governance.ts 79.31% <81.81%> (+55.50%) ⬆️
...h-transaction-builder/src/txn/txn_builder_error.ts 100.00% <100.00%> (ø)
...ish-transaction/src/script/dftx/dftx_governance.ts 100.00% <100.00%> (+19.31%) ⬆️
packages/jellyfish-api-core/src/category/oracle.ts 94.28% <0.00%> (-5.72%) ⬇️
...ackages/jellyfish-api-core/src/category/account.ts 94.04% <0.00%> (-2.39%) ⬇️
packages/jellyfish-wallet-classic/src/index.ts 100.00% <0.00%> (ø)
packages/jellyfish-wallet-classic/src/classic.ts 100.00% <0.00%> (ø)
apps/rich-list-api/src/modules/QueueModule.ts 100.00% <0.00%> (ø)
apps/whale-api/src/module.api/poolpair.service.ts 81.64% <0.00%> (+0.39%) ⬆️
apps/whale-api/src/module.api/loan.controller.ts 93.26% <0.00%> (+1.92%) ⬆️
... and 49 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@github-actions
Copy link

github-actions bot commented Nov 7, 2022

Docker build preview for jellyfish/apps is ready!

Built with commit 37f2038

  • ghcr.io/jellyfishsdk/legacy-api:pr-1851
  • ghcr.io/jellyfishsdk/ocean-api:pr-1851
  • ghcr.io/jellyfishsdk/playground-api:pr-1851
  • ghcr.io/jellyfishsdk/status-api:pr-1851
  • ghcr.io/jellyfishsdk/whale-api:pr-1851

You can also get an immutable image with the commit hash

  • ghcr.io/jellyfishsdk/legacy-api:37f2038c8063f9813a2676f4934f17330dfd5ffc
  • ghcr.io/jellyfishsdk/ocean-api:37f2038c8063f9813a2676f4934f17330dfd5ffc
  • ghcr.io/jellyfishsdk/playground-api:37f2038c8063f9813a2676f4934f17330dfd5ffc
  • ghcr.io/jellyfishsdk/status-api:37f2038c8063f9813a2676f4934f17330dfd5ffc
  • ghcr.io/jellyfishsdk/whale-api:37f2038c8063f9813a2676f4934f17330dfd5ffc

@delphk delphk marked this pull request as ready for review November 23, 2022 08:40
infinia-yzl
infinia-yzl previously approved these changes Nov 24, 2022
Copy link
Contributor

@infinia-yzl infinia-yzl left a comment

Choose a reason for hiding this comment

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

LGTM

helloscoopa
helloscoopa previously approved these changes Nov 24, 2022
Copy link
Contributor

@helloscoopa helloscoopa left a comment

Choose a reason for hiding this comment

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

LGTM

infinia-yzl
infinia-yzl previously approved these changes Nov 25, 2022
infinia-yzl
infinia-yzl previously approved these changes Nov 29, 2022
Copy link
Contributor

@fuxingloh fuxingloh left a comment

Choose a reason for hiding this comment

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

With on-chain RPC merged, there are conflicts to be resolved.

cwkang1998
cwkang1998 previously approved these changes Nov 29, 2022
Copy link
Contributor

@cwkang1998 cwkang1998 left a comment

Choose a reason for hiding this comment

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

Needs to resolve merge conflict

@delphk delphk dismissed stale reviews from cwkang1998 and infinia-yzl via b34bbc8 November 30, 2022 02:52
Copy link
Contributor

@imkven imkven left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@fuxingloh fuxingloh left a comment

Choose a reason for hiding this comment

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

Overall LGTM!

@@ -12,7 +12,12 @@ export class TxnBuilderGovernance extends P2WPKHTxnBuilder {
* @returns {Promise<TransactionSegWit>}
*/
async createCfp (createCfp: CreateCfp, changeScript: Script): Promise<TransactionSegWit> {
const creationFee = this.network.name === 'regtest' ? new BigNumber('1') : new BigNumber('10')
if (createCfp.nCycles > 100) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess should also check for negative?

'CreateCfp cycles should be between 0 and 100'
)
}
const creationFee = BigNumber.maximum(10, createCfp.nAmount.multipliedBy(0.01))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const creationFee = BigNumber.maximum(10, createCfp.nAmount.multipliedBy(0.01))
// Creation fee must 1% of the requested amount
const creationFee = BigNumber.maximum(10, createCfp.nAmount.multipliedBy(0.01))

I would clarify that and add more comments/documentation to the method. Since it's an expensive operation that is implied by not explicit.

@@ -38,7 +43,16 @@ export class TxnBuilderGovernance extends P2WPKHTxnBuilder {
'CreateVoc address stack should be empty'
)
}
const creationFee = this.network.name === 'regtest' ? new BigNumber('5') : new BigNumber('50')
let creationFee = new BigNumber('5')
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it's the same for these because the fees are implied (edited by the method) but not explicitly defined. Users might not be signing what they initially thought they explicitly defined.

@fuxingloh
Copy link
Contributor

Merging first, if any follow-up, we can create an issue.

@fuxingloh fuxingloh merged commit 7ac010b into main Dec 2, 2022
@fuxingloh fuxingloh deleted the delphk/dftx-onchain-governance branch December 2, 2022 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
6 participants