### Setup Differential Testing Environment Source: https://github.com/hypercerts-org/hypercerts/blob/main/contracts/lib/murky/differential_testing/README.md Install dependencies and compile the project from the scripts directory. ```sh npm install npm run compile ``` -------------------------------- ### Install PRBTest with Foundry Source: https://github.com/hypercerts-org/hypercerts/blob/main/contracts/lib/prb-test/README.md Install the library using the forge CLI. ```sh forge install --no-commit paulrberg/prb-test@0.3.0 ``` -------------------------------- ### Install Hypercert SDK Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/sdk/index.md Install the Hypercert SDK using npm or yarn. ```bash npm install @hypercerts-org/sdk ``` ```bash yarn add @hypercerts-org/sdk ``` -------------------------------- ### Deployment Configuration Example Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/config.md Example JSON structure for defining deployment constants including contract addresses and subgraph URLs. ```json { "11155111": { "addresses": { "HypercertMinterUUPS": "0x1234567890abcdef1234567890abcdef12345678", "TransferManager": "0x1234567890abcdef1234567890abcdef12345678", "...": "...", "StrategyHypercertFractionOffer": "0x1234567890abcdef1234567890abcdef12345678" }, "graphName": "hypercerts-sepola", "graphUrl": "https://api.thegraph.com/subgraphs/name/hypercerts-admin/hypercerts-sepolia" } } ``` -------------------------------- ### Project Configuration Example Source: https://github.com/hypercerts-org/hypercerts/blob/main/utils/gitcoin/gitcoin-alpha/README.md Example JSON structure for configuring projects, including title, address, and round details. Ensure this matches the format expected by the scripts. ```json { "title": "Otterscan", "address": "0xb7081Fd06E7039D198D10A8b72B824e60C1B1E16", "roundId": "0xe575282b376e3c9886779a841a2510f1dd8c2ce4", "roundName": "Ethereum Infrastructure" }, { "title": "BuidlGuidl", "address": "0x97843608a00e2bbc75ab0c1911387e002565dede", "roundId": "0xe575282b376e3c9886779a841a2510f1dd8c2ce4", "roundName": "Ethereum Infrastructure" } ``` -------------------------------- ### Install project dependencies Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/devops/setup.md Install all necessary dependencies for the monorepo workspace. ```bash yarn install ``` -------------------------------- ### Build the project Source: https://github.com/hypercerts-org/hypercerts/blob/main/README.md Install dependencies and build all applications using Turbo. ```bash yarn install yarn build ``` -------------------------------- ### Install Observable Runtime Dependencies Source: https://github.com/hypercerts-org/hypercerts/blob/main/vendor/observabletreemap/README.md Install the runtime and the specific notebook module via npm. ```sh npm install @observablehq/runtime@5 npm install https://api.observablehq.com/d/c857fa5c110524ee@515.tgz?v=3 ``` -------------------------------- ### Install PRBTest with Node.js Source: https://github.com/hypercerts-org/hypercerts/blob/main/contracts/lib/prb-test/README.md Install the package using yarn or npm. ```sh yarn add @prb/test # or npm install @prb/test ``` -------------------------------- ### Install Forge Standard Library Source: https://github.com/hypercerts-org/hypercerts/blob/main/contracts/lib/forge-std/README.md Use this command to install the forge-std library into your project. ```bash forge install foundry-rs/forge-std ``` -------------------------------- ### Example Hypercert Metadata with Minimal Bounds Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/implementation/metadata.md This example demonstrates the structure of Hypercert metadata with minimal bounds for work on IPFS, including all required dimensions. ```json "hypercert": { "work_scope": { "name": "Work Scope", "value": ["IPFS"], "excludes": [], "display_value": "IPFS" }, "impact_scope": { "name": "Impact Scope", "value": ["All"], "excludes": [], "display_value": "All" }, "work_timeframe": { "name": "Work Timeframe", "value": [1380585600, 1388534399], "display_value": "2013-10-01 -> 2013-12-31" }, "impact_timeframe": { "name": "Impact Timeframe", "value": [1380585600, 0], "display_value": "2013-10-01 -> Indefinite" }, "contributors": { "name": "Contributors", "value": ["Protocol Labs"], "display_value": "Protocol Labs" }, "rights": { "name": "Rights", "value": ["Public Display"], "display_value": "Public Display" } } ``` -------------------------------- ### Install OpenZeppelin Contracts Source: https://github.com/hypercerts-org/hypercerts/blob/main/contracts/lib/murky/lib/openzeppelin-contracts/README.md Install the OpenZeppelin Contracts library using npm. This command fetches the latest stable version of the library. ```console npm install @openzeppelin/contracts ``` -------------------------------- ### Install Upgradeable Contracts Package Source: https://github.com/hypercerts-org/hypercerts/blob/main/contracts/lib/murky/lib/openzeppelin-contracts/docs/modules/ROOT/pages/upgradeable.adoc Install the required OpenZeppelin upgradeable contracts package via npm. ```console $ npm install @openzeppelin/contracts-upgradeable ``` -------------------------------- ### Install Node.js Dependencies Source: https://github.com/hypercerts-org/hypercerts/blob/main/contracts/lib/prb-test/README.md Run this command inside the project directory to install required Node.js dependencies. ```sh $ yarn install ``` -------------------------------- ### Install Yarn globally Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/devops/setup.md Use this command to install the Yarn package manager globally on your system. ```sh npm install --global yarn ``` -------------------------------- ### Indexer - React Query Example Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/querying.md An example of using the `useHypercertClient` hook with `react-query` to fetch fractions by owner. ```APIDOC ## Indexer - React Query Example ### Description This example demonstrates how to use the `useHypercertClient` hook in conjunction with `react-query` to frequently fetch and update a user's Hypercert fractions based on their owner address. ### Usage ```js import { useHypercertClient } from "./hypercerts-client"; import { useQuery } from "@tanstack/react-query"; export const useFractionsByOwner = (owner: `0x${string}`) => { const { client: { indexer } } = useHypercertClient(); return useQuery( ["hypercerts", "fractions", "owner", owner], () => indexer.fractionsByOwner(owner), { enabled: !!owner, refetchInterval: 5000 }, ); }; ``` ### Dependencies - `@tanstack/react-query` - `hypercerts-client` (local module assumed) ``` -------------------------------- ### Install OpenZeppelin Contracts v2.5 Source: https://github.com/hypercerts-org/hypercerts/blob/main/contracts/lib/murky/lib/openzeppelin-contracts/docs/modules/ROOT/pages/drafts.adoc Use this command to install version 2.5 of OpenZeppelin Contracts if you need to work with removed draft contracts. ```console $ npm install @openzeppelin/contracts@v2.5 ``` -------------------------------- ### Install Hypercerts SDK Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/quickstart-javascript.md Use npm or yarn to add the SDK to your project dependencies. ```bash npm install @hypercerts-org/sdk # OR yarn add @hypercerts-org/sdk ``` -------------------------------- ### Watch Contract Event Example Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/sdk/modules.md Watches for 'Transfer' events on a specified contract address and logs them. This example requires importing necessary Viem functions and defining the contract's ABI. ```typescript import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = client.watchContractEvent({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['event Transfer(address indexed from, address indexed to, uint256 value)']), eventName: 'Transfer', args: { from: '0xc961145a54C96E3aE9bAA048c4F4D6b04C13916b', }, onLogs: (logs) => console.log(logs), }) ``` -------------------------------- ### Start Local Development Server Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/README.md Initializes dependencies and launches a live-reloading development server. ```bash $ yarn $ yarn start ``` -------------------------------- ### Get Block Number with Viem Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/sdk/classes/HypercertClient.md Use this to retrieve the most recent block number on the Ethereum mainnet. Ensure you have `viem` installed and configured with a chain and transport. ```typescript import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const blockNumber = await client.getBlockNumber() // 69420n ``` -------------------------------- ### Get Chain ID with Viem Client Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/sdk/modules.md Use this to retrieve the chain ID of the current network. Ensure you have the Viem library installed and a client instance configured. ```typescript import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const chainId = await client.getChainId() // 1 ``` -------------------------------- ### Initialize client and fetch balance Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/sdk/classes/HypercertClient.md Shows the setup of a public client and the retrieval of an address balance in wei. ```typescript import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const balance = await client.getBalance({ address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', }) // 10000000000000000000000n (wei) ``` -------------------------------- ### Get Contract Bytecode with Viem Client Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/sdk/modules.md Use `client.getBytecode` to retrieve the bytecode at a specific address. Ensure you have the viem library installed and configured with a chain and transport. ```typescript import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const code = await client.getBytecode({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', }) ``` -------------------------------- ### Initiate Ownership Transfer Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/contracts/marketplace/CurrencyManager.md Starts the process to transfer ownership to a new address. ```solidity function initiateOwnershipTransfer(address newPotentialOwner) external nonpayable ``` -------------------------------- ### Initialize and Use Merkle Contract in Solidity Source: https://github.com/hypercerts-org/hypercerts/blob/main/contracts/lib/murky/README.md Demonstrates how to initialize the Merkle contract, prepare toy data, generate a Merkle root, create a proof for a specific element, and verify the proof. Ensure the Merkle contract is deployed before use. ```Solidity Merkle m = new Merkle(); bytes32[] memory data = new bytes32[](4); data[0] = bytes32("0x0"); data[1] = bytes32("0x1"); data[2] = bytes32("0x2"); data[3] = bytes32("0x3"); bytes32 root = m.getRoot(data); bytes32[] memory proof = m.getProof(data, 2); bool verified = m.verifyProof(root, proof, data[2]); assertTrue(verified); ``` -------------------------------- ### Get Storage Value from Contract Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/sdk/classes/HypercertClient.md Retrieves the value from a specific storage slot of a contract. Ensure you have the necessary Viem client setup and the correct chain and transport configured. ```typescript import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { getStorageAt } from 'viem/contract' const client = createPublicClient({ chain: mainnet, transport: http(), }) const code = await client.getStorageAt({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', slot: toHex(0), }) ``` -------------------------------- ### Get Account and Storage Proof Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/sdk/classes/HypercertClient.md Use this snippet to retrieve the account and storage values of a specified account, including the Merkle proof. Ensure you have the viem library installed and imported. ```typescript import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const block = await client.getProof({ address: '0x...', storageKeys: ['0x...'], }) ``` -------------------------------- ### Run Development Server Source: https://github.com/hypercerts-org/hypercerts/blob/main/frontend/README.md Starts the Next.js development server. Visit http://localhost:3000/ in your browser. ```bash yarn dev ``` -------------------------------- ### Get Event Logs with Viem Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/sdk/classes/HypercertClient.md Use `getFilterLogs` to retrieve event logs from a created filter. This method is only compatible with event filters. Ensure you have the necessary imports and client setup. ```typescript import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'), }) const logs = await client.getFilterLogs({ filter, }) ``` -------------------------------- ### Start E2E Local Development Infrastructure Source: https://github.com/hypercerts-org/hypercerts/blob/main/README.md Execute this command after configuring your environment variables to launch the complete local development infrastructure, including a localchain, graph, and postgres. ```bash yarn dev:serve-e2e ``` -------------------------------- ### Get ENS Address with Viem Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/sdk/modules.md Use `getEnsAddress` to retrieve the address for a given ENS name. Ensure ENS names are normalized using UTS-46 before passing them to this function. This example requires importing `createPublicClient`, `http`, `mainnet`, and `normalize`. ```typescript import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensAddress = await client.getEnsAddress({ name: normalize('wevm.eth'), }) // '0xd2135CfB216b74109775236E36d4b433F1DF507B' ``` -------------------------------- ### Initialize Zuzualu Retrospective Sponsors Module Source: https://github.com/hypercerts-org/hypercerts/blob/main/vendor/observabletreemap/index.html Initializes the runtime environment and loads the module into the document body. ```javascript import define from "./index.js"; import {Runtime, Library, Inspector} from "./runtime.js"; const runtime = new Runtime(); const main = runtime.module(define, Inspector.into(document.body)); ``` -------------------------------- ### HypercertClient Initialization Source: https://github.com/hypercerts-org/hypercerts/blob/main/sdk/README.md Demonstrates how to initialize the HypercertClient with configuration options. The client can operate in read-only mode if no wallet client is provided. ```APIDOC ## HypercertClient Initialization ### Description Initialize the HypercertClient with necessary configuration. The client can operate in read-only mode if a `walletClient` is not provided. ### Method `new HypercertClient(config: HypercertClientConfig)` ### Parameters #### Request Body - **config** (HypercertClientConfig) - Required - Configuration object for the HypercertClient. - **chain.id** (number) - Required - The chain ID. - **contractAddress** (string) - Optional - The address of the deployed contract. - **graphUrl** (string) - Optional - The URL to the subgraph. - **graphName** (string) - Optional - The name of the subgraph. - **easContractAddress** (string) - Optional - The address of the EAS contract. - **publicClient** (object) - Optional - The PublicClient for reading blockchain data. - **walletClient** (object) - Optional - The WalletClient for signing and sending transactions. - **unsafeForceOverrideConfig** (boolean) - Optional - Boolean to force the use of overridden values. - **readOnly** (boolean) - Optional - Boolean to assert if the client is in read-only mode. - **readOnlyReason** (string) - Optional - Reason for read-only mode. ### Request Example ```javascript import { HypercertClient } from "@hypercerts-org/sdk"; const client = new HypercertClient({ chain: { id: 11155111 }, // required }); ``` ### Response #### Success Response (200) - **HypercertClient** (object) - An instance of the HypercertClient. #### Response Example ```javascript // client object is returned upon successful initialization ``` ``` -------------------------------- ### HypercertClient Initialization Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/querying.md Demonstrates how to initialize the HypercertClient and access its storage, indexer, and contract utility classes. ```APIDOC ## HypercertClient Initialization ### Description Initializes the `HypercertClient` and provides access to utility classes for storage, indexing, and contract interactions. ### Usage ```js const { client: { storage, indexer, contract } } = new HypercertClient({ chain: { id: 11155111 } }); ``` ### Components - **storage**: Utility class for off-chain metadata storage and retrieval on IPFS. - **indexer**: Utility class for indexing and searching Hypercerts via The Graph subgraph. - **contract**: Utility class for interacting with the HypercertMinter smart contract. ``` -------------------------------- ### Initialize Supabase Client in Python Source: https://github.com/hypercerts-org/hypercerts/blob/main/utils/supabase/README.md Requires SUPABASE_URL and SUPABASE_KEY environment variables. Uses the create_client function to establish a connection. ```python url: str = os.environ.get("SUPABASE_URL") key: str = os.environ.get("SUPABASE_KEY") supabase: Client = create_client(url, key) ``` -------------------------------- ### Clone and enter repository Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/devops/setup.md Download the Hypercerts source code and navigate into the project directory. ```bash git clone git@github.com:hypercerts-org/hypercerts.git cd hypercerts ``` -------------------------------- ### Serve the production build Source: https://github.com/hypercerts-org/hypercerts/blob/main/README.md Serve the static files generated from the build process. ```bash yarn serve:build ``` -------------------------------- ### Setup Local Development Environment Variables Source: https://github.com/hypercerts-org/hypercerts/blob/main/README.md Create a .env.local file in the repository root with these variables to configure the local development environment. Ensure all required variables are set. ```dotenv # Required PLASMIC_PROJECT_ID= PLASMIC_PROJECT_API_TOKEN= NEXT_PUBLIC_NFT_STORAGE_TOKEN= NEXT_PUBLIC_WEB3_STORAGE_TOKEN= NEXT_PUBLIC_WALLETCONNECT_ID= # Optional (used to fund an address on the localchain) LOCAL_TESTING_ADDRESS= ``` -------------------------------- ### Example Conventional Commit Message Source: https://github.com/hypercerts-org/hypercerts/blob/main/CONTRIBUTING.md An example of a conventional commit message demonstrating the structure for a feature with a breaking change. ```text feat(api)!: send an email to the customer when a product is shipped * I did this * and that ``` -------------------------------- ### Serve Notebook Locally Source: https://github.com/hypercerts-org/hypercerts/blob/main/vendor/observabletreemap/README.md Use a local web server to view the notebook in a browser. ```sh npx http-server ``` -------------------------------- ### Run Frontend Dev Server Source: https://github.com/hypercerts-org/hypercerts/blob/main/README.md Use this command to start a development server that monitors code and Plasmic changes. ```bash yarn dev:frontend ``` -------------------------------- ### Import HypercertClient Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/sdk/index.md Import the HypercertClient class into your project. ```bash import { HypercertClient } from "@hypercerts-org/sdk"; ``` -------------------------------- ### GET /paused Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/contracts/protocol/HypercertMinter.md Checks if the contract is currently paused. ```APIDOC ## GET /paused ### Description Returns true if the contract is paused, and false otherwise. ### Method GET ### Endpoint /paused ### Response #### Success Response (200) - **_0** (bool) - Returns true if paused, false otherwise. ``` -------------------------------- ### GET /owner Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/contracts/marketplace/executionStrategies/Chainlink/BaseStrategyChainlinkPriceLatency.md Retrieves the address of the current owner. ```APIDOC ## GET /owner ### Description Returns the address of the current owner. ### Method GET ### Response #### Success Response (200) - **_0** (address) - The owner address ``` -------------------------------- ### Build and Deploy Hardhat Contracts Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/devops/deploy-proxy.md Execute these commands in the contracts/ directory to build the smart contracts and deploy them to a specified network. Replace NETWORK with your target network name. ```sh # Run in contracts/ yarn build:hardhat yarn hardhat deploy --network NETWORK ``` -------------------------------- ### GET /status Source: https://github.com/hypercerts-org/hypercerts/blob/main/contracts/lib/openzeppelin-contracts-upgradeable/contracts/governance/README.adoc Query the status of an operation by its ID. ```APIDOC ## GET /isOperationPending ### Description Checks if an operation is in the Pending state. ### Parameters #### Query Parameters - **id** (bytes32) - Required - The operation ID. ## GET /isOperationReady ### Description Checks if an operation is in the Ready state. ### Parameters #### Query Parameters - **id** (bytes32) - Required - The operation ID. ## GET /isOperationDone ### Description Checks if an operation is in the Done state. ### Parameters #### Query Parameters - **id** (bytes32) - Required - The operation ID. ``` -------------------------------- ### Initialize Selenium Web Scraper Source: https://github.com/hypercerts-org/hypercerts/blob/main/utils/optimism/Optimism Retro PGF - Round 2.ipynb Sets up a headless Chrome driver with specific options and service management for automated browsing. ```python import json from selenium import webdriver from selenium.webdriver import Chrome from selenium.webdriver.chrome.service import Service from selenium.webdriver.common.by import By import time from webdriver_manager.chrome import ChromeDriverManager # initialize a headless web scraper options = webdriver.ChromeOptions() options.headless = True options.page_load_strategy = 'none' chrome_path = ChromeDriverManager().install() chrome_service = Service(chrome_path) driver = Chrome(options=options, service=chrome_service) driver.implicitly_wait(5) # local path names LINKS_PATH = 'links.txt' DATA_PATH = 'optimism/data/projects/' # module for extracting fields from a given project page def extract_fields(link): driver.get(link) content = driver.find_element(By.CSS_SELECTOR, "div[class^='_content'") project = content.find_element(By.CSS_SELECTOR, "h1[class^='_header'").text socials = [s.get_property("href") for s in content.find_elements(By.CSS_SELECTOR, "a[class^='_socialLink'")] responses = content.find_elements(By.TAG_NAME, "section") description = responses[0].find_element(By.TAG_NAME, "p").text category = responses[1].find_element(By.CSS_SELECTOR, "span[class^='_label'").text address = content.find_element(By.CSS_SELECTOR, "div[class^=_addressWrapper'").text p_grabber = lambda r: "\n".join([t.text for t in r.find_elements(By.TAG_NAME, "p")]) logo = driver.find_element(By.CSS_SELECTOR, "img[class^='_image'").get_property("src") try: banner = (driver .find_element(By.CSS_SELECTOR, "div[class^='_banner'") .find_element(By.TAG_NAME, "img").get_property("src")) except: banner = None return { 'project': project, 'socials': socials, 'description': description, 'category': category, 'public_goods': p_grabber(responses[2]), 'sustainability': p_grabber(responses[3]), 'team_size': p_grabber(responses[4]), 'address': address, 'banner': banner, 'logo': logo } # process each link and store the data def process_url(link): result = extract_fields(link) result.update({'project_link': link}) result.update({'project_pathname': link.split("/")[-1]}) j = json.dumps(result, indent=4) outpath = f"{DATA_PATH}{result['project_pathname']}.json" with open(outpath, "w") as outfile: outfile.write(j) return result # read and process all links def scrape_all_projects(): with open(LINKS_PATH, 'r') as txt_file: links = [f.strip() for f in txt_file.readlines()] for project_url in links: #time.sleep(2) try: result = process_url(project_url) print("✅ Scraped: ", result['project']) except: print("❌ Error:", project_url) scrape_all_projects() driver.quit() ``` -------------------------------- ### Impersonate and fund addresses with hoax Source: https://github.com/hypercerts-org/hypercerts/blob/main/contracts/lib/forge-std/README.md Demonstrates using hoax and startHoax to set the caller address and provide initial ETH balance for testing. ```solidity // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "forge-std/Test.sol"; // Inherit the stdCheats contract StdCheatsTest is Test { Bar test; function setUp() public { test = new Bar(); } function testHoax() public { // we call `hoax`, which gives the target address // eth and then calls `prank` hoax(address(1337)); test.bar{value: 100}(address(1337)); // overloaded to allow you to specify how much eth to // initialize the address with hoax(address(1337), 1); test.bar{value: 1}(address(1337)); } function testStartHoax() public { // we call `startHoax`, which gives the target address // eth and then calls `startPrank` // // it is also overloaded so that you can specify an eth amount startHoax(address(1337)); test.bar{value: 100}(address(1337)); test.bar{value: 100}(address(1337)); vm.stopPrank(); test.bar(address(this)); } } contract Bar { function bar(address expectedSender) public payable { require(msg.sender == expectedSender, "!prank"); } } ``` -------------------------------- ### GET /getContractConfig Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/sdk/classes/HypercertClient.md Retrieves the current configuration of the Hypercert contract. ```APIDOC ## GET /getContractConfig ### Description Retrieves the current configuration of the Hypercert contract. ### Method GET ### Endpoint /getContractConfig ### Parameters None ### Request Example None ### Response #### Success Response (200) - **contractConfig** (Object) - An object containing the contract configuration details. #### Response Example ```json { "contractConfig": { "address": "0x...", "chainId": 1 } } ``` ``` -------------------------------- ### GET /getBytecode Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/sdk/classes/HypercertClient.md Retrieves the bytecode at a specified contract address. ```APIDOC ## getBytecode ### Description Retrieves the bytecode at a specific contract address. ### Method JSON-RPC: eth_getCode ### Parameters #### Request Body - **address** (string) - Required - The contract address to retrieve bytecode from. ### Request Example { "address": "0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2" } ### Response #### Success Response (200) - **code** (string) - The bytecode of the contract at the provided address. ### Example ```ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const code = await client.getBytecode({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', }) ``` ``` -------------------------------- ### GET /unitsOf Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/contracts/protocol/HypercertMinter.md Retrieves the units of a token for an account or globally. ```APIDOC ## GET /unitsOf ### Description Returns the units associated with a token ID, optionally filtered by account. ### Method GET ### Endpoint /unitsOf ### Parameters #### Query Parameters - **account** (address) - Optional - **tokenID** (uint256) - Required ### Response #### Success Response (200) - **units** (uint256) - The number of units. ``` -------------------------------- ### Serialize project and hypercert data Source: https://github.com/hypercerts-org/hypercerts/blob/main/utils/gitcoin/gitcoin-alpha/README.md Execute these scripts in sequence to prepare the canonical project data file. ```bash python serialize_project_data.py python serialize_address_data.py python serialize_hypercert_data.py ``` -------------------------------- ### GET /royaltyFeeLimit Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/contracts/marketplace/libraries/RoyaltyFeeRegistry.md Returns the current royalty fee limit. ```APIDOC ## GET /royaltyFeeLimit ### Description Returns the current royalty fee limit. ### Method GET ### Endpoint /royaltyFeeLimit ### Response #### Success Response (200) - **_0** (uint256) - undefined ``` -------------------------------- ### GET transferManager Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/contracts/marketplace/helpers/OrderValidatorV2A.md Retrieves the address of the current TransferManager contract. ```APIDOC ## GET transferManager ### Description Returns the address of the TransferManager contract associated with the Hypercerts contract. ### Method GET ### Endpoint transferManager ### Response #### Success Response (200) - **_0** (contract TransferManager) - The address of the TransferManager contract. ``` -------------------------------- ### Sign Transaction with Account Hoisting Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/sdk/modules.md This example demonstrates signing a transaction when the account is provided during wallet client creation using private key hoisting. Requires importing privateKeyToAccount. ```typescript // Account Hoisting import { createWalletClient, custom } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, }) const signature = await client.signTransaction(request) ``` -------------------------------- ### GET isCurrencyAllowed Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/contracts/marketplace/StrategyManager.md Checks if a specific currency is allowed for transactions. ```APIDOC ## GET isCurrencyAllowed ### Description Checks whether the currency is allowed for transacting. ### Method GET ### Parameters #### Query Parameters - **currency** (address) - Required - The currency address ### Response #### Success Response (200) - **isAllowed** (bool) ``` -------------------------------- ### Create a Hypercert with a Distribution Allowlist Source: https://context7.com/hypercerts-org/hypercerts/llms.txt Mint a hypercert and simultaneously create a Merkle tree-based allowlist for specific addresses to claim fractions. The sum of units in the allowlist must equal the total units of the hypercert. The Merkle tree is automatically generated and stored on IPFS. ```typescript import { HypercertClient, TransferRestrictions, formatHypercertData } from "@hypercerts-org/sdk"; const client = new HypercertClient({ chain: { id: 11155111 }, walletClient }); // Define allowlist entries with addresses and their allocated units const allowList = [ { address: "0xContributor1Address...", units: 3000n }, { address: "0xContributor2Address...", units: 2000n }, { address: "0xContributor3Address...", units: 2500n }, { address: "0xContributor4Address...", units: 2500n }, ]; // Total units must match sum of allowlist units const totalUnits = 10000n; // 3000 + 2000 + 2500 + 2500 = 10000 const { data: metadata } = formatHypercertData({ name: "Community Grant Distribution", description: "Grant funding for ecosystem development", image: "ipfs://QmGrantImage", version: "1.0", impactScope: ["Ecosystem Growth"], excludedImpactScope: [], workScope: ["Development", "Documentation"], excludedWorkScope: [], workTimeframeStart: 1704067200, workTimeframeEnd: 1735689600, impactTimeframeStart: 1704067200, impactTimeframeEnd: 0, contributors: allowList.map(e => e.address), rights: ["Public Display"], excludedRights: [], }); // Create hypercert with allowlist // The merkle tree is automatically generated and stored on IPFS const txHash = await client.createAllowlist( allowList, metadata, totalUnits, TransferRestrictions.FromCreatorOnly, ); console.log("Allowlist hypercert created:", txHash); // Allowlist entries can now claim their fractions using mintClaimFractionFromAllowlist ``` -------------------------------- ### GET strategyInfo Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/contracts/marketplace/StrategyManager.md Retrieves the information for a specific strategy by its ID. ```APIDOC ## GET strategyInfo ### Description Returns the strategy information for a given strategy ID. ### Method GET ### Parameters #### Query Parameters - **id** (uint256) - Required - The strategy ID ### Response #### Success Response (200) - **isActive** (bool) - **standardProtocolFeeBp** (uint16) - **minTotalFeeBp** (uint16) - **maxProtocolFeeBp** (uint16) - **selector** (bytes4) - **isMakerBid** (bool) - **implementation** (address) ``` -------------------------------- ### Constructor: new HypercertClient Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/sdk/classes/HypercertClient.md Initializes a new instance of the HypercertClient class using the provided configuration options. ```APIDOC ## Constructor: new HypercertClient ### Description Creates a new instance of the HypercertClient class. This client encapsulates logic for storage, evaluation, indexing, and wallet interactions. ### Parameters #### Request Body - **config** (Partial) - Required - The configuration options for the client, including chain information. ### Request Example ```ts const config: Partial = { chain: { id: 11155111 }, }; const client = new HypercertClient(config); ``` ### Response #### Success Response - **client** (HypercertClient) - An instance of the HypercertClient class. ### Errors - **ClientError** - Thrown if the public client cannot be connected. ``` -------------------------------- ### GET royaltyFeeRegistry Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/contracts/marketplace/CreatorFeeManagerWithRebates.md Retrieves the interface for the royalty fee registry. ```APIDOC ## GET royaltyFeeRegistry ### Description Returns the royalty fee registry interface. ### Method GET ### Response #### Success Response (200) - **_0** (contract) - Royalty fee registry interface. ``` -------------------------------- ### Solidity Upgradeable1155 Initialization Sequence Source: https://github.com/hypercerts-org/hypercerts/blob/main/contracts/audits/protocol/20230201-7naly3er.md Demonstrates the initialization sequence for `Upgradeable1155.sol`. It includes calls to various `_init` functions for ERC1155, Burnable, URIStorage, Ownable, and UUPSUpgradeable functionalities. ```solidity function __Upgradeable1155_init() public virtual onlyInitializing { __ERC1155_init(""); __ERC1155Burnable_init(); __ERC1155URIStorage_init(); __Ownable_init(); __UUPSUpgradeable_init(); ``` -------------------------------- ### GET publicClient.getGasPrice Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/sdk/modules.md Retrieves the current gas price in wei from the blockchain. ```APIDOC ## GET publicClient.getGasPrice ### Description Returns the current price of gas in wei. ### Method GET ### Endpoint eth_gasPrice ### Request Example ```ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gasPrice = await client.getGasPrice() ``` ### Response #### Success Response (200) - **gasPrice** (bigint) - The current gas price in wei. ``` -------------------------------- ### Client Creation Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/sdk/classes/HypercertClient.md This section details the parameters required for creating a new client, including its name and associated metadata. ```APIDOC ## POST /api/clients ### Description Creates a new client with the provided name and metadata. ### Method POST ### Endpoint /api/clients ### Parameters #### Request Body - **name** (string) - Required - A name for the client. - **metadata** (object) - Optional - Additional metadata for the client. ``` -------------------------------- ### GET publicClient.getChainId Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/sdk/modules.md Retrieves the chain ID associated with the current network. ```APIDOC ## GET publicClient.getChainId ### Description Returns the chain ID associated with the current network. ### Method GET ### Request Example ```ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const chainId = await client.getChainId() // 1 ``` ### Response - **chainId** (number) - The chain ID of the current network. ``` -------------------------------- ### Build Contracts with Foundry Source: https://github.com/hypercerts-org/hypercerts/blob/main/contracts/README.md Use this command to compile your Solidity contracts using Foundry. Ensure Foundry is installed and configured in your project. ```sh forge build ``` -------------------------------- ### POST /execute Source: https://github.com/hypercerts-org/hypercerts/blob/main/contracts/lib/openzeppelin-contracts-upgradeable/contracts/governance/README.adoc Executes a ready operation, moving it to the Done state. ```APIDOC ## POST /execute ### Description Triggers the underlying transactions of a ready operation. ### Method POST ### Parameters #### Request Body - **target** (address) - Required - The address of the smart contract to operate on. - **value** (uint256) - Required - The amount of wei to send. - **data** (bytes) - Required - The encoded function data. - **predecessor** (bytes32) - Required - The ID of the required preceding operation. - **salt** (bytes32) - Required - The salt used during scheduling. ``` -------------------------------- ### GET client.getGasPrice Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/sdk/modules.md Retrieves the current gas price in wei from the blockchain. ```APIDOC ## GET client.getGasPrice ### Description Returns the current price of gas (in wei) from the network. ### Method GET ### Endpoint client.getGasPrice() ### Request Example ```ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gasPrice = await client.getGasPrice() ``` ### Response #### Success Response (200) - **gasPrice** (bigint) - The current gas price in wei. ``` -------------------------------- ### GET /getCleanedOverrides Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/sdk/classes/HypercertClient.md Cleans and prepares override parameters for contract calls. ```APIDOC ## GET /getCleanedOverrides ### Description Cleans and prepares override parameters for contract calls. ### Method GET ### Endpoint /getCleanedOverrides ### Parameters #### Path Parameters None #### Query Parameters - **overrides** (SupportedOverrides) - Optional - The override parameters to clean. #### Request Body None ### Request Example ```json { "overrides": { "gasLimit": 100000 } } ``` ### Response #### Success Response (200) - **cleanedOverrides** (Object) - The cleaned override parameters. #### Response Example ```json { "cleanedOverrides": { "gasLimit": 100000 } } ``` ``` -------------------------------- ### Request Wallet Addresses with viem Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/sdk/classes/HypercertClient.md Use `client.requestAddresses()` to prompt the user to connect their wallet and return a list of their accounts. Ensure `window.ethereum` is available and the wallet client is configured with the correct chain and transport. ```typescript import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const accounts = await client.requestAddresses() ``` -------------------------------- ### Build and Deploy Subgraph Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/devops/deploy-proxy.md Run these commands in the graph/ directory to build the subgraph and deploy it to the test network. Ensure you have configured the network in networks.json. ```sh # Run in graph/ yarn build yarn deploy:test ``` -------------------------------- ### GET getGasPrice Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/sdk/classes/HypercertClient.md Retrieves the current gas price in wei from the blockchain. ```APIDOC ## GET getGasPrice ### Description Returns the current price of gas in wei. ### Method GET ### Endpoint getGasPrice() ### Response - **gasPrice** (bigint) - The current gas price in wei. ### Request Example ```ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gasPrice = await client.getGasPrice() ``` ``` -------------------------------- ### Test Storage Layouts with stdStorage Source: https://github.com/hypercerts-org/hypercerts/blob/main/contracts/lib/forge-std/README.md Demonstrates how to find and write to storage slots, including mappings, structs, and assembly-based locations. ```solidity import "forge-std/Test.sol"; contract TestContract is Test { using stdStorage for StdStorage; Storage test; function setUp() public { test = new Storage(); } function testFindExists() public { // Lets say we want to find the slot for the public // variable `exists`. We just pass in the function selector // to the `find` command uint256 slot = stdstore.target(address(test)).sig("exists()").find(); assertEq(slot, 0); } function testWriteExists() public { // Lets say we want to write to the slot for the public // variable `exists`. We just pass in the function selector // to the `checked_write` command stdstore.target(address(test)).sig("exists()").checked_write(100); assertEq(test.exists(), 100); } // It supports arbitrary storage layouts, like assembly based storage locations function testFindHidden() public { // `hidden` is a random hash of a bytes, iteration through slots would // not find it. Our mechanism does // Also, you can use the selector instead of a string uint256 slot = stdstore.target(address(test)).sig(test.hidden.selector).find(); assertEq(slot, uint256(keccak256("my.random.var"))); } // If targeting a mapping, you have to pass in the keys necessary to perform the find // i.e.: function testFindMapping() public { uint256 slot = stdstore .target(address(test)) .sig(test.map_addr.selector) .with_key(address(this)) .find(); // in the `Storage` constructor, we wrote that this address' value was 1 in the map // so when we load the slot, we expect it to be 1 assertEq(uint(vm.load(address(test), bytes32(slot))), 1); } // If the target is a struct, you can specify the field depth: function testFindStruct() public { // NOTE: see the depth parameter - 0 means 0th field, 1 means 1st field, etc. uint256 slot_for_a_field = stdstore .target(address(test)) .sig(test.basicStruct.selector) .depth(0) .find(); uint256 slot_for_b_field = stdstore .target(address(test)) .sig(test.basicStruct.selector) .depth(1) .find(); assertEq(uint(vm.load(address(test), bytes32(slot_for_a_field))), 1); assertEq(uint(vm.load(address(test), bytes32(slot_for_b_field))), 2); } } // A complex storage contract contract Storage { struct UnpackedStruct { uint256 a; uint256 b; } constructor() { map_addr[msg.sender] = 1; } uint256 public exists = 1; mapping(address => uint256) public map_addr; // mapping(address => Packed) public map_packed; mapping(address => UnpackedStruct) public map_struct; mapping(address => mapping(address => uint256)) public deep_map; mapping(address => mapping(address => UnpackedStruct)) public deep_map_struct; UnpackedStruct public basicStruct = UnpackedStruct({ a: 1, b: 2 }); function hidden() public view returns (bytes32 t) { // an extremely hidden storage slot bytes32 slot = keccak256("my.random.var"); assembly { t := sload(slot) } } } ``` -------------------------------- ### GET /getBlockNumber Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/sdk/classes/HypercertClient.md Retrieves the number of the most recent block seen by the client. ```APIDOC ## GET getBlockNumber ### Description Returns the number of the most recent block seen. ### Method GET ### Parameters #### Request Body - **args** (GetBlockNumberParameters) - Optional - Configuration parameters for the request. ### Request Example ```ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const blockNumber = await client.getBlockNumber() // 69420n ``` ### Response #### Success Response (200) - **blockNumber** (bigint) - The current block number. ``` -------------------------------- ### GET /readTransferRestriction Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/contracts/protocol/HypercertMinter.md Reads the transfer restriction for a specific token ID. ```APIDOC ## GET /readTransferRestriction ### Description Retrieves the transfer restriction string for a given token. ### Method GET ### Endpoint /readTransferRestriction ### Parameters #### Query Parameters - **tokenID** (uint256) - Required - The ID of the token to check. ### Response #### Success Response (200) - **_0** (string) - The transfer restriction status. ``` -------------------------------- ### Initialize HypercertClient Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/quickstart-javascript.md Create a new instance of HypercertClient by providing a chain ID and a wallet client. Ensure the wallet client is configured with a valid JSON-RPC provider. ```js import { HypercertClient } from "@hypercerts-org/sdk"; import { createWalletClient, custom } from "viem"; import { mainnet } from "viem/chains"; const walletClient = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }); // NOTE: you should replace this with your own JSON-RPC provider to the network // This should have signing abilities and match the `chainId` passed into HypercertClient const client = new HypercertClient({ chainId: 11155111, // Sepolia testnet walletClient, }); ``` -------------------------------- ### GET /userSubsetNonce Source: https://github.com/hypercerts-org/hypercerts/blob/main/docs/docs/developer/api/contracts/marketplace/TransferSelectorNFT.md Checks whether the subset nonce for a user was cancelled. ```APIDOC ## GET /userSubsetNonce ### Description Checks whether the subset nonce for a user was cancelled. ### Method GET ### Endpoint /userSubsetNonce ### Parameters #### Query Parameters - **userAddress** (address) - Required - The address of the user - **subsetNonceId** (uint256) - Required - The ID of the subset nonce ### Response #### Success Response (200) - **isCancelled** (bool) - Whether the subset nonce was cancelled #### Response Example ```json { "isCancelled": false } ``` ```