2021-02-07 03:10:29 +00:00
{
"title" : "LendingPool: Swap rate mode" ,
"description" : "Test cases for the swapBorrowRateMode() function." ,
"stories" : [
{
"description" : "User 0 tries to swap rate mode without any variable rate loan in progress (revert expected)" ,
"actions" : [
{
"name" : "swapBorrowRateMode" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"user" : "1" ,
"borrowRateMode" : "variable"
} ,
"expected" : "revert" ,
"revertMessage" : "User does not have a variable rate loan in progress on this reserve"
}
]
} ,
{
"description" : "User 0 tries to swap rate mode without any stable rate loan in progress (revert expected)" ,
"actions" : [
{
"name" : "swapBorrowRateMode" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"user" : "1" ,
"borrowRateMode" : "stable"
} ,
"expected" : "revert" ,
"revertMessage" : "User does not have a stable rate loan in progress on this reserve"
}
]
} ,
{
2021-02-19 20:50:13 +00:00
"description" : "User 0 deposits 1000 DAI, user 1 deposits 2 WETH as collateral, borrows 100 DAI at variable rate and swaps to stable after one year, fails because stable borrowing is disabled (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" : "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" : "variable" ,
"user" : "1" ,
"timeTravel" : "365"
} ,
"expected" : "success"
} ,
{
"name" : "swapBorrowRateMode" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"user" : "1" ,
"borrowRateMode" : "variable"
} ,
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 borrows another 100 DAI at stable (revert expected), and swaps back to variable after one year (revert expected), repays the loan" ,
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" : "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" : "swapBorrowRateMode" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-07 03:10:29 +00:00
"user" : "1" ,
"borrowRateMode" : "stable"
} ,
2021-02-09 23:14:38 +00:00
"expected" : "revert"
} ,
{
"name" : "mint" ,
2021-02-19 20:50:13 +00:00
"description" : "Mint 50 DAI to cover the interest" ,
2021-02-09 23:14:38 +00:00
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-09 23:14:38 +00:00
"amount" : "50" ,
"user" : "1"
} ,
2021-02-07 03:10:29 +00:00
"expected" : "success"
} ,
2021-02-09 23:14:38 +00:00
{
"name" : "approve" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-09 23:14:38 +00:00
"user" : "1"
} ,
"expected" : "success"
} ,
{
"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"
} ,
"expected" : "success"
}
]
} ,
{
2021-02-19 20:50:13 +00:00
"description" : "User 1 borrows another 100 DAI at variable, and tries to swap to stable after one year (revert expected), repays the loan" ,
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" ,
"timeTravel" : "365"
} ,
"expected" : "success"
} ,
{
"name" : "swapBorrowRateMode" ,
"args" : {
2021-02-19 20:50:13 +00:00
"reserve" : "DAI" ,
2021-02-09 23:14:38 +00:00
"user" : "1" ,
"borrowRateMode" : "stable"
} ,
"expected" : "revert"
} ,
2021-02-07 03:10:29 +00:00
{
"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" : "variable"
} ,
"expected" : "success"
}
]
}
]
}