Пример #1
0
    def setup_method(self):
        self.web3 = web3()
        self.our_address = our_address(self.web3)
        self.keeper_address = keeper_address(self.web3)
        self.other_address = other_address(self.web3)
        self.gal_address = gal_address(self.web3)
        self.mcd = mcd(self.web3)
        self.flopper = self.mcd.flopper
        self.flopper.approve(
            self.mcd.vat.address,
            approval_function=hope_directly(from_address=self.keeper_address))
        self.flopper.approve(
            self.mcd.vat.address,
            approval_function=hope_directly(from_address=self.other_address))

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

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

        self.sump = self.mcd.vow.sump()  # Rad
Пример #2
0
    def setup_method(self):
        self.web3 = web3()
        self.our_address = our_address(self.web3)
        self.keeper_address = keeper_address(self.web3)
        self.other_address = other_address(self.web3)
        self.gal_address = gal_address(self.web3)
        self.mcd = mcd(self.web3)
        self.flapper = self.mcd.flapper
        self.flapper.approve(self.mcd.mkr.address,
                             directly(from_address=self.other_address))

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

        mint_mkr(self.mcd.mkr, self.keeper_address, Wad.from_number(50000))
        mint_mkr(self.mcd.mkr, 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 10 Gwei
        self.default_gas_price = 10 * DynamicGasPrice.GWEI
Пример #3
0
    def setup_method(self):
        self.web3 = web3()
        self.our_address = our_address(self.web3)
        self.keeper_address = keeper_address(self.web3)
        self.other_address = other_address(self.web3)
        self.gal_address = gal_address(self.web3)
        self.mcd = mcd(self.web3)
        self.flopper = self.mcd.flopper
        self.flopper.approve(
            self.mcd.vat.address,
            approval_function=hope_directly(from_address=self.keeper_address))
        self.flopper.approve(
            self.mcd.vat.address,
            approval_function=hope_directly(from_address=self.other_address))

        self.keeper = AuctionKeeper(args=args(
            f"--eth-from {self.keeper_address} "
            f"--type flop "
            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_dai(self.mcd, self.mcd.collaterals['ETH-C'],
                    self.keeper_address, Wad.from_number(200.00000))
        reserve_dai(self.mcd, self.mcd.collaterals['ETH-C'],
                    self.other_address, Wad.from_number(200.00000))

        self.sump = self.mcd.vow.sump()  # Rad
Пример #4
0
 def setup_method(self):
     self.web3 = web3()
     self.mcd = mcd(web3())
     self.keeper_address = keeper_address(web3())
     self.mcd.approve_dai(self.keeper_address)
     self.our_address = our_address(web3())
     self.mcd.approve_dai(self.our_address)
     self.collateral = self.mcd.collaterals['ETH-B']
Пример #5
0
 def setup_class(cls):
     cls.web3 = web3()
     cls.mcd = mcd(cls.web3)
     cls.collateral = collateral_clip(cls.mcd)
     cls.dai_collateral = cls.mcd.collaterals['ETH-C']
     cls.clipper = cls.collateral.clipper
     cls.keeper_address = keeper_address(cls.web3)
     cls.gal_address = gal_address(cls.web3)
     cls.other_address = other_address(cls.web3)
Пример #6
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 = web3()
     self.mcd = mcd(self.web3)
     self.keeper_address = keeper_address(self.mcd.web3)
     self.web3.eth.defaultAccount = self.keeper_address.address
     self.collateral = self.mcd.collaterals['ETH-A']
     self.collateral.approve(self.keeper_address)
     assert self.collateral.gem.deposit(Wad.from_number(1)).transact()
     self.ilk = self.collateral.ilk
Пример #7
0
 def setup_class(cls):
     cls.web3 = web3()
     cls.our_address = our_address(cls.web3)
     cls.gal_address = gal_address(cls.web3)
     cls.keeper_address = keeper_address(cls.web3)
     cls.other_address = other_address(cls.web3)
     cls.mcd = mcd(cls.web3)
     cls.flopper = cls.mcd.flopper
     cls.flopper.approve(
         cls.mcd.vat.address,
         approval_function=hope_directly(from_address=cls.keeper_address))
     cls.flopper.approve(
         cls.mcd.vat.address,
         approval_function=hope_directly(from_address=cls.other_address))
Пример #8
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 = web3()
     self.mcd = mcd(self.web3)
     self.keeper_address = keeper_address(self.web3)
     self.collateral = self.mcd.collaterals['ETH-B']
     self.keeper = AuctionKeeper(args=args(
         f"--eth-from {self.keeper_address.address} "
         f"--type flip "
         f"--from-block 1 "
         f"--ilk {self.collateral.ilk.name} "
         f"--bid-check-interval 0.03 "
         f"--model ./bogus-model.sh"),
                                 web3=self.mcd.web3)
     self.keeper.approve()
Пример #9
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 = web3()
        self.mcd = mcd(self.web3)
        self.c = self.mcd.collaterals['ETH-C']
        self.keeper_address = keeper_address(self.web3)
        self.keeper = AuctionKeeper(args=args(f"--eth-from {self.keeper_address.address} "
                                     f"--type flip "
                                     f"--from-block 1 "
                                     f"--ilk {self.c.ilk.name} "
                                     f"--model ./bogus-model.sh"), web3=self.mcd.web3)
        self.keeper.approve()

        # Keeper won't bid with a 0 Dai balance
        purchase_dai(Wad.from_number(20), self.keeper_address)
        assert self.mcd.dai_adapter.join(self.keeper_address, Wad.from_number(20)).transact(
            from_address=self.keeper_address)
Пример #10
0
    def setup_method(self):
        self.web3 = web3()
        self.our_address = our_address(self.web3)
        self.keeper_address = keeper_address(self.web3)
        self.other_address = other_address(self.web3)
        self.gal_address = gal_address(self.web3)
        self.mcd = mcd(self.web3)
        self.flapper = self.mcd.flapper
        self.flapper.approve(self.mcd.mkr.address, directly(from_address=self.other_address))

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

        mint_mkr(self.mcd.mkr, self.keeper_address, Wad.from_number(50000))
        mint_mkr(self.mcd.mkr, self.other_address, Wad.from_number(50000))
Пример #11
0
 def teardown_class(cls):
     w3 = web3()
     cls.eliminate_queued_debt(w3, mcd(w3), keeper_address(w3))
Пример #12
0
                    action='store_true',
                    default=False,
                    help="Print surplus and debt balances in the Vow")
parser.add_argument('--auctions',
                    dest='auctions',
                    action='store_true',
                    default=False,
                    help="Dump auction details")
parser.add_argument('--missed-flops',
                    dest='missed_flops',
                    action='store_true',
                    default=False,
                    help="List flops which were not bid upon")
arguments = parser.parse_args(sys.argv[1:])

mcd = mcd(web3())
address = gal_address(web3())


def print_balances():
    joy = mcd.vat.dai(mcd.vow.address)
    awe = mcd.vat.sin(mcd.vow.address)
    woe = (awe - mcd.vow.sin()) - mcd.vow.ash()
    print(f"joy={str(joy)[:6]}, awe={str(awe)[:9]}, woe={str(woe)[:9]}, "
          f"Sin={str(mcd.vow.sin())[:9]}, Ash={str(mcd.vow.ash())[:9]}, "
          f"debt={str(mcd.vat.debt())[:9]}, vice={str(mcd.vat.vice())[:9]}")
    #f"bump={str(mcd.vow.bump())[:9]}, sump={str(mcd.vow.sump())[:9]}")


def print_auctions():
    pprint(mcd.active_auctions())
Пример #13
0
 def setup_class(cls):
     cls.mcd = mcd(web3())
     cls.strategy = FlopperStrategy(cls.mcd.flopper)
     cls.mock_flopper = MockFlopper()
Пример #14
0
 def setup_class(self):
     dss_deployment = mcd(web3())
     self.ilk = dss_deployment.collaterals['ETH-A'].ilk
     self.cdpmanager = CdpManager(
         web3(), Address("0xa616ad7d4562dcd9208425af4038defd0a9057b0"))
Пример #15
0
 def teardown_class(cls):
     cls.mcd = mcd(web3())
     if not repay_urn(cls.mcd, c(cls.mcd), gal_address(web3())):
         liquidate_urn(cls.mcd, c(cls.mcd), gal_address(web3()), keeper_address(web3()))
     kill_other_threads()
Пример #16
0
 def teardown_class(cls):
     cls.eliminate_queued_debt(web3(), mcd(web3()), keeper_address(web3()))
Пример #17
0
 def setup_class(self):
     self.mcd = mcd(web3())
     self.strategy = FlopperStrategy(self.mcd.flopper)
     self.mock_flopper = MockFlopper()
Пример #18
0
 def teardown_class(cls):
     cls.cleanup_debt(web3(), mcd(web3()), other_address(web3()))
Пример #19
0
 def teardown_class(cls):
     cls.mcd = mcd(web3())
     cls.liquidate_urn(web3(), cls.mcd, c(cls.mcd), gal_address(web3()),
                       our_address(web3()))
Пример #20
0
 def teardown_class(cls):
     flog_and_heal(web3(),
                   mcd(web3()),
                   past_blocks=1200,
                   require_heal=False)
Пример #21
0
 def setup_class(self):
     dss_deployment = mcd(web3())
     self.ilk = dss_deployment.collaterals['ETH-A'].ilk
     self.cdpmanager = CdpManager(
         web3(), Address("0x84617303947304444Ceb641582c024f277BBF4Ff"))