0

I have a solidity function selector:

bytes4 selector = bytes4(keccak256(bytes("rawFulfillRandomWords(uint256,uint256[])")));

(The selector here is 0x1fe543e3)

And in this function selector, as you can see, we have a dynamic array.

In vyper, I'd like to call this function, but without the dynamic array (a static array).

method_id("rawFulfillRandomWords(uint256,uint256[1])")

(The selector here is 0x4e04d708, which is wrong)

Is this possible?

1
  • Or better yet, is there a way to manually assign a function selector to a function? Aug 2 at 22:00

1 Answer 1

0

You'd use a dynamic array.

A function that looks like:

def rawFulfillRandomWords(requestId: uint256, randomWords: DynArray[uint256, 10]):

Will have a function signature of:

rawFulfillRandomWords(uint256,uint256[])

Dynamic arrays are technically "dynamic" just with a max size - in this case the max size would be 10.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.