Is there any access control for MoveFrom byte code?

I found that the definition of MoveFrom is:

Move the instance of type StructDefinitionIndex, at the address at the top of the stack.

Can I pass an arbitrary address to the stack, then I move his/her resource to my own?

1 Like

yes you could.
Of course with the restriction of MoveFrom which can only be called within the module that defines the resource.
The principle here is that, though that operation may seem excessively permissive, because it is allowed only in the module that defines the resource (the bytecode takes the resource in the instruction payload and so it’s easily verifiable) it must be visible to users of that module up front.
So the safety (so to speak) is in the fact that one can inspect the module and verify operations over the resources are in fact “safe”.

2 Likes