stablecoin-studio icon indicating copy to clipboard operation
stablecoin-studio copied to clipboard

[BLOCKED][Smart Contract] Integrate the exchange rate precompiled Hedera contract

Open AlbertoMolinaIoBuilders opened this issue 3 years ago • 2 comments

Context

When we create a token, we must send a certain amount of HBARs to the precompiled contract. Currently that amount is hardcoded in the SDK and the SC smart contract simply forwards it to the precompiled contract

Description

When the HBAR to USD exchange rate changes a lot, the hardcoded amount becomes all of the sudden not enough, we need to change it and recompile the code. The problem is that the error message we receive only states "Contract_Revert", which is not enough to easily identify the source of the problem.

It would be great to integrate the exchange rate precompiled Hedera contract at address 0x168, so that the token creation Hedera fees (1 dollard : https://docs.hedera.com/hedera/networks/mainnet/fees) are calculated dynamically by the smart contract. By doing that, we will be able to return an error message easier to understand when the provided amount is not enough to perform the token creation operation.

AlbertoMolinaIoBuilders avatar Mar 08 '23 07:03 AlbertoMolinaIoBuilders

https://hips.hedera.com/hip/hip-358

Precompile Gas Costs

demo : https://github.com/hashgraph/hedera-smart-contracts/blob/main/contracts/hts-precompile/examples/token-create/TokenCreateContract.sol

question : https://github.com/hashgraph/hedera-smart-contracts/discussions/184

AlbertoMolinaIoBuilders avatar Mar 09 '23 15:03 AlbertoMolinaIoBuilders

We cannot have a precompiled contract outside a smart contract

darius279 avatar Mar 14 '23 09:03 darius279

Removed due to backlog restructuring

themariofrancia avatar May 29 '25 09:05 themariofrancia