Path: blob/main/docs/versioned_docs/version-v0.26/02-guide/05-loan/08-play.md
1709 views
Play
Add 10000foocoin to Alice's account. These tokens will be used as a loan collateral.
Start a blockchain node:
Repaying a loan
Request a loan of 1000token with 100token as a fee and 1000foocoin as a collateral from Alice's account. The deadline is set to 500 blocks:
Please be aware that the addresses displayed in your terminal window (such as those in the borrower field) will not match the ones provided in this tutorial. This is because Ignite generates new accounts each time a chain is started, unless an account has a mnemonic specified in the config.yml file.
Approve the loan from Bob's account:
The lender field has been updated to Bob's address and the state field has been updated to approved:
The foocoin balance has been updated to 9000, because 1000foocoin has been transferred as collateral to the module account. The token balance has been updated to 21000, because 1000token has been transferred from Bob's account to Alice's account as a loan:
The token balance has been updated to 9000, because 1000token has been transferred from Bob's account to Alice's account as a loan:
Repay the loan from Alice's account:
The state field has been updated to repayed:
The foocoin balance has been updated to 10000, because 1000foocoin has been transferred from the module account to Alice's account. The token balance has been updated to 19900, because 1000token has been transferred from Alice's account to Bob's account as a repayment and 100token has been transferred from Alice's account to Bob's account as a fee:
The token balance has been updated to 10100, because 1000token has been transferred from Alice's account to Bob's account as a repayment and 100token has been transferred from Alice's account to Bob's account as a fee:
Liquidating a loan
Request a loan of 1000token with 100token as a fee and 1000foocoin as a collateral from Alice's account. The deadline is set to 20 blocks. The deadline is set to a very small value, so that the loan can be quickly liquidated in the next step:
A loan has been added to the list:
Approve the loan from Bob's account:
Liquidate the loan from Bob's account:
The loan has been liquidated:
The foocoin balance has been updated to 9000, because 1000foocoin has been transferred from Alice's account to the module account as a collateral. Alice has lost her collateral, but she has kept the loan amount:
The foocoin balance has been updated to 1000, because 1000foocoin has been transferred from the module account to Bob's account as a collateral. Bob has gained the collateral, but he has lost the loan amount: