vechain / vechain-sdk-js

The official JavaScript SDK for VeChain.
23 stars 9 forks source link

Util Function :: VTHO instead of Gas #264

Closed nwbrettski closed 1 week ago

nwbrettski commented 9 months ago

As a developer I want to be able to provide my dApp users with transaction costs in terms of VTHO instead of gas so that my dApp users can easily quantify their transaction costs.

Tasks:

Acceptance Criteria:

pierobassa commented 9 months ago

@nwbrettski please confirm this task is in regards to a human readable way of specifying gas

e.g., parseGas(0.21) -> 21000

nwbrettski commented 9 months ago

I think it is even further than that 21000 / 100000 = 0.21 VTHO

Can discuss it on the session later today. I think @claytonneal was the initial proposer.

nwbrettski commented 9 months ago

A formatGas method that allows the sdk user to convert gas values into VTHO.

Need to confirm with Tony if 10^5

nwbrettski commented 9 months ago

@pierobassa

1 x 10^13 wei equals 0.00001(1x10^-5) VTHO per Gas this is a message that Tony sent me.

Also see the Econ calculation at the end of this page, https://docs.vechain.org/introduction-to-vechain/dual-token-economic-model/vethor-vtho). [FYI making a pull request for this page as the wording is very confusing]

victhorbi commented 2 months ago

@fabiorigam I think this task is outdated, what do you think?

lucanicoladebiasi commented 1 month ago

Dealing with units and quantities should be addressed my the VeChain Data Model we are developing in the SDK team, hence I propose to address this ticket as we are developing the data model ontology. Having defined a Quantity class, the classes VTHO and Gas should extends Quantity and cope with conversions/casts.