Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for machine initialization #2

Closed
cliffhall opened this issue Mar 5, 2022 · 0 comments · Fixed by #3
Closed

Add support for machine initialization #2

cliffhall opened this issue Mar 5, 2022 · 0 comments · Fixed by #3
Assignees
Labels
enhancement New feature or request

Comments

@cliffhall
Copy link
Owner

Guard logic needs to be able to access and modify a machine-specific storage slot. And that storage slot needs to be initializable at the time the machine is installed.

For instance, in the LockableDoor example, the exit guard for the "Locked" state needs to be able to check if the user has a non-zero balance of an ERC20 "key token". If they do, the transition will be allowed to proceed. Otherwise, the guard reverts with a message about the user needing the key.

In order to make this happen, we need to know the address of the "key token" contract, and we can't hard code it since, the tokens are deployed at the same time as the example. So when the LockableDoor machine is installed in Fismo, we need to be able to make a delegatecall to an initializer contract, passing the address of the token contract.

Later when the guard is invoked, it should be able to fetch the "key token" contract's address from the LockableDoor machine's custom storage slot and call balanceOf on it with the user's address.

@cliffhall cliffhall added the enhancement New feature or request label Mar 5, 2022
@cliffhall cliffhall self-assigned this Mar 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant