vechain-sdk-js
vechain-sdk-js copied to clipboard
Util Function :: VTHO instead of Gas
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 please confirm this task is in regards to a human readable way of specifying gas
e.g., parseGas(0.21) -> 21000
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.
A formatGas method that allows the sdk user to convert gas values into VTHO.
Need to confirm with Tony if 10^5
@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]
@fabiorigam I think this task is outdated, what do you think?
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.