Skip to content

Commit

Permalink
added sample env and updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
peersky committed Oct 1, 2024
1 parent e773b6d commit bebaee4
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 35 deletions.
76 changes: 41 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,21 @@
pnpm install
```

3. Compile the smart contracts:
3. Setup environment variables

```sh
mkdir .secrets
cp dev.env.sample .secrets/dev.env
vi .secrets/dev.env
```

4. Compile the smart contracts:

```sh
pnpm hardhat compile
```

4. Deploy the smart contracts:
5. Deploy the smart contracts:
```sh
pnpm hardhat deploy --network <network> --tags <tags>
```
Expand Down Expand Up @@ -47,45 +55,44 @@ This deployment will create following infrastructure:
#### How to instantiate

In order to instantiate the MAO distribution, you don't need to deploy a thing. You just need to call the `instantiate` function of the the [PeeramidLabsDistributor.sol](./src/distributors/PeeramidLabsDistributor.sol) contract and specify proper distribution Id and arguments.

```ts
import { MAODistribution } from 'rankify-contracts/types';
import { MAODistribution } from 'rankify-contracts/types';
const distributorArguments: MAODistribution.DistributorArgumentsStruct = {
DAOSEttings: {
daoURI: 'https://example.com/dao',
subdomain: 'example',
metadata: ethers.utils.hexlify(ethers.utils.toUtf8Bytes('metadata')),
tokenName: 'tokenName',
tokenSymbol: 'tokenSymbol',
},
ACIDSettings: {
RankTokenContractURI: 'https://example.com/rank',
gamePrice: 1,
joinGamePrice: 1,
maxPlayersSize: 16,
maxTurns: 1,
metadata: ethers.utils.hexlify(ethers.utils.toUtf8Bytes('metadata')),
minPlayersSize: 4,
paymentToken: rankify.address,
rankTokenURI: 'https://example.com/rank',
timePerTurn: 1,
timeToJoin: 1,
voteCredits: 14,
},
};
DAOSEttings: {
daoURI: 'https://example.com/dao',
subdomain: 'example',
metadata: ethers.utils.hexlify(ethers.utils.toUtf8Bytes('metadata')),
tokenName: 'tokenName',
tokenSymbol: 'tokenSymbol',
},
ACIDSettings: {
RankTokenContractURI: 'https://example.com/rank',
gamePrice: 1,
joinGamePrice: 1,
maxPlayersSize: 16,
maxTurns: 1,
metadata: ethers.utils.hexlify(ethers.utils.toUtf8Bytes('metadata')),
minPlayersSize: 4,
paymentToken: rankify.address,
rankTokenURI: 'https://example.com/rank',
timePerTurn: 1,
timeToJoin: 1,
voteCredits: 14,
},
};
const data = ethers.utils.defaultAbiCoder.encode(
[
'tuple(tuple(string daoURI, string subdomain, bytes metadata, string tokenName, string tokenSymbol) DAOSEttings, tuple(uint256 timePerTurn, uint256 maxPlayersSize, uint256 minPlayersSize, uint256 timeToJoin, uint256 maxTurns, uint256 voteCredits, uint256 gamePrice, address paymentToken, uint256 joinGamePrice, string metadata, string rankTokenURI, string RankTokenContractURI) ACIDSettings)',
],
[distributorArguments],
);
const distributorsDistId = process.env.DISTRIBUTOR_DIST_ID;
const tx = await distributorContract.instantiate(distributorsDistId, data);

[
'tuple(tuple(string daoURI, string subdomain, bytes metadata, string tokenName, string tokenSymbol) DAOSEttings, tuple(uint256 timePerTurn, uint256 maxPlayersSize, uint256 minPlayersSize, uint256 timeToJoin, uint256 maxTurns, uint256 voteCredits, uint256 gamePrice, address paymentToken, uint256 joinGamePrice, string metadata, string rankTokenURI, string RankTokenContractURI) ACIDSettings)',
],
[distributorArguments],
);
const distributorsDistId = process.env.DISTRIBUTOR_DIST_ID;
const tx = await distributorContract.instantiate(distributorsDistId, data);
```

In order to get `distributorsDistId` you can call `getDistributions` at `PeeramidLabsDistributor` contract and look for. We will host a public API to get the list of distributions soon.


### ACID distribution

[ArguableVotingTournament.sol](./src/distributions/ArguableVotingTournament.sol) is used to distribute governance tokens to the participants of the MAO by conducting autonomous competence identification tournaments.
Expand All @@ -100,7 +107,6 @@ This distribution deploys the Diamond Proxy that contains the following facets:

To understand how it works further please refer to [docs.rankify.it](https://docs.rankify.it/governance) or ask us a question in [Discord](https://discord.gg/EddGgGUuWC)


## Contributing

We welcome contributions to improve the Rankify smart contracts. Please fork the repository and submit a pull request.
Expand Down
1 change: 1 addition & 0 deletions dev.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export FORK_RPC_URL=""

0 comments on commit bebaee4

Please sign in to comment.