aave-protocol-v2/test-suites/test-lp/helpers/scenarios/set-use-as-collateral.json

237 lines
5.7 KiB
JSON

{
"title": "LendingPool: Usage as collateral",
"description": "Test cases for the setUserUseReserveAsCollateral() function.",
"stories": [
{
"description": "User 0 Deposits 1000 UNIDAI, disables UNIDAI as collateral",
"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": "setUseAsCollateral",
"args": {
"reserve": "UNIDAI",
"user": "0",
"useAsCollateral": "false"
},
"expected": "success"
}
]
},
{
"description": "User 1 Deposits 2 UNIWETH, disables UNIWETH as collateral, borrows 400 UNIDAI (revert expected)",
"actions": [
{
"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": "setUseAsCollateral",
"args": {
"reserve": "UNIWETH",
"user": "1",
"useAsCollateral": "false"
},
"expected": "success"
},
{
"name": "borrow",
"args": {
"reserve": "UNIDAI",
"amount": "400",
"borrowRateMode": "variable",
"user": "1"
},
"expected": "revert",
"revertMessage": "The collateral balance is 0"
}
]
},
{
"description": "User 1 enables UNIWETH as collateral, borrows 400 UNIDAI",
"actions": [
{
"name": "setUseAsCollateral",
"args": {
"reserve": "UNIWETH",
"user": "1",
"useAsCollateral": "true"
},
"expected": "success"
},
{
"name": "borrow",
"args": {
"reserve": "UNIDAI",
"amount": "400",
"borrowRateMode": "variable",
"user": "1"
},
"expected": "success"
}
]
},
{
"description": "User 1 disables UNIWETH as collateral (revert expected)",
"actions": [
{
"name": "setUseAsCollateral",
"args": {
"reserve": "UNIWETH",
"user": "1",
"useAsCollateral": "false"
},
"expected": "revert",
"revertMessage": "User deposit is already being used as collateral"
}
]
},
{
"description": "User 1 Deposits 10 UNILINKWETH, disables UNIWETH as collateral. Should revert as 10 UNILINKWETH are not enough to cover the debt (revert expected)",
"actions": [
{
"name": "mint",
"args": {
"reserve": "UNILINKWETH",
"amount": "10",
"user": "1"
},
"expected": "success"
},
{
"name": "approve",
"args": {
"reserve": "UNILINKWETH",
"user": "1"
},
"expected": "success"
},
{
"name": "deposit",
"args": {
"reserve": "UNILINKWETH",
"amount": "10",
"user": "1"
},
"expected": "success"
},
{
"name": "setUseAsCollateral",
"args": {
"reserve": "UNIWETH",
"user": "1",
"useAsCollateral": "false"
},
"expected": "revert"
}
]
},
{
"description": "User 1 Deposits 640 more UNILINKWETH (enough to cover the UNIDAI debt), disables UNIWETH as collateral",
"actions": [
{
"name": "mint",
"args": {
"reserve": "UNILINKWETH",
"amount": "640",
"user": "1"
},
"expected": "success"
},
{
"name": "deposit",
"args": {
"reserve": "UNILINKWETH",
"amount": "640",
"user": "1"
},
"expected": "success"
},
{
"name": "setUseAsCollateral",
"args": {
"reserve": "UNIWETH",
"user": "1",
"useAsCollateral": "false"
},
"expected": "success"
}
]
},
{
"description": "User 1 disables UNILINKWETH as collateral (revert expected)",
"actions": [
{
"name": "setUseAsCollateral",
"args": {
"reserve": "UNILINKWETH",
"user": "1",
"useAsCollateral": "false"
},
"expected": "revert"
}
]
},
{
"description": "User 1 reenables UNIWETH as collateral",
"actions": [
{
"name": "setUseAsCollateral",
"args": {
"reserve": "UNIWETH",
"user": "1",
"useAsCollateral": "true"
},
"expected": "success"
}
]
}
]
}