Ardor Lightweight Contracts Use Case
We can now solve the ARDR paradox using a simple contract
See all lightweight contracts articles
One of the most annoying problems for new users of Ardor is that you cannot buy the ARDR parent chain token unless you already own ARDR tokens to pay the transaction fee.
Until now, the only solution to this limitation explained in detail in this helpdesk article, was a manual exchange performed by our support team. But this approach, is of course, not a long-term solution.
The new ChildToParentExchange contract, provides a better solution, the contract listens for IGNIS deposits on a specific address, and when it identifies a deposit, it waits for 6 confirmations, calculates the ARDR per IGNIS exchange rate based on the existing buy orders on the decentralized coin exchange, and sends back the converted amount in ARDR to the sender’s account. This contract can be easily enhanced to support deposits in any other Child Chain coin.
The contract source code
Note: a transaction fee of one ARDR is reduced from the returned amount.
This is a good example of how Ardor Lightweight Contracts are simple to implement, and can solve real-world problems.