2024-02-24 20:49:07 +00:00
|
|
|
## Dapp Indexer
|
2024-01-17 02:58:50 +00:00
|
|
|
|
2024-02-24 20:49:07 +00:00
|
|
|
** The Dapp Indexer is a simple smart contract which stores an IPFS CID from a dapp based on a key name**
|
2024-01-17 02:58:50 +00:00
|
|
|
|
2024-02-24 20:49:07 +00:00
|
|
|
The goal is to use this as an alternative for ssl to web3 to verify its the correct content/version/asset.
|
2024-01-17 02:58:50 +00:00
|
|
|
|
2024-02-24 20:49:07 +00:00
|
|
|
## The Dapp Indexer has the following features:
|
2024-01-17 02:58:50 +00:00
|
|
|
|
2024-02-24 20:49:07 +00:00
|
|
|
- [x] Roll management so that it can be integrated into a Dapp or Roles.
|
|
|
|
- [x] Low Gas Consumption
|
|
|
|
- [x] Keep it as simple as posible.
|
|
|
|
|
|
|
|
## ToDo and wanted features:
|
2024-05-09 01:15:25 +00:00
|
|
|
- [ ] Integrate CIDStorage library to the Dapp Indexer smart contract
|
2024-02-24 20:49:07 +00:00
|
|
|
- [ ] Create an event for metadata information about the CID.
|
2024-05-09 01:15:25 +00:00
|
|
|
- [ ] Support of the [CID Specification](https://github.com/multiformats/cid?tab=readme-ov-file)
|
2024-01-17 02:58:50 +00:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
### Build
|
|
|
|
|
|
|
|
```shell
|
|
|
|
$ forge build
|
|
|
|
```
|
|
|
|
|
|
|
|
### Test
|
|
|
|
|
|
|
|
```shell
|
|
|
|
$ forge test
|
|
|
|
```
|
|
|
|
|
|
|
|
### Gas Snapshots
|
|
|
|
|
|
|
|
```shell
|
|
|
|
$ forge snapshot
|
|
|
|
```
|
|
|
|
|
|
|
|
### Anvil
|
|
|
|
|
|
|
|
```shell
|
|
|
|
$ anvil
|
|
|
|
```
|
|
|
|
|
2024-05-09 01:15:25 +00:00
|
|
|
### Enviorment Variables
|
|
|
|
|
|
|
|
|
2024-01-17 02:58:50 +00:00
|
|
|
### Deploy
|
|
|
|
|
2024-05-09 01:15:25 +00:00
|
|
|
#### Option1: Deployment script (recommended)
|
|
|
|
|
|
|
|
```shell
|
|
|
|
$ ./deploy.sh
|
|
|
|
```
|
|
|
|
> IMPORTANT: verify .env information before executing the deployment script
|
|
|
|
|
|
|
|
**verify by attaching the deployed contract test:**
|
|
|
|
|
|
|
|
Once you deployed the contract with the previous script execution you can test
|
|
|
|
the correct smartcontract operations by running the `DeployedDappIndexer.s.sol`
|
|
|
|
script
|
|
|
|
|
|
|
|
should set after deploying the smart contract in the .env named after
|
|
|
|
DAPPINDEXERADDRS, once you update the address you can run the following
|
|
|
|
script to verify it was deployed correctly.
|
|
|
|
|
2024-01-17 02:58:50 +00:00
|
|
|
```shell
|
2024-05-09 01:15:25 +00:00
|
|
|
$source .env
|
|
|
|
$forge script script/DeployedDappIndexer.s.sol:DappIndexerScript --fork-url $PROVIDER_URL --private-key $PK0 --broadcast
|
2024-01-17 02:58:50 +00:00
|
|
|
```
|
2024-05-09 01:15:25 +00:00
|
|
|
#### Option2: Script deployment and test
|
|
|
|
using the script follows diferent verifications first before deploying the
|
|
|
|
contract, more about it here.
|
|
|
|
|
|
|
|
```shell
|
|
|
|
$source .env
|
|
|
|
$forge script script/DappIndexer.s.sol:DappIndexerScript --fork-url $PROVIDER_URL --private-key $PK0 --broadcast
|
|
|
|
```
|
|
|
|
> where:
|
|
|
|
> PROVIDER_URL can be either the anvil fork or a blockchain RPC
|
|
|
|
> $PK0
|
|
|
|
|
2024-01-17 02:58:50 +00:00
|
|
|
|
|
|
|
### Cast
|
|
|
|
|
|
|
|
```shell
|
|
|
|
$ cast <subcommand>
|
|
|
|
```
|
|
|
|
|
|
|
|
### Help
|
|
|
|
|
|
|
|
```shell
|
|
|
|
$ forge --help
|
|
|
|
$ anvil --help
|
|
|
|
$ cast --help
|
|
|
|
```
|