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" ,
2021-01-20 23:42:39 +00:00
"user" : "3"
2020-09-14 10:52:05 +00:00
} ,
"expected" : "success"
} ,
{
"name" : "approve" ,
"args" : {
"reserve" : "WETH" ,
2021-01-20 23:42:39 +00:00
"user" : "3"
2020-09-14 10:52:05 +00:00
} ,
"expected" : "success"
} ,
{
"name" : "deposit" ,
"args" : {
"reserve" : "WETH" ,
"amount" : "1000" ,
2021-01-20 23:42:39 +00:00
"user" : "3"
} ,
"expected" : "success"
} ,
{
"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" ,
2020-09-14 10:52:05 +00:00
"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" ,
2020-11-04 10:12:26 +00:00
"revertMessage" : "59"
2020-09-14 10:52:05 +00:00
}
]
} ,
{
2020-09-14 12:41:44 +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" ,
2020-09-14 12:41:44 +00:00
"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" ,
2020-11-04 10:12:26 +00:00
"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"
}
]
}
]
}