@@ -50,7 +50,7 @@ describe("StreamExchange", () => {
5050 before ( async function ( ) {
5151 //process.env.RESET_SUPERFLUID_FRAMEWORK = 1;
5252 let response = await axios . get ( 'https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd' )
53- oraclePrice = parseInt ( response . data . ethereum . usd * 1.002 * 1000000 ) . toString ( )
53+ oraclePrice = parseInt ( response . data . ethereum . usd * 1.005 * 1000000 ) . toString ( )
5454 console . log ( "oraclePrice" , oraclePrice )
5555 } ) ;
5656
@@ -389,28 +389,43 @@ describe("StreamExchange", () => {
389389 expect ( await app . getFeeRate ( ) ) . to . equal ( 20000 )
390390
391391 await app . connect ( owner ) . setFeeRate ( 20000 ) ;
392+ await app . connect ( owner ) . setRateTolerance ( 50000 ) ;
392393 await app . connect ( owner ) . setSubsidyRate ( "500000000000000000" )
393394
394395 expect ( await app . getSubsidyRate ( ) ) . to . equal ( "500000000000000000" )
395396 expect ( await app . getFeeRate ( ) ) . to . equal ( 20000 )
397+ expect ( await app . getRateTolerance ( ) ) . to . equal ( 50000 )
396398 console . log ( "Getters and setters correct" )
397399
398- const inflowRate = toWad ( 0.0000004000 ) ;
400+ const inflowRate = toWad ( 0.00000004000 ) ;
399401
400- await ethx . transfer ( u . bob . address , "100000000000000000" , { from : u . admin . address } ) ;
401- await ethx . transfer ( u . alice . address , "100000000000000000" , { from : u . admin . address } ) ;
402+ console . log ( "Transfer bob" )
403+ await ethx . transfer ( u . bob . address , "7000000000000000" , { from : u . admin . address } ) ;
404+ console . log ( "Transfer aliuce" )
405+ await ethx . transfer ( u . alice . address , "7000000000000000" , { from : u . admin . address } ) ;
406+ console . log ( "Done" )
402407
403408 await tp . submitValue ( 1 , oraclePrice ) ;
404409
405410 await takeMeasurements ( ) ;
406411
412+ // Test owner start/stop stream
413+ await u . admin . flow ( { flowRate : inflowRate , recipient : u . app } ) ;
414+ await traveler . advanceTimeAndBlock ( 60 * 60 * 3 ) ;
415+ await tp . submitValue ( 1 , oraclePrice ) ;
416+ await app . distribute ( )
417+ await u . admin . flow ( { flowRate : "0" , recipient : u . app } ) ;
418+
419+
420+
407421 await u . bob . flow ( { flowRate : inflowRate , recipient : u . app } ) ;
408422 await traveler . advanceTimeAndBlock ( 60 * 60 * 3 ) ;
409423 await tp . submitValue ( 1 , oraclePrice ) ;
410424 await app . distribute ( )
411425 await takeMeasurements ( ) ;
412426 await delta ( "Bob" , bobBalances )
413427 await delta ( "Alice" , aliceBalances )
428+ await delta ( "Owner" , ownerBalances )
414429
415430 // Round 2
416431 await u . alice . flow ( { flowRate : inflowRate , recipient : u . app } ) ;
@@ -420,6 +435,8 @@ describe("StreamExchange", () => {
420435 await takeMeasurements ( )
421436 await delta ( "Bob" , bobBalances )
422437 await delta ( "Alice" , aliceBalances )
438+ await delta ( "Owner" , ownerBalances )
439+
423440
424441 // Round 3
425442 await traveler . advanceTimeAndBlock ( 60 * 60 * 2 ) ;
@@ -428,6 +445,8 @@ describe("StreamExchange", () => {
428445 await takeMeasurements ( )
429446 await delta ( "Bob" , bobBalances )
430447 await delta ( "Alice" , aliceBalances )
448+ await delta ( "Owner" , ownerBalances )
449+
431450
432451
433452 // Round 4
@@ -438,6 +457,8 @@ describe("StreamExchange", () => {
438457 await takeMeasurements ( )
439458 await delta ( "Bob" , bobBalances )
440459 await delta ( "Alice" , aliceBalances )
460+ await delta ( "Owner" , ownerBalances )
461+
441462
442463 // Round 5
443464 await traveler . advanceTimeAndBlock ( 60 * 60 * 2 ) ;
@@ -446,6 +467,8 @@ describe("StreamExchange", () => {
446467 await takeMeasurements ( )
447468 await delta ( "Bob" , bobBalances )
448469 await delta ( "Alice" , aliceBalances )
470+ await delta ( "Owner" , ownerBalances )
471+
449472
450473
451474 } ) ;
0 commit comments