vechain-sdk-js icon indicating copy to clipboard operation
vechain-sdk-js copied to clipboard

Util Function :: VTHO instead of Gas

Open nwbrettski opened this issue 1 year ago • 6 comments

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:

  • parseGas(amountVTHO: string | number) -> .e.g, parseGas(0.21) = 21000
  • formatGas(rawGas: number | string) -> e.g, formatGas(21000) = 0.21

Acceptance Criteria:

nwbrettski avatar Nov 17 '23 15:11 nwbrettski

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

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

pierobassa avatar Nov 30 '23 09:11 pierobassa

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 avatar Nov 30 '23 09:11 nwbrettski

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

Need to confirm with Tony if 10^5

nwbrettski avatar Nov 30 '23 14:11 nwbrettski

@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]

nwbrettski avatar Nov 30 '23 16:11 nwbrettski

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

victhorbi avatar Jul 10 '24 17:07 victhorbi

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.

lucanicoladebiasi avatar Aug 07 '24 14:08 lucanicoladebiasi