コード例 #1
0
    def test_execute_at(self, proxy: DSProxy):
        # given
        proxy_cache = DSProxyCache(proxy.web3, proxy.cache())
        proxy_cache.write(DSProxyFactory.bin).transact()
        new_factory_addr = proxy_cache.read(DSProxyFactory.bin)
        assert new_factory_addr

        # when
        receipt = proxy.execute_at(
            new_factory_addr,
            Calldata.from_signature("build(address)",
                                    [proxy.address.address])).transact()
        assert receipt
        build_event = DSProxyFactory.log_created(receipt)[0]

        # then
        assert build_event.owner == proxy.address
コード例 #2
0
ファイル: dsr.py プロジェクト: sneakrcredlabs/pymaker
    def exit_all(self, proxy: DSProxy) -> Transact:
        assert (isinstance(proxy, DSProxy))

        return proxy.execute_at(
            self.mcd.dss_proxy_actions.address,
            Calldata.from_signature("exitAll(address,address)", [
                self.mcd.dai_adapter.address.address,
                self.mcd.pot.address.address
            ]))
コード例 #3
0
    def test_call_at(self, proxy: DSProxy):
        # given
        proxy_cache = DSProxyCache(proxy.web3, proxy.cache())
        proxy_cache.write(DSProxyFactory.bin).transact()
        new_factory_addr = proxy_cache.read(DSProxyFactory.bin)
        receipt = proxy.execute_at(
            new_factory_addr,
            Calldata.from_signature("build(address)",
                                    [proxy.address.address])).transact()
        log_created: LogCreated = DSProxyFactory.log_created(receipt)[0]

        # when
        calldata = Calldata.from_signature("isProxy(address)",
                                           [log_created.proxy.address])
        response = proxy.call_at(new_factory_addr, calldata)

        # then
        assert Web3.toInt(response) == 1
コード例 #4
0
    def test_call(self, proxy: DSProxy):
        # when
        calldata = Calldata.from_signature("isProxy(address)",
                                           [Address(40 * '0').address])
        target, response = proxy.call(DSProxyFactory.bin, calldata)

        # then
        assert target != Address(40 * '0')
        assert Web3.toInt(response) == 0
コード例 #5
0
    def test_name_formatting_with_hexstrings(self):
        # given
        proxy_cache = DSProxyCache.deploy(self.web3)
        proxy = DSProxy.deploy(self.web3, proxy_cache.address)

        # when
        transact = proxy.execute("0x11223344", Calldata("0x55667788"))

        # then
        assert transact.name() == f"DSProxy('{proxy.address}').execute(bytes,bytes)('0x11223344', '0x55667788')"
コード例 #6
0
ファイル: dsr.py プロジェクト: sneakrcredlabs/pymaker
    def exit(self, amount: Wad, proxy: DSProxy) -> Transact:
        assert (isinstance(amount, Wad))
        assert (isinstance(proxy, DSProxy))

        return proxy.execute_at(
            self.mcd.dss_proxy_actions.address,
            Calldata.from_signature("exit(address,address,uint256)", [
                self.mcd.dai_adapter.address.address,
                self.mcd.pot.address.address, amount.value
            ]))
コード例 #7
0
 def get_proxy(self) -> DSProxy:
     return DSProxy(self.mcd.web3,
                    Address(self.mcd.proxy_registry.proxies(self.owner)))
コード例 #8
0
def proxy(web3, proxy_cache):
    return DSProxy.deploy(web3=web3, cache=proxy_cache.address)
コード例 #9
0
 def test_execute(self, proxy: DSProxy):
     assert proxy.execute(DSProxyFactory.bin,
                          Calldata.from_signature("build()",
                                                  [])).transact()