Skip to content

Instantly share code, notes, and snippets.

@PatrickAlphaC
Created August 1, 2022 17:47
Embed
What would you like to do?
Vyper example of making a raw call
# # SPDX-License-Identifier: MIT
# # @version ^0.3.3
# val: public(uint256)
# @external
# def runRawCall(newVal: uint256, myAdd: address):
# # call_data: Bytes[3236] = _abi_encode(requestId, words, method_id=method_id("rawFulfillRandomWords"))
# # call_data: Bytes[68] = concat(method_id("rawFulfillRandomWords"), convert(requestId, bytes32), convert(words, bytes32))
# call_data: Bytes[36] = _abi_encode(newVal, method_id=method_id("funcToCall(uint256)"))
# call_data_2: Bytes[68] = _abi_encode(myAdd, newVal, method_id=method_id("transfer(address,uint256)"))
# response: Bytes[32] = raw_call(self, call_data, max_outsize=32)
# @external
# def funcToCall(newVal: uint256):
# self.val = newVal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment