@@ -87,7 +87,12 @@ fun test_collectInsurance_zeroDebitBalance_returnsNil() {
8787 mintMoet (signer : PROTOCOL_ACCOUNT , to : PROTOCOL_ACCOUNT .address , amount : 10000.0 , beFailed : false )
8888
8989 // configure insurance swapper (1:1 ratio)
90- let swapperResult = setInsuranceSwapper (signer : PROTOCOL_ACCOUNT , tokenTypeIdentifier : MOET_TOKEN_IDENTIFIER , priceRatio : 1.0 )
90+ let swapperResult = setInsuranceSwapper (
91+ signer : PROTOCOL_ACCOUNT ,
92+ swapperInTypeIdentifier : MOET_TOKEN_IDENTIFIER ,
93+ swapperOutTypeIdentifier : MOET_TOKEN_IDENTIFIER ,
94+ priceRatio : 1.0 ,
95+ )
9196 Test .expect (swapperResult , Test .beSucceeded ())
9297
9398 // verify initial insurance fund balance is 0
@@ -112,7 +117,7 @@ fun test_collectInsurance_zeroDebitBalance_returnsNil() {
112117access (all )
113118fun test_collectInsurance_insufficientReserves () {
114119 // configure insurance swapper (1:1 ratio)
115- let swapperResult = setInsuranceSwapper (signer : PROTOCOL_ACCOUNT , tokenTypeIdentifier : MOET_TOKEN_IDENTIFIER , priceRatio : 1.0 )
120+ let swapperResult = setInsuranceSwapper (signer : PROTOCOL_ACCOUNT , swapperInTypeIdentifier : MOET_TOKEN_IDENTIFIER , swapperOutTypeIdentifier : MOET_TOKEN_IDENTIFIER , priceRatio : 1.0 )
116121 Test .expect (swapperResult , Test .beSucceeded ())
117122
118123 // set 90% annual debit rate
@@ -192,7 +197,12 @@ fun test_collectInsurance_tinyAmount_roundsToZero_returnsNil() {
192197 mintMoet (signer : PROTOCOL_ACCOUNT , to : PROTOCOL_ACCOUNT .address , amount : 10000.0 , beFailed : false )
193198
194199 // configure insurance swapper with very low rate
195- let swapperResult = setInsuranceSwapper (signer : PROTOCOL_ACCOUNT , tokenTypeIdentifier : MOET_TOKEN_IDENTIFIER , priceRatio : 1.0 )
200+ let swapperResult = setInsuranceSwapper (
201+ signer : PROTOCOL_ACCOUNT ,
202+ swapperInTypeIdentifier : MOET_TOKEN_IDENTIFIER ,
203+ swapperOutTypeIdentifier : MOET_TOKEN_IDENTIFIER ,
204+ priceRatio : 1.0 ,
205+ )
196206 Test .expect (swapperResult , Test .beSucceeded ())
197207
198208 // set a very low insurance rate
@@ -242,7 +252,12 @@ fun test_collectInsurance_success_fullAmount() {
242252 mintMoet (signer : PROTOCOL_ACCOUNT , to : PROTOCOL_ACCOUNT .address , amount : 10000.0 , beFailed : false )
243253
244254 // configure insurance swapper (1:1 ratio)
245- let swapperResult = setInsuranceSwapper (signer : PROTOCOL_ACCOUNT , tokenTypeIdentifier : MOET_TOKEN_IDENTIFIER , priceRatio : 1.0 )
255+ let swapperResult = setInsuranceSwapper (
256+ signer : PROTOCOL_ACCOUNT ,
257+ swapperInTypeIdentifier : MOET_TOKEN_IDENTIFIER ,
258+ swapperOutTypeIdentifier : MOET_TOKEN_IDENTIFIER ,
259+ priceRatio : 1.0 ,
260+ )
246261 Test .expect (swapperResult , Test .beSucceeded ())
247262
248263 // set 10% annual debit rate
@@ -328,10 +343,20 @@ fun test_collectInsurance_multipleTokens() {
328343 mintMoet (signer : PROTOCOL_ACCOUNT , to : PROTOCOL_ACCOUNT .address , amount : 20000.0 , beFailed : false )
329344
330345 // configure insurance swappers for both tokens (both swap to MOET at 1:1)
331- let moetSwapperResult = setInsuranceSwapper (signer : PROTOCOL_ACCOUNT , tokenTypeIdentifier : MOET_TOKEN_IDENTIFIER , priceRatio : 1.0 )
346+ let moetSwapperResult = setInsuranceSwapper (
347+ signer : PROTOCOL_ACCOUNT ,
348+ swapperInTypeIdentifier : MOET_TOKEN_IDENTIFIER ,
349+ swapperOutTypeIdentifier : MOET_TOKEN_IDENTIFIER ,
350+ priceRatio : 1.0 ,
351+ )
332352 Test .expect (moetSwapperResult , Test .beSucceeded ())
333353
334- let flowSwapperResult = setInsuranceSwapper (signer : PROTOCOL_ACCOUNT , tokenTypeIdentifier : FLOW_TOKEN_IDENTIFIER , priceRatio : 1.0 )
354+ let flowSwapperResult = setInsuranceSwapper (
355+ signer : PROTOCOL_ACCOUNT ,
356+ swapperInTypeIdentifier : FLOW_TOKEN_IDENTIFIER ,
357+ swapperOutTypeIdentifier : MOET_TOKEN_IDENTIFIER ,
358+ priceRatio : 1.0 ,
359+ )
335360 Test .expect (flowSwapperResult , Test .beSucceeded ())
336361
337362 // set 10% annual debit rates
@@ -431,7 +456,12 @@ fun test_collectInsurance_dexOracleSlippageProtection() {
431456
432457 // Oracle says FLOW = 1.0 MOET (already set in setup())
433458 // Configure insurance swapper with price ratio = 0.5 (50% deviation from oracle)
434- let swapperResult = setInsuranceSwapper (signer : PROTOCOL_ACCOUNT , tokenTypeIdentifier : FLOW_TOKEN_IDENTIFIER , priceRatio : 0.5 )
459+ let swapperResult = setInsuranceSwapper (
460+ signer : PROTOCOL_ACCOUNT ,
461+ swapperInTypeIdentifier : FLOW_TOKEN_IDENTIFIER ,
462+ swapperOutTypeIdentifier : MOET_TOKEN_IDENTIFIER ,
463+ priceRatio : 0.5 ,
464+ )
435465 Test .expect (swapperResult , Test .beSucceeded ())
436466
437467 // set 10% annual debit rate and 10% insurance rate
@@ -451,7 +481,12 @@ fun test_collectInsurance_dexOracleSlippageProtection() {
451481 Test .assertEqual (0.0 , balanceAfterFailure )
452482
453483 // Now reconfigure swapper with price ratio = 1.0 (matches oracle, 0% deviation)
454- let swapperResult2 = setInsuranceSwapper (signer : PROTOCOL_ACCOUNT , tokenTypeIdentifier : FLOW_TOKEN_IDENTIFIER , priceRatio : 1.0 )
484+ let swapperResult2 = setInsuranceSwapper (
485+ signer : PROTOCOL_ACCOUNT ,
486+ swapperInTypeIdentifier : FLOW_TOKEN_IDENTIFIER ,
487+ swapperOutTypeIdentifier : MOET_TOKEN_IDENTIFIER ,
488+ priceRatio : 1.0 ,
489+ )
455490 Test .expect (swapperResult2 , Test .beSucceeded ())
456491
457492 // collect insurance for FLOW - should SUCCEED now
@@ -472,7 +507,7 @@ fun test_collectInsurance_midPeriodRateChange() {
472507 // configure the protocol FLOW wallet and the insurance swapper
473508 setupMoetVault (PROTOCOL_ACCOUNT , beFailed : false )
474509 mintMoet (signer : PROTOCOL_ACCOUNT , to : PROTOCOL_ACCOUNT .address , amount : 10000.0 , beFailed : false )
475- let swapperResult = setInsuranceSwapper (signer : PROTOCOL_ACCOUNT , tokenTypeIdentifier : FLOW_TOKEN_IDENTIFIER , priceRatio : 1.0 )
510+ let swapperResult = setInsuranceSwapper (signer : PROTOCOL_ACCOUNT , swapperInTypeIdentifier : FLOW_TOKEN_IDENTIFIER , swapperOutTypeIdentifier : MOET_TOKEN_IDENTIFIER , priceRatio : 1.0 )
476511 Test .expect (swapperResult , Test .beSucceeded ())
477512
478513 // set interest curve
0 commit comments