-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf63eaf
commit 95ef165
Showing
3 changed files
with
43 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,71 @@ | ||
## Foundry | ||
## Trusted Hint Registry | ||
|
||
**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.** | ||
This repository contains a smart contract for a registry of trusted hints used in decentralized ecosystems based on | ||
ERC-7506. It provides a standardized on-chain metadata management system aiding in verification of on- and off-chain | ||
data, like Verifiable Credentials. | ||
|
||
Foundry consists of: | ||
### Key Decisions | ||
|
||
- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools). | ||
- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data. | ||
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network. | ||
- **Chisel**: Fast, utilitarian, and verbose solidity REPL. | ||
|
||
## Documentation | ||
|
||
https://book.getfoundry.sh/ | ||
- Upgradable smart contract using ERC1967 to enable future feature additions and bug fixes. | ||
- General purpose, access-controlled data structure usable by any address for hints. | ||
- Development, testing, and deployment is done via the Foundry toolset. | ||
- The deployments and ABI are provided via an NPM package from this repository. | ||
|
||
## Usage | ||
|
||
### Build | ||
|
||
```shell | ||
$ forge build | ||
forge build | ||
``` | ||
|
||
### Test | ||
|
||
```shell | ||
$ forge test | ||
forge test | ||
``` | ||
|
||
### Format | ||
### Deploy | ||
|
||
```shell | ||
$ forge fmt | ||
forge script DeployProxy --rpc-url <your_rpc_url> --private-key <your_private_key> --etherscan-api-key <your_etherscan_key> --verify --optimize --broadcast | ||
``` | ||
## Usage in other projects | ||
|
||
### Gas Snapshots | ||
### Install | ||
|
||
```shell | ||
$ forge snapshot | ||
npm i @spherity/trusted-hint-registry | ||
``` | ||
|
||
### Anvil | ||
|
||
```shell | ||
$ anvil | ||
``` | ||
### Import | ||
|
||
### Deploy | ||
This package provides separate build for CommonJS and ES modules. You can import it in your project like this: | ||
|
||
```shell | ||
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key> | ||
```typescript | ||
import { TRUSTED_HINT_REGISTRY_ABI, deployments } from "@spherity/trusted-hint-registry" | ||
``` | ||
|
||
### Cast | ||
|
||
```shell | ||
$ cast <subcommand> | ||
``` | ||
|
||
### Help | ||
|
||
```shell | ||
$ forge --help | ||
$ anvil --help | ||
$ cast --help | ||
``` | ||
In combination with, e.g., [viem](https://viem.sh/), you can use it like this: | ||
|
||
```typescript | ||
import { TRUSTED_HINT_REGISTRY_ABI, deployments } from "@spherity/trusted-hint-registry"; | ||
import { getContract } from 'viem' | ||
|
||
const publicClient = createPublicClient({ | ||
chain: sepolia, | ||
transport: http(), | ||
}) | ||
|
||
const sepoliaDeployment = deployments.find(d => d.chainId === 11155111 && d.type === "proxy") | ||
const contract = getContract({ | ||
address: sepoliaDeployment.registry, | ||
abi: TRUSTED_HINT_REGISTRY_ABI, | ||
publicClient, | ||
}) | ||
|
||
const namespace = "0x..." | ||
const list = "0x..." | ||
const key = "0x..." | ||
const hint = await contract.read.getHint(namespace, list, key) | ||
) |
Binary file not shown.
Binary file not shown.