Ejemplo n.º 1
0
    def test_write_invalid(self, proxy_cache: DSProxyCache):
        # when
        address = proxy_cache.write('0x001122').transact()

        # then
        assert address is None
        assert proxy_cache.read('0x001122') == None
Ejemplo n.º 2
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
Ejemplo n.º 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
Ejemplo n.º 4
0
    def test_write(self, proxy_cache: DSProxyCache):
        # when
        proxy_cache.write(DSProxyCache.bin).transact()

        # then
        assert proxy_cache.read(DSProxyCache.bin) is not None
Ejemplo n.º 5
0
 def test_read(self, proxy_cache: DSProxyCache):
     assert proxy_cache.read('0x001122') == None