2020-06-08 12:03:40 +00:00
|
|
|
{
|
|
|
|
"title": "LendingPool: Usage as collateral",
|
|
|
|
"description": "Test cases for the setUserUseReserveAsCollateral() function.",
|
|
|
|
"stories": [
|
|
|
|
{
|
|
|
|
"description": "User 0 Deposits 1000 DAI, disables DAI as collateral",
|
|
|
|
"actions": [
|
|
|
|
{
|
|
|
|
"name": "mint",
|
|
|
|
"args": {
|
|
|
|
"reserve": "DAI",
|
|
|
|
"amount": "1000",
|
|
|
|
"user": "0"
|
|
|
|
},
|
|
|
|
"expected": "success"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "approve",
|
|
|
|
"args": {
|
|
|
|
"reserve": "DAI",
|
|
|
|
"user": "0"
|
|
|
|
},
|
|
|
|
"expected": "success"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "deposit",
|
|
|
|
"args": {
|
|
|
|
"reserve": "DAI",
|
|
|
|
"amount": "1000",
|
|
|
|
"user": "0"
|
|
|
|
},
|
|
|
|
"expected": "success"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "setUseAsCollateral",
|
|
|
|
"args": {
|
|
|
|
"reserve": "DAI",
|
|
|
|
"user": "0",
|
|
|
|
"useAsCollateral": "false"
|
|
|
|
},
|
|
|
|
"expected": "success"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2020-09-25 09:51:35 +00:00
|
|
|
"description": "User 1 Deposits 2 WETH, disables WETH as collateral, borrows 400 DAI (revert expected)",
|
2020-06-08 12:03:40 +00:00
|
|
|
"actions": [
|
2020-08-17 09:59:38 +00:00
|
|
|
{
|
|
|
|
"name": "mint",
|
|
|
|
"args": {
|
|
|
|
"reserve": "WETH",
|
|
|
|
"amount": "2",
|
|
|
|
"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",
|
|
|
|
|
2020-06-08 12:03:40 +00:00
|
|
|
"amount": "2",
|
2020-08-17 09:59:38 +00:00
|
|
|
"user": "1"
|
2020-06-08 12:03:40 +00:00
|
|
|
},
|
|
|
|
"expected": "success"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "setUseAsCollateral",
|
|
|
|
"args": {
|
2020-08-13 11:06:23 +00:00
|
|
|
"reserve": "WETH",
|
|
|
|
|
2020-06-08 12:03:40 +00:00
|
|
|
"user": "1",
|
|
|
|
"useAsCollateral": "false"
|
|
|
|
},
|
|
|
|
"expected": "success"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "borrow",
|
|
|
|
"args": {
|
|
|
|
"reserve": "DAI",
|
|
|
|
"amount": "400",
|
|
|
|
"borrowRateMode": "variable",
|
|
|
|
"user": "1"
|
|
|
|
},
|
|
|
|
"expected": "revert",
|
|
|
|
"revertMessage": "The collateral balance is 0"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2020-09-25 09:51:35 +00:00
|
|
|
"description": "User 1 enables WETH as collateral, borrows 400 DAI",
|
2020-06-08 12:03:40 +00:00
|
|
|
"actions": [
|
|
|
|
{
|
|
|
|
"name": "setUseAsCollateral",
|
|
|
|
"args": {
|
2020-08-13 11:06:23 +00:00
|
|
|
"reserve": "WETH",
|
2020-06-08 12:03:40 +00:00
|
|
|
"user": "1",
|
|
|
|
"useAsCollateral": "true"
|
|
|
|
},
|
|
|
|
"expected": "success"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "borrow",
|
|
|
|
"args": {
|
|
|
|
"reserve": "DAI",
|
|
|
|
"amount": "400",
|
|
|
|
"borrowRateMode": "variable",
|
|
|
|
"user": "1"
|
|
|
|
},
|
|
|
|
"expected": "success"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2020-09-25 09:51:35 +00:00
|
|
|
"description": "User 1 disables WETH as collateral (revert expected)",
|
2020-06-08 12:03:40 +00:00
|
|
|
"actions": [
|
|
|
|
{
|
|
|
|
"name": "setUseAsCollateral",
|
|
|
|
"args": {
|
2020-08-13 11:06:23 +00:00
|
|
|
"reserve": "WETH",
|
|
|
|
|
2020-06-08 12:03:40 +00:00
|
|
|
"user": "1",
|
|
|
|
"useAsCollateral": "false"
|
|
|
|
},
|
|
|
|
"expected": "revert",
|
2020-07-13 08:54:08 +00:00
|
|
|
"revertMessage": "User deposit is already being used as collateral"
|
2020-06-08 12:03:40 +00:00
|
|
|
}
|
|
|
|
]
|
2020-09-25 09:51:35 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"description": "User 1 Deposits 1000 LEND, disables WETH as collateral. Should revert as 1000 LEND are not enough to cover the debt (revert expected)",
|
|
|
|
"actions": [
|
|
|
|
{
|
|
|
|
"name": "mint",
|
|
|
|
"args": {
|
|
|
|
"reserve": "LEND",
|
|
|
|
"amount": "1000",
|
|
|
|
"user": "1"
|
|
|
|
},
|
|
|
|
"expected": "success"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "approve",
|
|
|
|
"args": {
|
|
|
|
"reserve": "LEND",
|
|
|
|
"user": "1"
|
|
|
|
},
|
|
|
|
"expected": "success"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "deposit",
|
|
|
|
"args": {
|
|
|
|
"reserve": "LEND",
|
|
|
|
|
|
|
|
"amount": "1000",
|
|
|
|
"user": "1"
|
|
|
|
},
|
|
|
|
"expected": "success"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "setUseAsCollateral",
|
|
|
|
"args": {
|
|
|
|
"reserve": "WETH",
|
|
|
|
|
|
|
|
"user": "1",
|
|
|
|
"useAsCollateral": "false"
|
|
|
|
},
|
|
|
|
"expected": "revert"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"description": "User 1 Deposits 64000 more LEND (enough to cover the DAI debt), disables WETH as collateral",
|
|
|
|
"actions": [
|
|
|
|
{
|
|
|
|
"name": "mint",
|
|
|
|
"args": {
|
|
|
|
"reserve": "LEND",
|
|
|
|
"amount": "64000",
|
|
|
|
"user": "1"
|
|
|
|
},
|
|
|
|
"expected": "success"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "deposit",
|
|
|
|
"args": {
|
|
|
|
"reserve": "LEND",
|
|
|
|
|
|
|
|
"amount": "64000",
|
|
|
|
"user": "1"
|
|
|
|
},
|
|
|
|
"expected": "success"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "setUseAsCollateral",
|
|
|
|
"args": {
|
|
|
|
"reserve": "WETH",
|
|
|
|
|
|
|
|
"user": "1",
|
|
|
|
"useAsCollateral": "false"
|
|
|
|
},
|
|
|
|
"expected": "success"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"description": "User 1 disables LEND as collateral (revert expected)",
|
|
|
|
"actions": [
|
|
|
|
{
|
|
|
|
"name": "setUseAsCollateral",
|
|
|
|
"args": {
|
|
|
|
"reserve": "LEND",
|
|
|
|
|
|
|
|
"user": "1",
|
|
|
|
"useAsCollateral": "false"
|
|
|
|
},
|
|
|
|
"expected": "User deposit is already being used as collateral"
|
|
|
|
}
|
|
|
|
]
|
2020-06-08 12:03:40 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|