2021-02-07 03:10:29 +00:00
{
"title" : "LendingPool: Borrow/repay (stable rate)" ,
"description" : "Test cases for the borrow function, stable mode." ,
"stories" : [
{
2021-02-19 20:50:13 +00:00
"description" : "User 0 deposits 1000 DAI, user 1 deposits 1 WETH as collateral and tries to borrow 100 DAI at stable rate (revert expected)" ,
2021-02-07 03:10:29 +00:00
"actions" : [
{
"name" : "mint" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "1000" ,
"user" : "0"
} ,
"expected" : "success"
} ,
{
"name" : "approve" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"user" : "0"
} ,
"expected" : "success"
} ,
{
"name" : "deposit" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "1000" ,
"user" : "0"
} ,
"expected" : "success"
} ,
{
"name" : "mint" ,
"args" : {
2021-02-08 16:05:10 +00:00
"reserve" : "WETH" ,
2021-02-07 03:10:29 +00:00
"amount" : "1" ,
"user" : "1"
} ,
"expected" : "success"
} ,
{
"name" : "approve" ,
"args" : {
2021-02-08 16:05:10 +00:00
"reserve" : "WETH" ,
2021-02-07 03:10:29 +00:00
"user" : "1"
} ,
"expected" : "success"
} ,
{
"name" : "deposit" ,
"args" : {
2021-02-08 16:05:10 +00:00
"reserve" : "WETH" ,
2021-02-07 03:10:29 +00:00
"amount" : "1" ,
"user" : "1"
} ,
"expected" : "success"
} ,
{
"name" : "borrow" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "100" ,
"borrowRateMode" : "stable" ,
"user" : "1" ,
"timeTravel" : "365"
} ,
2021-02-09 23:14:38 +00:00
"expected" : "revert"
2021-02-07 03:10:29 +00:00
}
]
} ,
{
2021-02-19 20:50:13 +00:00
"description" : "User 1 tries to borrow the rest of the DAI liquidity (revert expected)" ,
2021-02-07 03:10:29 +00:00
"actions" : [
{
"name" : "borrow" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "900" ,
"borrowRateMode" : "stable" ,
"user" : "1"
} ,
"expected" : "revert" ,
2021-02-09 23:14:38 +00:00
"revertMessage" : "12"
}
]
} ,
{
2021-02-19 20:50:13 +00:00
"description" : "User 1 tries to borrow 100 DAI at variable" ,
2021-02-09 23:14:38 +00:00
"actions" : [
{
"name" : "borrow" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-09 23:14:38 +00:00
"amount" : "100" ,
"borrowRateMode" : "variable" ,
"user" : "1"
} ,
"expected" : "success"
}
]
} ,
{
2021-02-19 20:50:13 +00:00
"description" : "User 1 tries to borrow the rest of the DAI liquidity at stable (revert expected)" ,
2021-02-09 23:14:38 +00:00
"actions" : [
{
"name" : "borrow" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-09 23:14:38 +00:00
"amount" : "900" ,
"borrowRateMode" : "stable" ,
"user" : "1"
} ,
"expected" : "revert" ,
"revertMessage" : "12"
2021-02-07 03:10:29 +00:00
}
]
} ,
{
2021-02-19 20:50:13 +00:00
"description" : "User 1 repays half of the DAI borrow at stable after one year (revert expected)" ,
2021-02-07 03:10:29 +00:00
"actions" : [
{
"name" : "mint" ,
2021-02-19 20:50:13 +00:00
"description" : "Mint 10 DAI to cover the interest" ,
2021-02-07 03:10:29 +00:00
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "10" ,
"user" : "1"
} ,
"expected" : "success"
} ,
{
"name" : "approve" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"user" : "1"
} ,
"expected" : "success"
} ,
{
"name" : "repay" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "50" ,
"user" : "1" ,
"onBehalfOf" : "1" ,
"borrowRateMode" : "stable"
} ,
2021-02-09 23:14:38 +00:00
"expected" : "revert"
}
]
} ,
{
2021-02-19 20:50:13 +00:00
"description" : "User 1 repays half of the variable DAI borrow after one year" ,
2021-02-09 23:14:38 +00:00
"actions" : [
{
"name" : "repay" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-09 23:14:38 +00:00
"amount" : "50" ,
"user" : "1" ,
"onBehalfOf" : "1" ,
"borrowRateMode" : "variable"
} ,
2021-02-07 03:10:29 +00:00
"expected" : "success"
}
]
} ,
{
2021-02-19 20:50:13 +00:00
"description" : "User 1 repays the rest of the DAI borrow at stable after one year (revert expected)" ,
2021-02-07 03:10:29 +00:00
"actions" : [
{
"name" : "mint" ,
2021-02-19 20:50:13 +00:00
"description" : "Mint 15 DAI to cover the interest" ,
2021-02-07 03:10:29 +00:00
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "15" ,
"user" : "1"
} ,
"expected" : "success"
} ,
{
"name" : "approve" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"user" : "1"
} ,
"expected" : "success"
} ,
{
"name" : "repay" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "-1" ,
"user" : "1" ,
"onBehalfOf" : "1" ,
"borrowRateMode" : "stable"
} ,
2021-02-09 23:14:38 +00:00
"expected" : "revert"
}
]
} ,
{
2021-02-19 20:50:13 +00:00
"description" : "User 1 repays the rest of the DAI borrow after one year at variable" ,
2021-02-09 23:14:38 +00:00
"actions" : [
{
"name" : "repay" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-09 23:14:38 +00:00
"amount" : "-1" ,
"user" : "1" ,
"onBehalfOf" : "1" ,
"borrowRateMode" : "variable"
} ,
2021-02-07 03:10:29 +00:00
"expected" : "success"
}
]
} ,
{
2021-02-19 20:50:13 +00:00
"description" : "User 0 withdraws the deposited DAI plus interest" ,
2021-02-07 03:10:29 +00:00
"actions" : [
{
"name" : "withdraw" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "-1" ,
"user" : "0"
} ,
"expected" : "success"
}
]
} ,
{
2021-02-19 20:50:13 +00:00
"description" : "User 1 deposits 1000 DAI, user 2 tries to borrow 1000 DAI at a stable rate without any collateral (revert expected) User 1 withdrawws" ,
2021-02-07 03:10:29 +00:00
"actions" : [
{
"name" : "mint" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "1000" ,
"user" : "1"
} ,
"expected" : "success"
} ,
{
"name" : "approve" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"user" : "1"
} ,
"expected" : "success"
} ,
{
"name" : "deposit" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "1000" ,
"user" : "1"
} ,
"expected" : "success"
} ,
{
"name" : "borrow" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "1000" ,
"borrowRateMode" : "stable" ,
"user" : "2"
} ,
"expected" : "revert" ,
"revertMessage" : "The collateral balance is 0"
} ,
{
"name" : "withdraw" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "1000" ,
"user" : "1"
} ,
"expected" : "success"
}
]
} ,
{
2021-02-19 20:50:13 +00:00
"description" : "User 0 deposits 1000 DAI, user 1,2,3,4 deposit 1 WETH each and borrow 100 DAI at stable rate (revert expected) user 0 withdraws" ,
2021-02-07 03:10:29 +00:00
"actions" : [
{
"name" : "mint" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "1000" ,
"user" : "0"
} ,
"expected" : "success"
} ,
{
"name" : "approve" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"user" : "0"
} ,
"expected" : "success"
} ,
{
"name" : "deposit" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "1000" ,
"user" : "0"
} ,
"expected" : "success"
} ,
{
"name" : "mint" ,
"args" : {
2021-02-08 16:05:10 +00:00
"reserve" : "WETH" ,
2021-02-07 03:10:29 +00:00
"amount" : "1" ,
"user" : "1"
} ,
"expected" : "success"
} ,
{
"name" : "approve" ,
"args" : {
2021-02-08 16:05:10 +00:00
"reserve" : "WETH" ,
2021-02-07 03:10:29 +00:00
"user" : "1"
} ,
"expected" : "success"
} ,
{
"name" : "deposit" ,
"args" : {
2021-02-08 16:05:10 +00:00
"reserve" : "WETH" ,
2021-02-07 03:10:29 +00:00
"amount" : "1" ,
"user" : "1"
} ,
"expected" : "success"
} ,
{
"name" : "borrow" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "100" ,
"borrowRateMode" : "stable" ,
"user" : "1" ,
"timeTravel" : "365"
} ,
2021-02-09 23:14:38 +00:00
"expected" : "revert"
2021-02-07 03:10:29 +00:00
} ,
{
"name" : "mint" ,
"args" : {
2021-02-08 16:05:10 +00:00
"reserve" : "WETH" ,
2021-02-07 03:10:29 +00:00
"amount" : "1" ,
"user" : "2"
} ,
"expected" : "success"
} ,
{
"name" : "approve" ,
"args" : {
2021-02-08 16:05:10 +00:00
"reserve" : "WETH" ,
2021-02-07 03:10:29 +00:00
"user" : "2"
} ,
"expected" : "success"
} ,
{
"name" : "deposit" ,
"args" : {
2021-02-08 16:05:10 +00:00
"reserve" : "WETH" ,
2021-02-07 03:10:29 +00:00
"amount" : "1" ,
"user" : "2"
} ,
"expected" : "success"
} ,
{
"name" : "borrow" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "100" ,
"borrowRateMode" : "stable" ,
"user" : "2" ,
"timeTravel" : "365"
} ,
2021-02-09 23:14:38 +00:00
"expected" : "revert"
2021-02-07 03:10:29 +00:00
} ,
{
"name" : "mint" ,
"args" : {
2021-02-08 16:05:10 +00:00
"reserve" : "WETH" ,
2021-02-07 03:10:29 +00:00
"amount" : "1" ,
"user" : "3"
} ,
"expected" : "success"
} ,
{
"name" : "approve" ,
"args" : {
2021-02-08 16:05:10 +00:00
"reserve" : "WETH" ,
2021-02-07 03:10:29 +00:00
"user" : "3"
} ,
"expected" : "success"
} ,
{
"name" : "deposit" ,
"args" : {
2021-02-08 16:05:10 +00:00
"reserve" : "WETH" ,
2021-02-07 03:10:29 +00:00
"amount" : "1" ,
"user" : "3"
} ,
"expected" : "success"
} ,
{
"name" : "borrow" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "100" ,
"borrowRateMode" : "stable" ,
"user" : "3" ,
"timeTravel" : "365"
} ,
2021-02-09 23:14:38 +00:00
"expected" : "revert"
2021-02-07 03:10:29 +00:00
} ,
{
"name" : "mint" ,
"args" : {
2021-02-08 16:05:10 +00:00
"reserve" : "WETH" ,
2021-02-07 03:10:29 +00:00
"amount" : "1" ,
"user" : "4"
} ,
"expected" : "success"
} ,
{
"name" : "approve" ,
"args" : {
2021-02-08 16:05:10 +00:00
"reserve" : "WETH" ,
2021-02-07 03:10:29 +00:00
"user" : "4"
} ,
"expected" : "success"
} ,
{
"name" : "deposit" ,
"args" : {
2021-02-08 16:05:10 +00:00
"reserve" : "WETH" ,
2021-02-07 03:10:29 +00:00
"amount" : "1" ,
"user" : "4"
} ,
"expected" : "success"
} ,
{
"name" : "borrow" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "100" ,
"borrowRateMode" : "stable" ,
"user" : "4" ,
"timeTravel" : "365"
} ,
2021-02-09 23:14:38 +00:00
"expected" : "revert"
2021-02-07 03:10:29 +00:00
} ,
{
"name" : "mint" ,
2021-02-19 20:50:13 +00:00
"description" : "Mint 15 DAI to cover the interest" ,
2021-02-07 03:10:29 +00:00
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "15" ,
"user" : "1"
} ,
"expected" : "success"
} ,
{
"name" : "approve" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"user" : "1"
} ,
"expected" : "success"
} ,
{
"name" : "repay" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "-1" ,
"user" : "1" ,
"onBehalfOf" : "1" ,
"borrowRateMode" : "stable"
} ,
2021-02-09 23:14:38 +00:00
"expected" : "revert"
2021-02-07 03:10:29 +00:00
} ,
{
"name" : "mint" ,
2021-02-19 20:50:13 +00:00
"description" : "Mint 20 DAI to cover the interest" ,
2021-02-07 03:10:29 +00:00
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "20" ,
"user" : "2"
} ,
"expected" : "success"
} ,
{
"name" : "approve" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"user" : "2"
} ,
"expected" : "success"
} ,
{
"name" : "repay" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "-1" ,
"user" : "2" ,
"onBehalfOf" : "2" ,
"borrowRateMode" : "stable"
} ,
2021-02-09 23:14:38 +00:00
"expected" : "revert"
2021-02-07 03:10:29 +00:00
} ,
{
"name" : "mint" ,
2021-02-19 20:50:13 +00:00
"description" : "Mint 30 DAI to cover the interest" ,
2021-02-07 03:10:29 +00:00
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "30" ,
"user" : "3"
} ,
"expected" : "success"
} ,
{
"name" : "approve" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"user" : "3"
} ,
"expected" : "success"
} ,
{
"name" : "repay" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "-1" ,
"user" : "3" ,
"onBehalfOf" : "3" ,
"borrowRateMode" : "stable"
} ,
2021-02-09 23:14:38 +00:00
"expected" : "revert"
2021-02-07 03:10:29 +00:00
} ,
{
"name" : "mint" ,
2021-02-19 20:50:13 +00:00
"description" : "Mint 30 DAI to cover the interest" ,
2021-02-07 03:10:29 +00:00
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "30" ,
"user" : "4"
} ,
"expected" : "success"
} ,
{
"name" : "approve" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"user" : "4"
} ,
"expected" : "success"
} ,
{
"name" : "repay" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "-1" ,
"user" : "4" ,
"onBehalfOf" : "4" ,
"borrowRateMode" : "stable"
} ,
2021-02-09 23:14:38 +00:00
"expected" : "revert"
2021-02-07 03:10:29 +00:00
} ,
{
"name" : "withdraw" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "-1" ,
"user" : "0"
} ,
"expected" : "success"
}
]
} ,
{
2021-02-19 20:50:13 +00:00
"description" : "User 0 deposits 1000 DAI, user 1 deposits 2 WETH and borrow 100 DAI at stable rate first (revert expected), then 100 DAI at variable rate twice, repays everything. User 0 withdraws" ,
2021-02-07 03:10:29 +00:00
"actions" : [
{
"name" : "mint" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "1000" ,
"user" : "0"
} ,
"expected" : "success"
} ,
{
"name" : "approve" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"user" : "0"
} ,
"expected" : "success"
} ,
{
"name" : "deposit" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "1000" ,
"user" : "0"
} ,
"expected" : "success"
} ,
{
"name" : "mint" ,
"args" : {
2021-02-08 16:05:10 +00:00
"reserve" : "WETH" ,
2021-02-07 03:10:29 +00:00
"amount" : "2" ,
"user" : "1"
} ,
"expected" : "success"
} ,
{
"name" : "approve" ,
"args" : {
2021-02-08 16:05:10 +00:00
"reserve" : "WETH" ,
2021-02-07 03:10:29 +00:00
"user" : "1"
} ,
"expected" : "success"
} ,
{
"name" : "deposit" ,
"args" : {
2021-02-08 16:05:10 +00:00
"reserve" : "WETH" ,
2021-02-07 03:10:29 +00:00
"amount" : "2" ,
"user" : "1"
} ,
"expected" : "success"
} ,
{
"name" : "borrow" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "100" ,
"borrowRateMode" : "stable" ,
"user" : "1" ,
"timeTravel" : "365"
} ,
2021-02-09 23:14:38 +00:00
"expected" : "revert"
} ,
{
"name" : "borrow" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-09 23:14:38 +00:00
"amount" : "100" ,
"borrowRateMode" : "variable" ,
"user" : "1" ,
"timeTravel" : "365"
} ,
2021-02-07 03:10:29 +00:00
"expected" : "success"
} ,
{
"name" : "borrow" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "100" ,
"borrowRateMode" : "variable" ,
"user" : "1" ,
"timeTravel" : "365"
} ,
"expected" : "success"
} ,
{
"name" : "mint" ,
2021-02-19 20:50:13 +00:00
"description" : "Mint 50 DAI to cover the interest" ,
2021-02-07 03:10:29 +00:00
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "50" ,
"user" : "1"
} ,
"expected" : "success"
} ,
{
"name" : "approve" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"user" : "1"
} ,
"expected" : "success"
} ,
{
"name" : "repay" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "-1" ,
"user" : "1" ,
"onBehalfOf" : "1" ,
"borrowRateMode" : "stable"
} ,
2021-02-09 23:14:38 +00:00
"expected" : "revert"
2021-02-07 03:10:29 +00:00
} ,
{
"name" : "repay" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "-1" ,
"user" : "1" ,
"onBehalfOf" : "1" ,
"borrowRateMode" : "variable"
} ,
"expected" : "success"
} ,
{
"name" : "withdraw" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"amount" : "-1" ,
"user" : "0"
} ,
"expected" : "success"
}
]
}
]
}