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

Not diamond compatible? #11

Open
phated opened this issue May 6, 2022 · 2 comments
Open

Not diamond compatible? #11

phated opened this issue May 6, 2022 · 2 comments

Comments

@phated
Copy link

phated commented May 6, 2022

I'm noticing that the Persona contracts all use plain contract storage instead of AppStorage or DiamondStorage. Why aren't these contracts Diamond compatible?

@ludns
Copy link
Member

ludns commented May 9, 2022

Good question!
They are meant to be deployed once per chain, not once per game. They live as independent contracts.
From your Diamond you can simply call the corresponding Persona deployments.

import { PersonaMirror } from 'persona/L2/PersonaMirror.sol';
contract Example {
  PersonaMirror public personaMirror;
  constructor(address _personaMirror) {
    personaMirror = PersonaMirror(_personaMirror);
  }
  function getPersona() internal view returns (uint256) {
    uint256 personaId = personaMirror.getActivePersona(msg.sender, address(this));
    require(personaMirror.isAuthorized(personaId, msg.sender, address(this), msg.sig), 'persona not authorized');
    return personaId;
  }
}

@phated
Copy link
Author

phated commented May 9, 2022

That makes sense! Maybe an example showing usage in a diamond would also be helpful, since the only example uses contract state.

If this is meant to be a deploy-once contract, shouldn't it be a diamond itself so it can be upgraded, expanded, or patched, while still allowing consumers to rely on the exact same contract address forever??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants