Skip to content

Latest commit

 

History

History
125 lines (95 loc) · 2.82 KB

File metadata and controls

125 lines (95 loc) · 2.82 KB

SimplePage Smart Contracts

This repository contains the smart contracts for SimplePage, built using the Foundry development framework.

Prerequisites

Getting Started

  1. Install dependencies:
forge install
  1. Build the contracts:
make build

Development Commands

The following commands are available through the Makefile:

Testing

Run the test suite:

make test

Code Formatting

Format the Solidity code:

make format

Gas Analysis

Generate gas snapshots:

make snapshot

Deployment

Local Development

Deploy to local network (requires running Anvil):

make deploy-dev <beneficiary_address> <price_feed_address>

Sepolia Testnet

Deploy to Sepolia testnet:

make deploy-sepolia <beneficiary_address> <price_feed_address>

Where

  • beneficiary_address is the address that recieves subscription fees
  • price_feed_address is chainlink ETH/USD price feed (0x694AA1769357215DE4FAC081bf1f309aDC325306)
  • private_key is the private key used for deployment

Mainnet

Deploy to Ethereum mainnet:

make deploy <beneficiary_address> <price_feed_address>

Where

  • beneficiary_address is the address that recieves subscription fees
  • price_feed_address is chainlink ETH/USD price feed ()
  • private_key is the private key used for deployment

Deploy a New TokenRenderer

If SimplePage is already deployed and you only want to ship a new renderer version, deploy the renderer contract separately and then point SimplePage at it.

  1. Build the contracts:
make build
  1. Deploy the new renderer, passing the existing SimplePage address to the constructor:
forge create src/TokenRendererV3.sol:TokenRendererV3 \
  --rpc-url <your_rpc_url> \
  --account simplepage-deploy \
  --broadcast \
  --verify \
  --constructor-args <simple_page_address>

Replace src/TokenRendererV3.sol:TokenRendererV3 with your renderer contract path and name if you are deploying a different version.

  1. Update the live SimplePage contract to use the new renderer. If on mainnet, do it using the simplepage multisig.

  2. Confirm the renderer was updated:

cast call <simple_page_address> "renderer()(address)" --rpc-url <your_rpc_url>

Contract Verification

After deployment, verify your contracts on Etherscan:

forge verify-contract <deployed_address> <contract_name> --chain <chain_id> --api-key <etherscan_api_key> --watch

Clean Build Files

Remove build artifacts:

make clean

Additional Help

For a full list of available commands:

make help

Documentation

For more detailed information about Foundry: