aave-protocol-v2/test/helpers/scenarios/credit-delegation.json

132 lines
3.3 KiB
JSON
Raw Normal View History

2020-09-14 10:52:05 +00:00
{
"title": "LendingPool: credit delegation",
"description": "Test cases for the credit delegation related functions.",
"stories": [
{
"description": "User 0 deposits 1000 DAI, user 0 delegates borrowing of 1 WETH on variable to user 4, user 4 borrows 1 WETH variable on behalf of user 0",
"actions": [
{
"name": "mint",
"args": {
"reserve": "WETH",
"amount": "1000",
"user": "0"
},
"expected": "success"
},
{
"name": "approve",
"args": {
"reserve": "WETH",
"user": "0"
},
"expected": "success"
},
{
"name": "deposit",
"args": {
"reserve": "WETH",
"amount": "1000",
"user": "0"
},
"expected": "success"
},
{
"name": "delegateBorrowAllowance",
"args": {
"reserve": "WETH",
"amount": "2",
"user": "0",
"borrowRateMode": "variable",
"toUser": "4"
},
"expected": "success"
},
{
"name": "borrow",
"args": {
"reserve": "WETH",
"amount": "1",
"user": "4",
"onBehalfOf": "0",
"borrowRateMode": "variable"
},
"expected": "success"
}
]
},
{
"description": "User 4 trying to borrow 1 WETH stable on behalf of user 0, revert expected",
"actions": [
{
"name": "borrow",
"args": {
"reserve": "WETH",
"amount": "1",
"user": "4",
"onBehalfOf": "0",
"borrowRateMode": "stable"
},
"expected": "revert",
"revertMessage": "59"
2020-09-14 10:52:05 +00:00
}
]
},
{
"description": "User 0 delegates borrowing of 1 WETH to user 4, user 4 borrows 3 WETH variable on behalf of user 0, revert expected",
2020-09-14 10:52:05 +00:00
"actions": [
{
"name": "delegateBorrowAllowance",
"args": {
"reserve": "WETH",
"amount": "1",
"user": "0",
"borrowRateMode": "variable",
2020-09-14 10:52:05 +00:00
"toUser": "4"
},
"expected": "success"
},
{
"name": "borrow",
"args": {
"reserve": "WETH",
"amount": "3",
"user": "4",
"onBehalfOf": "0",
"borrowRateMode": "variable"
},
"expected": "revert",
"revertMessage": "59"
2020-09-14 10:52:05 +00:00
}
]
},
{
"description": "User 0 delegates borrowing of 1 WETH on stable to user 2, user 2 borrows 1 WETH stable on behalf of user 0",
"actions": [
{
"name": "delegateBorrowAllowance",
"args": {
"reserve": "WETH",
"amount": "1",
"user": "0",
"borrowRateMode": "stable",
"toUser": "2"
},
"expected": "success"
},
{
"name": "borrow",
"args": {
"reserve": "WETH",
"amount": "1",
"user": "2",
"onBehalfOf": "0",
"borrowRateMode": "stable"
},
"expected": "success"
}
]
}
]
}