<p>No. Not exactly.</p>
<p>Since all the tokens on Cardano are native, they all have the same behavior; they just sit there. It's only through transactions that you can change the state of the chain.</p>
<p>I think you can get the desired behavior though!</p>
<p>Let's say when you submit your USDT for aUSDT you get a &quot;receipt&quot; UTxO. The receipt includes two pieces of data: deposit <strong>amount</strong> and deposit <strong>slot</strong>. Whenever you want to receive your interest, you could submit a transaction to the issuance script with your aUSDT and the receipt UTxO and the contract will calculate the interest based on time since deposit slot. Then the script can either re-issue you aUSDT with the interest and a new receipt <em>or</em> pay out your USDT with interest.</p>
<p>There might be better ways too, but that's an example how it could probably work.</p>

CC BY-SA 4.0
2021-05-25T17:17:57.497Z
2021-05-25T17:17:57.497Z
Mitchell Turner
<p>In Ethereum some ERC20 tokens use a calculation to compute the balance, is not just a value stored in a map.</p>
<p>Take for example AAVE. When you deposit 100 USDT in AAVE, you get 100 aUSDT, this aUSDT is an AToken that represents your share in the pool and is 1:1 convertible back to USDT. Initially your balance is 100, but (simplifying a lot) if interest rate is 5%, and you ask aUSDT.balanceOf(me) after a year, you get 105.</p>
<p>Just for reference, this is the AAVE's AToken code: <a href="https://github.com/aave/protocol-v2/blob/master/contracts/protocol/tokenization/AToken.sol#L208" rel="nofollow noreferrer">https://github.com/aave/protocol-v2/blob/master/contracts/protocol/tokenization/AToken.sol#L208</a></p>
<p>This would be possible with native tokens in Cardano? My understanding is no custom code is executed to get the balance (custom code is run in any other operation besides mint/burn?).</p>
<p>If not possible, what will be the best way to model something like this in Cardano.</p>

<plutus><native-assets><erc20>
How to implement continuous interest accruing with native tokens
# How to implement continuous interest accruing with native tokens

(Asked by: username_0 on 2021-05-25)

In Ethereum some ERC20 tokens use a calculation to compute the balance, is not just a value stored in a map.

Take for example AAVE. When you deposit 100 USDT in AAVE, you get 100 aUSDT, this aUSDT is an AToken that represents your share in the pool and is 1:1 convertible back to USDT. Initially your balance is 100, but (simplifying a lot) if interest rate is 5%, and you ask aUSDT.balanceOf(me) after a year, you get 105.

Just for reference, this is the AAVE's AToken code: <https://github.com/aave/protocol-v2/blob/master/contracts/protocol/tokenization/AToken.sol#L208>

This would be possible with native tokens in Cardano? My understanding is no custom code is executed to get the balance (custom code is run in any other operation besides mint/burn?).

If not possible, what will be the best way to model something like this in Cardano.

**Tags:** plutus, native-assets, erc20

---

## 1 answers

### Answer by username_1 on 2021-05-25. Score: 1

No. Not exactly.

Since all the tokens on Cardano are native, they all have the same behavior; they just sit there. It's only through transactions that you can change the state of the chain.

I think you can get the desired behavior though!

Let's say when you submit your USDT for aUSDT you get a "receipt" UTxO. The receipt includes two pieces of data: deposit **amount** and deposit **slot**. Whenever you want to receive your interest, you could submit a transaction to the issuance script with your aUSDT and the receipt UTxO and the contract will calculate the interest based on time since deposit slot. Then the script can either re-issue you aUSDT with the interest and a new receipt *or* pay out your USDT with interest.

There might be better ways too, but that's an example how it could probably work.


---

