예제 #1
0
 def skim(self, ilk: Ilk, address: Address) -> Transact:
     """Cancels undercollateralized CDP debt to determine collateral shortfall"""
     assert isinstance(ilk, Ilk)
     assert isinstance(address, Address)
     return Transact(self, self.web3, self.abi, self.address,
                     self._contract, 'skim',
                     [ilk.toBytes(), address.address])
예제 #2
0
    def open(self, ilk: Ilk, address: Address) -> Transact:
        assert isinstance(ilk, Ilk)
        assert isinstance(address, Address)

        return Transact(self, self.web3, self.abi, self.address,
                        self._contract, 'open',
                        [ilk.toBytes(), address.address])
예제 #3
0
    def deploy(web3: Web3, vat: Address, ilk: Ilk, gem: Address):
        assert isinstance(web3, Web3)
        assert isinstance(vat, Address)
        assert isinstance(ilk, Ilk)
        assert isinstance(gem, Address)

        return GemMock(
            web3=web3,
            address=Contract._deploy(
                web3, GemMock.abi, GemMock.bin,
                [vat.address, ilk.toBytes(), gem.address]))
예제 #4
0
 def cash(self, ilk: Ilk, dai: Wad):
     """Exchange an amount of dai (already `pack`ed in the `bag`) for collateral"""
     assert isinstance(ilk, Ilk)
     assert isinstance(dai, Wad)
     return Transact(self, self.web3, self.abi, self.address, self._contract, 'cash', [ilk.toBytes(), dai.value])
예제 #5
0
 def flow(self, ilk: Ilk) -> Transact:
     """Calculate the `fix`, the cash price for a given collateral"""
     assert isinstance(ilk, Ilk)
     return Transact(self, self.web3, self.abi, self.address, self._contract, 'flow', [ilk.toBytes()])
예제 #6
0
 def free(self, ilk: Ilk) -> Transact:
     """Releases excess collateral after `skim`ming"""
     assert isinstance(ilk, Ilk)
     return Transact(self, self.web3, self.abi, self.address, self._contract, 'free', [ilk.toBytes()])
예제 #7
0
 def skip(self, ilk: Ilk, flip_id: int) -> Transact:
     """Cancel a flip auction and seize it's collateral"""
     assert isinstance(ilk, Ilk)
     assert isinstance(flip_id, int)
     return Transact(self, self.web3, self.abi, self.address, self._contract, 'skip', [ilk.toBytes(), flip_id])
예제 #8
0
 def cage(self, ilk: Ilk) -> Transact:
     """Set the `cage` price for the collateral"""
     assert isinstance(ilk, Ilk)
     return Transact(self, self.web3, self.abi, self.address, self._contract, 'cage(bytes32)', [ilk.toBytes()])
예제 #9
0
 def out(self, ilk: Ilk, address: Address) -> Wad:
     assert isinstance(ilk, Ilk)
     assert isinstance(address, Address)
     return Wad(self._contract.functions.out(ilk.toBytes(), address.address).call())
예제 #10
0
 def fix(self, ilk: Ilk) -> Ray:
     """Final cash price for the collateral"""
     assert isinstance(ilk, Ilk)
     return Ray(self._contract.functions.fix(ilk.toBytes()).call())
예제 #11
0
 def art(self, ilk: Ilk) -> Wad:
     """Total debt for the collateral"""
     assert isinstance(ilk, Ilk)
     return Wad(self._contract.functions.Art(ilk.toBytes()).call())
예제 #12
0
 def gap(self, ilk: Ilk) -> Wad:
     """Collateral shortfall (difference of debt and collateral"""
     assert isinstance(ilk, Ilk)
     return Wad(self._contract.functions.gap(ilk.toBytes()).call())
예제 #13
0
 def tag(self, ilk: Ilk) -> Ray:
     """Cage price for the collateral"""
     assert isinstance(ilk, Ilk)
     return Ray(self._contract.functions.tag(ilk.toBytes()).call())