2020-06-08 12:03:40 +00:00
|
|
|
{
|
|
|
|
"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": {
|
2021-01-20 23:42:39 +00:00
|
|
|
"reserve": "USDC",
|
2020-06-08 12:03:40 +00:00
|
|
|
"user": "0",
|
2020-07-07 10:07:31 +00:00
|
|
|
"target": "1",
|
|
|
|
"borrowRateMode": "variable"
|
2020-06-08 12:03:40 +00:00
|
|
|
},
|
|
|
|
"expected": "revert",
|
2020-07-07 10:07:31 +00:00
|
|
|
"revertMessage": "User does not have any stable rate loan for this reserve"
|
2020-06-08 12:03:40 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2021-01-20 23:42:39 +00:00
|
|
|
"description": "User 0 deposits 1000 USDC, user 1 deposits 5 ETH, borrows 600 DAI at a variable rate, user 0 rebalances user 1 (revert expected)",
|
2020-06-08 12:03:40 +00:00
|
|
|
"actions": [
|
|
|
|
{
|
|
|
|
"name": "mint",
|
|
|
|
"args": {
|
2021-01-20 23:42:39 +00:00
|
|
|
"reserve": "USDC",
|
2020-06-08 12:03:40 +00:00
|
|
|
"amount": "1000",
|
|
|
|
"user": "0"
|
|
|
|
},
|
|
|
|
"expected": "success"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "approve",
|
|
|
|
"args": {
|
2021-01-20 23:42:39 +00:00
|
|
|
"reserve": "USDC",
|
2020-06-08 12:03:40 +00:00
|
|
|
"user": "0"
|
|
|
|
},
|
|
|
|
"expected": "success"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "deposit",
|
|
|
|
"args": {
|
2021-01-20 23:42:39 +00:00
|
|
|
"reserve": "USDC",
|
2020-06-08 12:03:40 +00:00
|
|
|
"amount": "1000",
|
|
|
|
"user": "0"
|
|
|
|
},
|
|
|
|
"expected": "success"
|
|
|
|
},
|
2020-08-17 11:48:23 +00:00
|
|
|
{
|
|
|
|
"name": "mint",
|
|
|
|
"args": {
|
|
|
|
"reserve": "WETH",
|
2021-01-20 23:42:39 +00:00
|
|
|
"amount": "7",
|
2020-08-17 11:48:23 +00:00
|
|
|
"user": "1"
|
|
|
|
},
|
|
|
|
"expected": "success"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "approve",
|
|
|
|
"args": {
|
|
|
|
"reserve": "WETH",
|
|
|
|
"user": "1"
|
|
|
|
},
|
|
|
|
"expected": "success"
|
|
|
|
},
|
2020-06-08 12:03:40 +00:00
|
|
|
{
|
|
|
|
"name": "deposit",
|
|
|
|
"args": {
|
2020-08-13 11:06:23 +00:00
|
|
|
"reserve": "WETH",
|
|
|
|
|
2021-01-20 23:42:39 +00:00
|
|
|
"amount": "7",
|
2020-08-17 11:48:23 +00:00
|
|
|
"user": "1"
|
2020-06-08 12:03:40 +00:00
|
|
|
},
|
|
|
|
"expected": "success"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "borrow",
|
|
|
|
"args": {
|
2021-01-20 23:42:39 +00:00
|
|
|
"reserve": "USDC",
|
2020-09-21 20:08:44 +00:00
|
|
|
"amount": "250",
|
|
|
|
"borrowRateMode": "stable",
|
2021-01-20 23:42:39 +00:00
|
|
|
"user": "1"
|
2020-06-08 12:03:40 +00:00
|
|
|
},
|
|
|
|
"expected": "success"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "rebalanceStableBorrowRate",
|
|
|
|
"args": {
|
2021-01-20 23:42:39 +00:00
|
|
|
"reserve": "USDC",
|
2020-06-08 12:03:40 +00:00
|
|
|
"user": "0",
|
|
|
|
"target": "1"
|
|
|
|
},
|
|
|
|
"expected": "revert",
|
|
|
|
"revertMessage": "The user borrow is variable and cannot be rebalanced"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2020-09-21 20:08:44 +00:00
|
|
|
"description": "User 1 borrows another 200 at stable, user 0 tries to rebalance but the conditions are not met (revert expected)",
|
2020-06-08 12:03:40 +00:00
|
|
|
"actions": [
|
|
|
|
{
|
2020-09-21 20:08:44 +00:00
|
|
|
"name": "borrow",
|
2020-06-08 12:03:40 +00:00
|
|
|
"args": {
|
2021-01-20 23:42:39 +00:00
|
|
|
"reserve": "USDC",
|
2020-09-21 20:08:44 +00:00
|
|
|
"amount": "200",
|
2021-01-20 23:42:39 +00:00
|
|
|
"borrowRateMode": "variable",
|
|
|
|
"user": "1"
|
2020-09-21 20:08:44 +00:00
|
|
|
},
|
|
|
|
"expected": "success"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "rebalanceStableBorrowRate",
|
|
|
|
"args": {
|
2021-01-20 23:42:39 +00:00
|
|
|
"reserve": "USDC",
|
2020-09-21 20:08:44 +00:00
|
|
|
"user": "0",
|
|
|
|
"target": "1"
|
|
|
|
},
|
|
|
|
"expected": "revert",
|
|
|
|
"revertMessage": "Interest rate rebalance conditions were not met"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"description": "User 1 borrows another 200 at stable, user 0 tries to rebalance but the conditions are not met (revert expected)",
|
|
|
|
"actions": [
|
|
|
|
{
|
|
|
|
"name": "borrow",
|
|
|
|
"args": {
|
2021-01-20 23:42:39 +00:00
|
|
|
"reserve": "USDC",
|
2020-09-21 20:08:44 +00:00
|
|
|
"amount": "200",
|
2021-01-20 23:42:39 +00:00
|
|
|
"borrowRateMode": "variable",
|
|
|
|
"user": "1"
|
2020-09-21 20:08:44 +00:00
|
|
|
},
|
|
|
|
"expected": "success"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "rebalanceStableBorrowRate",
|
|
|
|
"args": {
|
2021-01-20 23:42:39 +00:00
|
|
|
"reserve": "USDC",
|
2020-09-21 20:08:44 +00:00
|
|
|
"user": "0",
|
|
|
|
"target": "1"
|
|
|
|
},
|
|
|
|
"expected": "revert",
|
|
|
|
"revertMessage": "Interest rate rebalance conditions were not met"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"description": "User 1 borrows another 100 at stable, user 0 tries to rebalance but the conditions are not met (revert expected)",
|
|
|
|
"actions": [
|
|
|
|
{
|
|
|
|
"name": "borrow",
|
|
|
|
"args": {
|
2021-01-20 23:42:39 +00:00
|
|
|
"reserve": "USDC",
|
|
|
|
"amount": "280",
|
2020-06-08 12:03:40 +00:00
|
|
|
"borrowRateMode": "variable",
|
2021-01-20 23:42:39 +00:00
|
|
|
"user": "1"
|
2020-06-08 12:03:40 +00:00
|
|
|
},
|
|
|
|
"expected": "success"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "rebalanceStableBorrowRate",
|
|
|
|
"args": {
|
2021-01-20 23:42:39 +00:00
|
|
|
"reserve": "USDC",
|
2020-06-08 12:03:40 +00:00
|
|
|
"user": "0",
|
|
|
|
"target": "1"
|
|
|
|
},
|
|
|
|
"expected": "revert",
|
|
|
|
"revertMessage": "Interest rate rebalance conditions were not met"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2021-01-20 23:42:39 +00:00
|
|
|
|
2020-06-08 12:03:40 +00:00
|
|
|
{
|
2021-01-20 23:42:39 +00:00
|
|
|
"description": "User 0 borrows the remaining USDC (usage ratio = 100%). User 0 rebalances user 1",
|
2020-06-08 12:03:40 +00:00
|
|
|
"actions": [
|
|
|
|
{
|
|
|
|
"name": "borrow",
|
|
|
|
"args": {
|
2021-01-20 23:42:39 +00:00
|
|
|
"reserve": "USDC",
|
|
|
|
"amount": "20",
|
2020-06-08 12:03:40 +00:00
|
|
|
"borrowRateMode": "variable",
|
2021-01-20 23:42:39 +00:00
|
|
|
"user": "1"
|
2020-06-08 12:03:40 +00:00
|
|
|
},
|
|
|
|
"expected": "success"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "rebalanceStableBorrowRate",
|
|
|
|
"args": {
|
2021-01-20 23:42:39 +00:00
|
|
|
"reserve": "USDC",
|
2020-06-08 12:03:40 +00:00
|
|
|
"user": "0",
|
|
|
|
"target": "1"
|
|
|
|
},
|
|
|
|
"expected": "success"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|