DocsDeploy the contracts

Docs/Developers

Deploy the contracts

Deploy your own Scarf, Forwarder and Paymaster to Base Sepolia.

Set up#

Terminal
cd Contract
npm install

Create Contract/.env:

.env
PRIVATE_KEY=your_deployer_private_key
SEPOLIA_BASE_URL=https://sepolia.base.org
ETHERSCAN_API_KEY=your_etherscan_key

Deploy and verify#

Terminal
npx hardhat compile
npx hardhat ignition deploy ./ignition/modules/Scarf.ts --network sepoliaBase
npx hardhat run scripts/verify.ts --network sepoliaBase

Ignition deploys in order: Forwarder, then Scarf and the Paymaster, both pointing at the Forwarder.

After deploying#

  1. 1

    Point the app at your contracts

    Set NEXT_PUBLIC_SCARF_ADDRESS, NEXT_PUBLIC_FORWARDER_ADDRESS and NEXT_PUBLIC_PAYMASTER_ADDRESS in Frontend/.env.local.
  2. 2

    Fund the Paymaster

    Send it ETH, or call deposit(). It pays relayer refunds from this balance.
  3. 3

    Fund the relayer

    The RELAYER_PRIVATE_KEY wallet pays gas up front, so give it some ETH.
  4. 4

    Regenerate types (if the ABI changed)

    Copy the new ABI into Frontend/blockchain and run npm run typechain.