示例#1
0
    def deploy_collateral(self, collateral: Collateral,
                          debt_ceiling: Wad, penalty: Ray, flop_lot: Wad, ratio: Ray, initial_price: Wad):

        collateral.pip = DSValue.deploy(web3=self.web3)
        assert collateral.pip.poke_with_int(initial_price.value).transact()  # Initial price

        collateral.flipper = Flipper.deploy(web3=self.web3, dai=self.dai_move.address, gem=collateral.mover.address)

        collateral.spotter = Spotter.deploy(web3=self.web3, pit=self.pit.address, ilk=collateral.ilk)
        collateral.spotter.file_pip(collateral.pip.address).transact()
        collateral.spotter.file_mat(ratio).transact()  # Liquidation ratio

        assert collateral.gem.approve(collateral.adapter.address).transact()

        assert self.cat.file_flip(collateral.ilk, collateral.flipper).transact()
        assert self.cat.file_lump(collateral.ilk, flop_lot).transact()  # Liquidation Quantity
        assert self.cat.file_chop(collateral.ilk, penalty).transact()  # Liquidation Penalty
        assert self.vat.init(collateral.ilk).transact()
        assert self.drip.init(collateral.ilk).transact()

        assert self.vat.rely(collateral.flipper.address).transact()
        assert self.vat.rely(collateral.adapter.address).transact()
        assert self.vat.rely(collateral.mover.address).transact()
        assert self.pit.rely(collateral.spotter.address).transact()

        assert self.pit.file_line(collateral.ilk, debt_ceiling).transact()  # Collateral debt Ceiling
        assert collateral.spotter.poke().transact()

        self.collaterals.append(collateral)
示例#2
0
    def __init__(self):
        web3 = Web3(HTTPProvider("http://localhost:8555"))
        web3.eth.defaultAccount = web3.eth.accounts[0]
        our_address = Address(web3.eth.defaultAccount)
        sai = DSToken.deploy(web3, 'DAI')
        sin = DSToken.deploy(web3, 'SIN')
        skr = DSToken.deploy(web3, 'PETH')
        gem = DSToken.deploy(web3, 'WETH')
        gov = DSToken.deploy(web3, 'MKR')
        pip = DSValue.deploy(web3)
        pep = DSValue.deploy(web3)
        pit = DSVault.deploy(web3)

        vox = Vox.deploy(web3, per=Ray.from_number(1))
        tub = Tub.deploy(web3,
                         sai=sai.address,
                         sin=sin.address,
                         skr=skr.address,
                         gem=gem.address,
                         gov=gov.address,
                         pip=pip.address,
                         pep=pep.address,
                         vox=vox.address,
                         pit=pit.address)
        tap = Tap.deploy(web3, tub.address)
        top = Top.deploy(web3, tub.address, tap.address)

        tub._contract.functions.turn(tap.address.address).transact()

        etherdelta = EtherDelta.deploy(
            web3,
            admin=Address('0x1111100000999998888877777666665555544444'),
            fee_account=Address('0x8888877777666665555544444111110000099999'),
            account_levels_addr=Address(
                '0x0000000000000000000000000000000000000000'),
            fee_make=Wad.from_number(0.01),
            fee_take=Wad.from_number(0.02),
            fee_rebate=Wad.from_number(0.03))

        # set permissions
        dad = DSGuard.deploy(web3)
        dad.permit(DSGuard.ANY, DSGuard.ANY, DSGuard.ANY).transact()
        tub.set_authority(dad.address).transact()
        for auth in [sai, sin, skr, gem, gov, pit, tap, top]:
            auth.set_authority(dad.address).transact()

        # approve
        tub.approve(directly())
        tap.approve(directly())

        # mint some GEMs
        gem.mint(Wad.from_number(1000000)).transact()

        self.snapshot_id = web3.manager.request_blocking("evm_snapshot", [])

        self.web3 = web3
        self.our_address = our_address
        self.sai = sai
        self.sin = sin
        self.skr = skr
        self.gem = gem
        self.gov = gov
        self.vox = vox
        self.tub = tub
        self.tap = tap
        self.top = top
        self.etherdelta = etherdelta
示例#3
0
    def __init__(self):
        web3 = Web3(EthereumTesterProvider())
        web3.eth.defaultAccount = web3.eth.accounts[0]
        our_address = Address(web3.eth.defaultAccount)
        sai = DSToken.deploy(web3, 'DAI')
        sin = DSToken.deploy(web3, 'SIN')
        skr = DSToken.deploy(web3, 'PETH')
        gem = DSToken.deploy(web3, 'WETH')
        gov = DSToken.deploy(web3, 'MKR')
        pip = DSValue.deploy(web3)
        pep = DSValue.deploy(web3)
        pit = DSVault.deploy(web3)

        vox = Vox.deploy(web3, per=Ray.from_number(1))
        tub = Tub.deploy(web3, sai=sai.address, sin=sin.address, skr=skr.address, gem=gem.address, gov=gov.address,
                         pip=pip.address, pep=pep.address, vox=vox.address, pit=pit.address)
        tap = Tap.deploy(web3, tub.address)
        top = Top.deploy(web3, tub.address, tap.address)

        tub._contract.transact().turn(tap.address.address)

        otc = MatchingMarket.deploy(web3, 2600000000)
        etherdelta = EtherDelta.deploy(web3,
                                       admin=Address('0x1111100000999998888877777666665555544444'),
                                       fee_account=Address('0x8888877777666665555544444111110000099999'),
                                       account_levels_addr=Address('0x0000000000000000000000000000000000000000'),
                                       fee_make=Wad.from_number(0.01),
                                       fee_take=Wad.from_number(0.02),
                                       fee_rebate=Wad.from_number(0.03))

        # set permissions
        dad = DSGuard.deploy(web3)
        dad.permit(DSGuard.ANY, DSGuard.ANY, DSGuard.ANY).transact()
        tub.set_authority(dad.address).transact()
        for auth in [sai, sin, skr, gem, gov, pit, tap, top]:
            auth.set_authority(dad.address).transact()

        # whitelist pairs
        otc.add_token_pair_whitelist(sai.address, gem.address).transact()

        # approve
        tub.approve(directly())
        tap.approve(directly())

        # mint some GEMs
        gem.mint(Wad.from_number(1000000)).transact()

        web3.providers[0].rpc_methods.evm_snapshot()

        self.web3 = web3
        self.our_address = our_address
        self.sai = sai
        self.sin = sin
        self.skr = skr
        self.gem = gem
        self.gov = gov
        self.vox = vox
        self.tub = tub
        self.tap = tap
        self.top = top
        self.otc = otc
        self.etherdelta = etherdelta
示例#4
0
 def setup_method(self):
     self.web3 = Web3(EthereumTesterProvider())
     self.web3.eth.defaultAccount = self.web3.eth.accounts[0]
     self.dsvalue = DSValue.deploy(self.web3)
示例#5
0
 def setup_method(self):
     self.web3 = Web3(HTTPProvider("http://localhost:8555"))
     self.web3.eth.defaultAccount = self.web3.eth.accounts[0]
     self.dsvalue = DSValue.deploy(self.web3)