mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
199 lines
5.1 KiB
JSON
199 lines
5.1 KiB
JSON
|
{
|
||
|
"title": "LendingPool: Rebalance stable rate",
|
||
|
"description": "Test cases for the rebalanceStableBorrowRate() function.",
|
||
|
"stories": [
|
||
|
{
|
||
|
"description": "User 0 tries to rebalance user 1 who has no borrows in progress (revert expected)",
|
||
|
"actions": [
|
||
|
{
|
||
|
"name": "rebalanceStableBorrowRate",
|
||
|
"args": {
|
||
|
"reserve": "UNIUSDC",
|
||
|
"user": "0",
|
||
|
"target": "1"
|
||
|
},
|
||
|
"expected": "revert",
|
||
|
"revertMessage": "User does not have any stable rate loan for this reserve"
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"description": "User 0 deposits 1000 UNIUSDC, user 1 deposits 7 UNIWETH, borrows 250 UNIUSDC at a stable rate, user 0 rebalances user 1 (revert expected)",
|
||
|
"actions": [
|
||
|
{
|
||
|
"name": "mint",
|
||
|
"args": {
|
||
|
"reserve": "UNIUSDC",
|
||
|
"amount": "1000",
|
||
|
"user": "0"
|
||
|
},
|
||
|
"expected": "success"
|
||
|
},
|
||
|
{
|
||
|
"name": "approve",
|
||
|
"args": {
|
||
|
"reserve": "UNIUSDC",
|
||
|
"user": "0"
|
||
|
},
|
||
|
"expected": "success"
|
||
|
},
|
||
|
{
|
||
|
"name": "deposit",
|
||
|
"args": {
|
||
|
"reserve": "UNIUSDC",
|
||
|
"amount": "1000",
|
||
|
"user": "0"
|
||
|
},
|
||
|
"expected": "success"
|
||
|
},
|
||
|
{
|
||
|
"name": "mint",
|
||
|
"args": {
|
||
|
"reserve": "UNIWETH",
|
||
|
"amount": "7",
|
||
|
"user": "1"
|
||
|
},
|
||
|
"expected": "success"
|
||
|
},
|
||
|
{
|
||
|
"name": "approve",
|
||
|
"args": {
|
||
|
"reserve": "UNIWETH",
|
||
|
"user": "1"
|
||
|
},
|
||
|
"expected": "success"
|
||
|
},
|
||
|
{
|
||
|
"name": "deposit",
|
||
|
"args": {
|
||
|
"reserve": "UNIWETH",
|
||
|
"amount": "7",
|
||
|
"user": "1"
|
||
|
},
|
||
|
"expected": "success"
|
||
|
},
|
||
|
{
|
||
|
"name": "borrow",
|
||
|
"args": {
|
||
|
"reserve": "UNIUSDC",
|
||
|
"amount": "250",
|
||
|
"borrowRateMode": "stable",
|
||
|
"user": "1"
|
||
|
},
|
||
|
"expected": "success"
|
||
|
},
|
||
|
{
|
||
|
"name": "rebalanceStableBorrowRate",
|
||
|
"args": {
|
||
|
"reserve": "UNIUSDC",
|
||
|
"user": "0",
|
||
|
"target": "1"
|
||
|
},
|
||
|
"expected": "revert",
|
||
|
"revertMessage": "The user borrow is variable and cannot be rebalanced"
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"description": "User 1 borrows another 200 at variable, user 0 tries to rebalance but the conditions are not met (revert expected)",
|
||
|
"actions": [
|
||
|
{
|
||
|
"name": "borrow",
|
||
|
"args": {
|
||
|
"reserve": "UNIUSDC",
|
||
|
"amount": "200",
|
||
|
"borrowRateMode": "variable",
|
||
|
"user": "1"
|
||
|
},
|
||
|
"expected": "success"
|
||
|
},
|
||
|
{
|
||
|
"name": "rebalanceStableBorrowRate",
|
||
|
"args": {
|
||
|
"reserve": "UNIUSDC",
|
||
|
"user": "0",
|
||
|
"target": "1"
|
||
|
},
|
||
|
"expected": "revert",
|
||
|
"revertMessage": "Interest rate rebalance conditions were not met"
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"description": "User 1 borrows another 200 at variable, user 0 tries to rebalance but the conditions are not met (revert expected)",
|
||
|
"actions": [
|
||
|
{
|
||
|
"name": "borrow",
|
||
|
"args": {
|
||
|
"reserve": "UNIUSDC",
|
||
|
"amount": "200",
|
||
|
"borrowRateMode": "variable",
|
||
|
"user": "1"
|
||
|
},
|
||
|
"expected": "success"
|
||
|
},
|
||
|
{
|
||
|
"name": "rebalanceStableBorrowRate",
|
||
|
"args": {
|
||
|
"reserve": "UNIUSDC",
|
||
|
"user": "0",
|
||
|
"target": "1"
|
||
|
},
|
||
|
"expected": "revert",
|
||
|
"revertMessage": "Interest rate rebalance conditions were not met"
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"description": "User 1 borrows another 100 at variable, user 0 tries to rebalance but the conditions are not met (revert expected)",
|
||
|
"actions": [
|
||
|
{
|
||
|
"name": "borrow",
|
||
|
"args": {
|
||
|
"reserve": "UNIUSDC",
|
||
|
"amount": "280",
|
||
|
"borrowRateMode": "variable",
|
||
|
"user": "1"
|
||
|
},
|
||
|
"expected": "success"
|
||
|
},
|
||
|
{
|
||
|
"name": "rebalanceStableBorrowRate",
|
||
|
"args": {
|
||
|
"reserve": "UNIUSDC",
|
||
|
"user": "0",
|
||
|
"target": "1"
|
||
|
},
|
||
|
"expected": "revert",
|
||
|
"revertMessage": "Interest rate rebalance conditions were not met"
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"description": "User 1 borrows the remaining UNIUSDC (usage ratio = 100%) at variable. User 0 rebalances user 1",
|
||
|
"actions": [
|
||
|
{
|
||
|
"name": "borrow",
|
||
|
"args": {
|
||
|
"reserve": "UNIUSDC",
|
||
|
"amount": "20",
|
||
|
"borrowRateMode": "variable",
|
||
|
"user": "1"
|
||
|
},
|
||
|
"expected": "success"
|
||
|
},
|
||
|
{
|
||
|
"name": "rebalanceStableBorrowRate",
|
||
|
"args": {
|
||
|
"reserve": "UNIUSDC",
|
||
|
"user": "0",
|
||
|
"target": "1"
|
||
|
},
|
||
|
"expected": "success"
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
]
|
||
|
}
|