aave-protocol-v2/test-suites/test-lp/helpers/scenarios/swap-rate-mode.json

168 lines
4.2 KiB
JSON
Raw Normal View History

{
"title": "LendingPool: Swap rate mode",
"description": "Test cases for the swapBorrowRateMode() function.",
"stories": [
{
"description": "User 0 tries to swap rate mode without any variable rate loan in progress (revert expected)",
"actions": [
{
"name": "swapBorrowRateMode",
"args": {
"reserve": "UNIDAI",
"user": "1",
"borrowRateMode": "variable"
},
"expected": "revert",
"revertMessage": "User does not have a variable rate loan in progress on this reserve"
}
]
},
{
"description": "User 0 tries to swap rate mode without any stable rate loan in progress (revert expected)",
"actions": [
{
"name": "swapBorrowRateMode",
"args": {
"reserve": "UNIDAI",
"user": "1",
"borrowRateMode": "stable"
},
"expected": "revert",
"revertMessage": "User does not have a stable rate loan in progress on this reserve"
}
]
},
{
"description": "User 0 deposits 1000 UNIDAI, user 1 deposits 2 WETH as collateral, borrows 100 UNIDAI at variable rate and swaps to stable after one year",
"actions": [
{
"name": "mint",
"args": {
"reserve": "UNIDAI",
"amount": "1000",
"user": "0"
},
"expected": "success"
},
{
"name": "approve",
"args": {
"reserve": "UNIDAI",
"user": "0"
},
"expected": "success"
},
{
"name": "deposit",
"args": {
"reserve": "UNIDAI",
"amount": "1000",
"user": "0"
},
"expected": "success"
},
{
"name": "mint",
"args": {
"reserve": "UNIWETH",
"amount": "2",
"user": "1"
},
"expected": "success"
},
{
"name": "approve",
"args": {
"reserve": "UNIWETH",
"user": "1"
},
"expected": "success"
},
{
"name": "deposit",
"args": {
"reserve": "UNIWETH",
"amount": "2",
"user": "1"
},
"expected": "success"
},
{
"name": "borrow",
"args": {
"reserve": "UNIDAI",
"amount": "100",
"borrowRateMode": "variable",
"user": "1",
"timeTravel": "365"
},
"expected": "success"
},
{
"name": "swapBorrowRateMode",
"args": {
"reserve": "UNIDAI",
"user": "1",
"borrowRateMode": "variable"
},
"expected": "success"
}
]
},
{
"description": "User 1 borrows another 100 UNIDAI, and swaps back to variable after one year, repays the loan",
"actions": [
{
"name": "borrow",
"args": {
"reserve": "UNIDAI",
"amount": "100",
"borrowRateMode": "stable",
"user": "1",
"timeTravel": "365"
},
"expected": "success"
},
{
"name": "swapBorrowRateMode",
"args": {
"reserve": "UNIDAI",
"user": "1",
"borrowRateMode": "stable"
},
"expected": "success"
},
{
"name": "mint",
"description": "Mint 50 UNIDAI to cover the interest",
"args": {
"reserve": "UNIDAI",
"amount": "50",
"user": "1"
},
"expected": "success"
},
{
"name": "approve",
"args": {
"reserve": "UNIDAI",
"user": "1"
},
"expected": "success"
},
{
"name": "repay",
"args": {
"reserve": "UNIDAI",
"amount": "-1",
"user": "1",
"onBehalfOf": "1",
"borrowRateMode": "variable"
},
"expected": "success"
}
]
}
]
}