コード例 #1
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)
コード例 #2
0
    def test_default_gas_config(self, web3, keeper_address):
        keeper = AuctionKeeper(args=args(f"--eth-from {keeper_address} "
                                         f"--type flop --from-block 1 "
                                         f"--model ./bogus-model.sh"), web3=web3)

        assert isinstance(keeper.gas_price, DynamicGasPrice)
        assert keeper.gas_price.initial_multiplier == 1.0
        assert keeper.gas_price.reactive_multiplier == 1.125
        assert keeper.gas_price.gas_maximum == default_max_gas * GWEI

        default_initial_gas = get_node_gas_price(web3)
        assert keeper.gas_price.get_gas_price(0) == default_initial_gas
        assert keeper.gas_price.get_gas_price(1 + every_secs) == default_initial_gas * 1.125
        assert keeper.gas_price.get_gas_price(1 + every_secs * 2) == default_initial_gas * 1.125 ** 2
        assert keeper.gas_price.get_gas_price(1 + every_secs * 3) == default_initial_gas * 1.125 ** 3
        assert keeper.gas_price.get_gas_price(every_secs * 80) == default_max_gas * GWEI
コード例 #3
0
    def test_no_api_non_fixed(self, mcd, keeper_address):
        c = mcd.collaterals['ETH-A']

        reactive_multipler = 1.125 * 3

        keeper = AuctionKeeper(args=args(f"--eth-from {keeper_address} "
                                         f"--type flip "
                                         f"--from-block 1 "
                                         f"--ilk {c.ilk.name} "
                                         f"--gas-reactive-multiplier {reactive_multipler} "
                                         f"--model ./bogus-model.sh"), web3=mcd.web3)
        initial_amount = get_node_gas_price(mcd.web3)
        assert keeper.gas_price.get_gas_price(0) == initial_amount
        assert keeper.gas_price.get_gas_price(1 + every_secs) == initial_amount * reactive_multipler
        assert keeper.gas_price.get_gas_price(1 + every_secs * 2) == initial_amount * reactive_multipler ** 2
        assert keeper.gas_price.get_gas_price(1 + every_secs * 3) == initial_amount * reactive_multipler ** 3
        assert keeper.gas_price.get_gas_price(every_secs * 12) == default_max_gas * GWEI
コード例 #4
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 the node gas price
        self.default_gas_price = get_node_gas_price(self.web3)
コード例 #5
0
 def test_get_node_gas_price(self, web3):
     assert get_node_gas_price(web3) > 0