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

fix net price for powerup and stake #211

Merged
merged 6 commits into from
Oct 2, 2024
Merged

fix net price for powerup and stake #211

merged 6 commits into from
Oct 2, 2024

Conversation

ttwishing
Copy link
Contributor

@ttwishing ttwishing commented Sep 13, 2024

  1. add net powerup price、rex price、staking price
    case1: powerup rent, 0.0001 EOS per kb
    ======Base
    Available:102981.54 kb
    Used:0.00 kb
    Maximum:102981.54 kb
    ====After Rent 1000KB for 0.1000 EOS
    Available: 103981.54 kb
    Used: 0.00 kb
    Maximum: 103981.54 kb

    case2: rex rent, 0.00004 EOS per kb
    ======Base
    Available: 103981.54 kb
    Used:0.00 kb
    Maximum:103981.54 kb
    ======After Rent 100KB for 0.0040 EOS
    Available:106955.54 kb
    Used:0.00 kb
    Maximum:106955.54 kb

    case3: staking rent, 0.0528 EOS per kb
    ======Base
    Available:106955.54 kb
    Used:0.00 kb
    Maximum:106955.54 kb
    ======After: rent 0.0528 EOS
    Available:106956.54 kb
    Used:0.00 kb
    Maximum:106956.54 kb

  2. calculate stakingprice in kb or ms, avoid the situation where the asset value is 0 in smaller units

Copy link

netlify bot commented Sep 13, 2024

Deploy Preview for unicove ready!

Name Link
🔨 Latest commit 300b843
🔍 Latest deploy log https://app.netlify.com/sites/unicove/deploys/66fcf268b0f1410008c7415a
😎 Deploy Preview https://deploy-preview-211--unicove.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 configuration.

Copy link

cloudflare-workers-and-pages bot commented Sep 13, 2024

Deploying unicove with  Cloudflare Pages  Cloudflare Pages

Latest commit: 300b843
Status: ✅  Deploy successful!
Preview URL: https://b27b78c0.wallet-2tl.pages.dev
Branch Preview URL: https://kurt-fix-netprice.wallet-2tl.pages.dev

View logs

[activeBlockchain, msToRent, sampleUsage],
([$activeBlockchain, $msToRent, $sampleUsage]) => {
if ($msToRent && $sampleUsage) {
const {account} = $sampleUsage
const { account } = $sampleUsage
const cpu_weight = Number(account.total_resources.cpu_weight.units)
const cpu_limit = Number(account.cpu_limit.max.value)
let price = cpu_weight / cpu_limit
if ($activeBlockchain.resourceSampleMilliseconds) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The resourceSampleMilliseconds of the telos chain is 1000, not sure if it has any impact

@ttwishing ttwishing marked this pull request as draft September 13, 2024 10:52
@ttwishing ttwishing marked this pull request as ready for review September 14, 2024 00:54
@ttwishing ttwishing marked this pull request as draft September 14, 2024 03:41
@ttwishing ttwishing force-pushed the kurt-fix-netprice branch 2 times, most recently from 70ac369 to 313258b Compare September 19, 2024 09:13
@ttwishing ttwishing marked this pull request as ready for review September 19, 2024 10:00

const getResourceClient = (chain: ChainConfig) => {
const api = getClient(chain)
const options: any = {api}
const options: any = { api }
Copy link
Contributor

Choose a reason for hiding this comment

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

I know that we don't want to spend too much time on this project, but we could probably use a proper type here instead of any.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ResourcesOptions it not exported. Otherwise, need to change greymass/eosio-resources,Can this be ignored?

Copy link
Contributor

@dafuga dafuga left a comment

Choose a reason for hiding this comment

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

Thanks for working on this, I left you a few comments.

@dafuga
Copy link
Contributor

dafuga commented Sep 21, 2024

It looks like CI checks are failing because of this error so we should also fix that:

/home/runner/work/unicove/unicove/src/pages/earn/step/bootstrap.svelte:10:5
Error: This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'. (ts)
    import InputLabel from '~/components/elements/input/label.svelte'
    import {REXInfo} from '../types'

@ttwishing ttwishing marked this pull request as draft October 2, 2024 06:41
@ttwishing ttwishing force-pushed the kurt-fix-netprice branch 2 times, most recently from ed1b51f to d47431f Compare October 2, 2024 07:03
@aaroncox aaroncox marked this pull request as ready for review October 2, 2024 16:30
@aaroncox aaroncox merged commit 489d688 into dev Oct 2, 2024
6 checks passed
aaroncox pushed a commit that referenced this pull request Oct 2, 2024
* fix net price for powerup and stake

* fix rex price for net rent

* fix eos symbol to core token symbol

* fix REXInfo import error

* format resources.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants