What is Token Allowance?

¿Que es token allowance?
5 min read

If you are wondering what the Allowance Token is, we could summarize it as an interesting feature of the Ethereum ERC-20 and ERC-777 tokens, through which we can grant specific permissions to access and use funds to DApps and DEX, so they can operate autonomously and safely.

This is a fairly common feature in the token field, and its purpose is to allow smart contracts to automatically interact with money placed in a specific direction.
Permissions or access rights allow third parties to be entitled to perform a certain number of token transactions associated with our address. It is worth noting that none of these need to deliver the private key of our address.
But why do we give access to our money to an intelligent contract instead of controlling it by our own means? Well, here we will clarify the usefulness of this function and, most importantly, how this function can greatly facilitate our interaction with intelligent contracts.

Why were the allowance functions created?

If you know what a token is, you probably know that within the Ethereum network you can create tokens of different types and with different utilities. Because of this, the developers preferred to create a set of rules or specifications to set a standard in token creation: the ERC-20 standard token.
Among those specifications is the Allowance function, which as mentioned above, allows any user who has a token to grant permissions to DEX, Dapps or DeFi to use the tokens that are located in a certain address.
Thus, we can authorize any of these to handle our funds with our prior consent. For example, a Dapps can send our tokens without having to be on hold all the time for us to do so.
This feature is usually given to smart contracts as they are governed by predetermined rules and allow us to go to sleep at night knowing that no one will be able to cheat us or steal our funds.
On the other hand, the allowance function allows us to define the fair and necessary amount we want to use for the smart contract. Without a doubt, this is another security measure that allows us to control the way in which intelligent contracts perform their different operations when interacting with intelligent contracts. 
Most importantly, it allows us to do this in a decentralized manner without the need for a trusted third party to intervene in the process.
¿Que es token allowance?

ERC-20 tokens and the arrival of Token Allowance

It can be said that the arrival of the allowance in the world of cryptomonies is with the arrival of the ERC-20 of Ethereum. The standard has a series of predetermined functions in its structure that facilitate the work of developers to create intelligent contracts and Dapps, thus allowing decentralized interactions between users and the Ethereum network and its associated tokens.

To achieve this objective, the ERC-20 has a specific function called “allowance”, which is generally defined as follows:

function allowance(address tokenOwner, address spender)

The function basically requires a series of usage permissions. These permissions allow the smart contract to be transferred from our address to the address defined by the smart contract with a certain amount of tokens (called distribution). This transfer is limited to the amount specified and accepted by the Dapp user. In fact, this is a security measure, which can control the possible expenses of the smart contract in each interaction and during the whole process.

Example of Token Allowance

Let’s pretend that a user wants to use the Aave Smart Contract to make an investment. This interaction is handled by the Aave smart contracts who will ask the investor for an “allowance” so that he can use tokens in his possession.
When the user decides to accept this allowance, Aave will get the tokens and make the corresponding investment. This process will always require the express permission of the user. In the event that a Dapp requests unsolicited access to a balance, use caution because it could be malicious access.