Example #1
0
 def setup_method(self):
     self.web3 = get_web3()
     self.geb = get_geb(get_web3())
     self.keeper_address = get_keeper_address(get_web3())
     self.geb.approve_system_coin(self.keeper_address)
     self.our_address = get_our_address(get_web3())
     self.geb.approve_system_coin(self.our_address)
     self.collateral = self.geb.collaterals['ETH-B']
Example #2
0
    def setup_method(self):
        self.web3 = get_web3()
        self.our_address = get_our_address(self.web3)
        self.keeper_address = get_keeper_address(self.web3)
        self.other_address = get_other_address(self.web3)
        self.auction_income_recipient_address = get_auction_income_recipient_address(self.web3)
        self.geb = get_geb(self.web3)
        self.surplus_auction_house = self.geb.surplus_auction_house
        self.surplus_auction_house.approve(self.geb.prot.address, directly(from_address=self.other_address))
        #self.min_auction = self.geb.surplus_auction_house.auctions_started() + 1

        self.keeper = AuctionKeeper(args=args(f"--eth-from {self.keeper_address} "
                                              f"--type surplus "
                                              f"--from-block 1 "
                                              f"--bid-delay 0 "
                                              #f"--min-auction {self.min_auction} "
                                              f"--model ./bogus-model.sh"), web3=self.web3)
        self.keeper.approve()

        mint_prot(self.geb.prot, self.keeper_address, Wad.from_number(50000))
        mint_prot(self.geb.prot, self.other_address, Wad.from_number(50000))

        assert isinstance(self.keeper.gas_price, DynamicGasPrice)
        # Since no args were assigned, gas strategy should return a GeometricGasPrice starting at the node gas price
        self.default_gas_price = get_node_gas_price(self.web3)
    def setup_class(self):
        """ I'm excluding initialization of a specific collateral perchance we use multiple collaterals
        to improve test speeds.  This prevents us from instantiating the keeper as a class member. """
        self.web3 = get_web3()
        self.geb = get_geb(self.web3)
        self.keeper_address = get_keeper_address(self.web3)
        self.collateral = self.geb.collaterals['ETH-B']
        self.min_auction = self.collateral.collateral_auction_house.auctions_started(
        ) + 1
        self.keeper = AuctionKeeper(args=args(
            f"--eth-from {self.keeper_address.address} "
            f"--type collateral "
            f"--flash-swap "
            f"--from-block {self.geb.starting_block_number} "
            f"--min-auction {self.min_auction} "
            f"--model ../models/collateral_model.sh "
            f"--collateral-type {self.collateral.collateral_type.name}"),
                                    web3=self.geb.web3)
        self.keeper.approve()

        #flash-swap should disable rebalance
        assert self.keeper.rebalance_system_coin() == Wad(0)

        assert isinstance(self.keeper.gas_price, DynamicGasPrice)
        self.default_gas_price = self.keeper.gas_price.get_gas_price(0)
Example #4
0
 def setup_class(self):
     """ I'm excluding initialization of a specific collateral perchance we use multiple collaterals
     to improve test speeds.  This prevents us from instantiating the keeper as a class member. """
     self.web3 = get_web3()
     self.geb = get_geb(self.web3)
     self.keeper_address = get_keeper_address(self.geb.web3)
     self.web3.eth.defaultAccount = self.keeper_address.address
     self.collateral = self.geb.collaterals['ETH-A']
     self.collateral.approve(self.keeper_address)
     assert self.collateral.collateral.deposit(
         Wad.from_number(1)).transact()
     self.collateral_type = self.collateral.collateral_type
     self.gas = GeometricGasPrice(initial_price=int(1.1 *
                                                    GeometricGasPrice.GWEI),
                                  every_secs=2)
    def setup_method(self):
        self.web3 = get_web3()
        self.our_address = get_our_address(self.web3)
        self.keeper_address = get_keeper_address(self.web3)
        self.other_address = get_other_address(self.web3)
        self.auction_income_recipient_address = get_auction_income_recipient_address(
            self.web3)
        self.geb = get_geb(self.web3)
        self.debt_auction_house = self.geb.debt_auction_house
        self.debt_auction_house.approve(
            self.geb.safe_engine.address,
            approval_function=approve_safe_modification_directly(
                from_address=self.keeper_address))
        self.debt_auction_house.approve(
            self.geb.safe_engine.address,
            approval_function=approve_safe_modification_directly(
                from_address=self.other_address))

        self.keeper = AuctionKeeper(args=args(
            f"--eth-from {self.keeper_address} "
            f"--type debt "
            f"--from-block 1 "
            f"--model ./bogus-model.sh"),
                                    web3=self.web3)
        self.keeper.approve()

        assert isinstance(self.keeper.gas_price, DynamicGasPrice)
        self.default_gas_price = self.keeper.gas_price.get_gas_price(0)

        reserve_system_coin(self.geb, self.geb.collaterals['ETH-C'],
                            self.keeper_address, Wad.from_number(200.00000))
        reserve_system_coin(self.geb, self.geb.collaterals['ETH-C'],
                            self.other_address, Wad.from_number(200.00000))

        self.debt_auction_bid_size = self.geb.accounting_engine.debt_auction_bid_size(
        )  # Rad
 def teardown_class(cls):
     w3 = get_web3()
     print("tearing down TestAuctionKeeperLiquidate")
     cls.eliminate_queued_debt(w3, get_geb(w3), get_keeper_address(w3))
 def setup_class(self):
     self.geb = get_geb(get_web3())
     self.strategy = DebtAuctionStrategy(self.geb.debt_auction_house,
                                         self.geb)
     self.mock_debt_auction_house = MockDebtAuctionHouse()
 def teardown_class(cls):
     cls.cleanup_debt(get_web3(), get_geb(get_web3()),
                      get_other_address(get_web3()))
 def teardown_class(cls):
     pop_debt_and_settle_debt(get_web3(), get_geb(get_web3()), past_blocks=1200, require_settle_debt=True)
     cls.cleanup_debt(get_web3(), get_geb(get_web3()), get_other_address(get_web3()))
Example #10
0
 def teardown_class(cls):
     cls.geb = get_geb(get_web3())