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)
def from_json(web3: Web3, conf: str): conf = json.loads(conf) mom = DSGuard(web3, Address(conf['MCD_MOM'])) vat = Vat(web3, Address(conf['MCD_VAT'])) vow = Vow(web3, Address(conf['MCD_VOW'])) drip = Drip(web3, Address(conf['MCD_DRIP'])) pit = Pit(web3, Address(conf['MCD_PIT'])) cat = Cat(web3, Address(conf['MCD_CAT'])) flap = Flapper(web3, Address(conf['MCD_FLAP'])) flop = Flopper(web3, Address(conf['MCD_FLOP'])) dai = DSToken(web3, Address(conf['MCD_DAI'])) dai_adapter = DaiAdapter(web3, Address(conf['MCD_JOIN_DAI'])) dai_move = DaiVat(web3, Address(conf['MCD_MOVE_DAI'])) mkr = DSToken(web3, Address(conf['MCD_GOV'])) collaterals = [] for name in conf['COLLATERALS']: collateral = Collateral(Ilk(name)) collateral.gem = DSToken(web3, Address(conf[name])) collateral.adapter = GemAdapter(web3, Address(conf[f'MCD_JOIN_{name}'])) collateral.mover = GemVat(web3, Address(conf[f'MCD_MOVE_{name}'])) collateral.flipper = Flipper(web3, Address(conf[f'MCD_FLIP_{name}'])) collateral.pip = DSValue(web3, Address(conf[f'PIP_{name}'])) collateral.spotter = Spotter(web3, Address(conf[f'MCD_SPOT_{name}'])) collaterals.append(collateral) return DssDeployment.Config(mom, vat, vow, drip, pit, cat, flap, flop, dai, dai_adapter, dai_move, mkr, collaterals)