Exemplo n.º 1
0
def kick(mcd, c: Collateral, gal_address) -> int:
    create_cdp_with_surplus(mcd, c, gal_address)

    assert mcd.vow.flap().transact(from_address=gal_address)
    kick = mcd.flapper.kicks()
    assert kick > 0

    current_bid = mcd.flapper.bids(kick)
    assert current_bid.lot == mcd.vow.bump()

    return kick
Exemplo n.º 2
0
    def test_should_detect_flap(self, web3, mcd, c, gal_address, keeper_address):
        # given some MKR is available to the keeper and a count of flap auctions
        mint_mkr(mcd.mkr, keeper_address, Wad.from_number(50000))
        kicks = mcd.flapper.kicks()

        # when surplus is generated
        create_cdp_with_surplus(mcd, c, gal_address)
        self.keeper.check_flap()
        wait_for_other_threads()

        # then ensure another flap auction was kicked off
        assert mcd.flapper.kicks() == kicks + 1

        # clean up by letting the auction expire
        time_travel_by(web3, mcd.flapper.tau() + 1)
Exemplo n.º 3
0
    def test_should_detect_flap(self, web3, mcd, c, gal_address, keeper_address):
        # given some MKR is available to the keeper and a count of flap auctions
        mint_mkr(mcd.mkr, keeper_address, Wad.from_number(50000))
        kicks = mcd.flapper.kicks()

        # when surplus is generated
        create_cdp_with_surplus(mcd, c, gal_address)
        self.keeper.check_flap()
        wait_for_other_threads()

        # then ensure another flap auction was kicked off
        kick = mcd.flapper.kicks()
        assert kick == kicks + 1

        # clean up by letting someone else bid and waiting until the auction ends
        auction = self.flapper.bids(kick)
        assert self.flapper.tend(kick, auction.lot, Wad.from_number(30)).transact(from_address=self.other_address)
        time_travel_by(web3, mcd.flapper.ttl() + 1)