@@ -84,13 +84,15 @@ function itCanLiquidate({ ctx }) {
84
84
} ) ;
85
85
86
86
describe ( 'getting liquidated' , ( ) => {
87
- let beforeDebt ;
88
- let beforeBalance ;
87
+ let beforeDebt , beforeDebttedSnx ;
88
+ let beforeBalance , beforeCredittedSnx ;
89
89
90
90
before ( 'otherUser calls liquidateDelinquentAccount' , async ( ) => {
91
91
beforeDebt = (
92
92
await Synthetix . debtBalanceOf ( someUser . address , toBytes32 ( 'sUSD' ) )
93
93
) . toString ( ) ;
94
+ beforeDebttedSnx = await Synthetix . balanceOf ( someUser . address ) ;
95
+ beforeCredittedSnx = await Synthetix . balanceOf ( otherUser . address ) ;
94
96
beforeBalance = await SynthsUSD . balanceOf ( otherUser . address ) ;
95
97
96
98
await Synthetix . connect ( otherUser ) . liquidateDelinquentAccount (
@@ -99,11 +101,6 @@ function itCanLiquidate({ ctx }) {
99
101
) ;
100
102
} ) ;
101
103
102
- it ( 'is liquidated' , async ( ) => {
103
- // = sUSD liquidated / SNX Price * 1.1
104
- assert . bnLt ( await Synthetix . balanceOf ( someUser . address ) , '100000000000000000000' ) ;
105
- } ) ;
106
-
107
104
it ( 'deducts sUSD debt from the liquidated' , async ( ) => {
108
105
assert . bnLt (
109
106
await Synthetix . debtBalanceOf ( someUser . address , toBytes32 ( 'sUSD' ) ) ,
@@ -114,6 +111,16 @@ function itCanLiquidate({ ctx }) {
114
111
it ( 'burns sUSD from otherUser' , async ( ) => {
115
112
assert . bnLt ( await SynthsUSD . balanceOf ( otherUser . address ) , beforeBalance ) ;
116
113
} ) ;
114
+
115
+ it ( 'transfers SNX from otherUser' , async ( ) => {
116
+ const amountSent = beforeDebttedSnx . sub ( await Synthetix . balanceOf ( someUser . address ) ) ;
117
+
118
+ assert . bnNotEqual ( amountSent , '0' ) ;
119
+ assert . bnEqual (
120
+ await Synthetix . balanceOf ( otherUser . address ) ,
121
+ beforeCredittedSnx . add ( amountSent )
122
+ ) ;
123
+ } ) ;
117
124
} ) ;
118
125
} ) ;
119
126
} ) ;
0 commit comments