Skip to content

Instantly share code, notes, and snippets.

@yudetamago
Created December 17, 2018 06:29
Show Gist options
  • Save yudetamago/bfc781e9f19036d58393b7c0090b1deb to your computer and use it in GitHub Desktop.
Save yudetamago/bfc781e9f19036d58393b7c0090b1deb to your computer and use it in GitHub Desktop.
vyper delegatecall
a: public(int128)
b: public(address)
@public
def execute(_to: address, _data: bytes[4096]):
raw_call(
_to,
_data,
gas=msg.gas,
outsize=0,
delegate_call=True
)
@public
def testFunc(_a: int128, _b:address):
self.a = _a
self.b = _b
@public
@constant
def createCallData(_a: int128, _b:address) -> bytes[68]:
cdata: bytes[68] = concat(method_id("testFuc(int128,address)", bytes[4]), convert(_a, bytes32), convert(_b, bytes32))
return cdata
@yudetamago
Copy link
Author

usage in pseudo code

data = createCallData(1234, "0x0dcd2f752394c41875e259e00bb44fd505297caf")
deployed_addr = ... // the address of this contract
execute(deployed_addr, data)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment