peeramid-labs / contracts

Rankify smart contracts
https://rankify.it
5 stars 2 forks source link

Modify Playbooks according to new distribution model #68

Open peersky opened 1 month ago

peersky commented 1 month ago

62 changes the way how we deploy new infrastructure and hence how we lookup for addresses.

It also adds a new functionality, namely: now you can create a new subjects with a whole infrastructure behind (MAO)

Documentation for this already was updated at docs.rankify.it and at #62 readme file.

We need to update same PR with playbook updates:

createGame.ts

Instead of taking a deployment artifacts like this:

      const rankifyDeployment = await deployments.get('Rankify');
      const rankifyInstanceDeployment = await deployments.get('RankifyInstance');

We now must

  1. Get the PeeramidLabsDistributor artifact
  2. Filter this contract for all Instantiated events emitted by IDistributor. Example of similar filtering is here
  3. Choose the instanceId we want to create game at
  4. Parse the correct Rankify and RankifyInstance contract from the instances[] array found in the events. The sequence should be according to this: https://github.com/peeramid-labs/contracts/blob/a8c8579e3ef560d4ac8364ead14db5cdfeef7215/src/distributions/MAODistribution.sol#L270

Add createMAO.ts

It should call PeeramidLabsDistributor to instantiate new subject. Examples of such and helpers available in scripts and test directories as well as in readme.

Add addDistribution.ts

It should add new distribution to the PeeramidLabsDistributor. There is already some boilerplate for doing this available here: https://github.com/peeramid-labs/contracts/blob/a8c8579e3ef560d4ac8364ead14db5cdfeef7215/scripts/playbooks/addDistribution.ts#L18