<EtherspotApprovalTransaction />
Introduction
The <EtherspotApprovalTransaction />
component authorizes the spending of an asset, owned by yourself, by another Smart Contract. This Smart Contract can serve any purpose, but is usually associated with decentralised finance app (also known as DeFi) such as Uniswap or Gamma.
In other words, it's like giving your friend permission to spend some of your money, up to a certain limit. In this scenario, the friend is the Smart Contract mentioned above.
The <EtherspotApprovalTransaction />
component assumes that a transfer
function exists on the Smart Contract being called.
Component Properties
tokenAddress
The token's Smart Contract address that will be permitted to be moved to the recieverAddress.
receiverAddress
The destination blockchain address (on the same chain) permitted for the tokens located at tokenAddress
to be moved to.
value
The maximum value that the token address is allowed to move to the receiverAddress
.
How to use
Below is an example of how to use the <EtherspotApprovalTransaction />
component.
And that is how we give permission for another Smart Contract, which is associated with a blockchain app, to spend your tokens using the <EtherspotApprovalTransaction />
component up to a certain limit.
A note on setting the spend limit...
Sometimes it may seem convenient to set the spending limit to a very high amount, more than what is actually needed. This will result in you not having to call the approval tag again for that Smart Contract.
Whilst no-one is going to stop you doing this, please consider that the Smart Contract you're giving permission to spend your funds may be compromised in the future and could possibly drain all the funds in your account that it has permission to.
Last updated