def setup_method(self): self.web3 = Web3(HTTPProvider("http://localhost:8555")) self.web3.eth.defaultAccount = self.web3.eth.accounts[0] self.our_address = Address(self.web3.eth.defaultAccount) self.dai = DSToken.deploy(self.web3, 'DAI') self.gem = DSToken.deploy(self.web3, 'MKR') self.flopper = Flopper.deploy(self.web3, self.dai.address, self.gem.address) # so the Flopper can mint MKR dad = DSGuard.deploy(self.web3) dad.permit(self.flopper.address, self.gem.address, DSGuard.ANY).transact() self.gem.set_authority(dad.address).transact()
def setup_method(self): self.web3 = Web3(HTTPProvider("http://localhost:8555")) self.web3.eth.defaultAccount = self.web3.eth.accounts[0] self.keeper_address = Address(self.web3.eth.defaultAccount) self.gal_address = Address(self.web3.eth.accounts[1]) self.other_address = Address(self.web3.eth.accounts[2]) # GemMock version of DSToken with push(bytes32, uint function) an hope(address) gem_abi = Contract._load_abi(__name__, '../lib/pymaker/tests/abi/GemMock.abi') gem_bin = Contract._load_bin(__name__, '../lib/pymaker/tests/abi/GemMock.bin') self.dai_addr = Contract._deploy(self.web3, gem_abi, gem_bin, [b'DAI']) self.dai = DSToken(web3=self.web3, address=self.dai_addr) self.dai.mint(Wad.from_number(10000000)).transact() self.dai.transfer(self.other_address, Wad.from_number(1000000)).transact() self.mkr = DSToken.deploy(self.web3, 'MKR') self.flopper = Flopper.deploy(self.web3, self.dai.address, self.mkr.address) # so the Flopper can mint MKR dad = DSGuard.deploy(self.web3) dad.permit(self.flopper.address, self.mkr.address, DSGuard.ANY).transact() self.mkr.set_authority(dad.address).transact() self.keeper = AuctionKeeper(args=args( f"--eth-from {self.keeper_address} " f"--flopper {self.flopper.address} " f"--model ./bogus-model.sh"), web3=self.web3) self.keeper.approve() self.model = MagicMock() self.model.get_stance = MagicMock(return_value=None) self.model_factory = self.keeper.auctions.model_factory self.model_factory.create_model = MagicMock(return_value=self.model)
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
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
def setup_method(self): self.web3 = Web3(HTTPProvider("http://localhost:8555")) self.web3.eth.defaultAccount = self.web3.eth.accounts[0] self.our_address = Address(self.web3.eth.defaultAccount) self.ds_guard = DSGuard.deploy(self.web3)
def setup_method(self): self.web3 = Web3(EthereumTesterProvider()) self.web3.eth.defaultAccount = self.web3.eth.accounts[0] self.our_address = Address(self.web3.eth.defaultAccount) self.ds_guard = DSGuard.deploy(self.web3)
def deploy(web3: Web3, debt_ceiling: Wad): assert isinstance(web3, Web3) vat = Vat.deploy(web3=web3) pit = Pit.deploy(web3=web3, vat=vat.address) assert pit.file_global_line(debt_ceiling).transact() # Global debt Ceiling assert vat.rely(pit.address).transact() dai = DSToken.deploy(web3=web3, symbol='DAI') dai_adapter = DaiAdapter.deploy(web3=web3, vat=vat.address, dai=dai.address) dai_move = DaiVat.deploy(web3=web3, vat=vat.address) assert vat.rely(dai_adapter.address).transact() assert vat.rely(dai_move.address).transact() mkr = DSToken.deploy(web3=web3, symbol='MKR') # TODO: use a DSProxy mom = DSGuard.deploy(web3) assert mom.permit(DSGuard.ANY, DSGuard.ANY, DSGuard.ANY).transact() assert dai.set_authority(mom.address).transact() assert mkr.set_authority(mom.address).transact() vow = Vow.deploy(web3=web3) drip = Drip.deploy(web3=web3, vat=vat.address) flap = Flapper.deploy(web3=web3, dai=dai_move.address, gem=mkr.address) assert vow.file_vat(vat).transact() assert vow.file_flap(flap).transact() assert vow.file_bump(Wad.from_number(1000)).transact() assert vow.file_sump(Wad.from_number(10)).transact() assert drip.file_vow(vow).transact() assert vat.rely(vow.address).transact() assert vat.rely(drip.address).transact() assert vat.rely(flap.address).transact() cat = Cat.deploy(web3=web3, vat=vat.address) assert cat.file_vow(vow).transact() assert cat.file_pit(pit).transact() flop = Flopper.deploy(web3=web3, dai=dai_move.address, gem=mkr.address) assert vow.file_flop(flop).transact() assert vat.rely(cat.address).transact() assert vat.rely(flop.address).transact() assert vow.rely(cat.address).transact() assert flop.rely(vow.address).transact() config = DssDeployment.Config(mom, vat, vow, drip, pit, cat, flap, flop, dai, dai_adapter, dai_move, mkr) deployment = DssDeployment(web3, config) collateral = Collateral.deploy(web3=web3, name='WETH', vat=vat) deployment.deploy_collateral(collateral, debt_ceiling=Wad.from_number(100000), penalty=Ray.from_number(1), flop_lot=Wad.from_number(10000), ratio=Ray.from_number(1.5), initial_price=Wad.from_number(219)) return deployment