Otterspace Docs
  • Overview
    • 🦦Intro to Otterspace
    • 🔑Key Concepts
      • 🔥Burning and revocation
      • ⏳Expiration
      • 🤓Metadata schemas
    • ❓F.A.Q
  • Documentation
    • 🔌API
      • 🔐Authentication
    • 🐙Subgraph
    • 🛠️Contracts
      • 🎨Create a Badge Spec
      • 🪂Airdrop a Badge
      • ✅Adding to allowlist
      • 🤝Minting allowlisted Badges
      • ➕Add/Remove Admins
  • Guides
    • 🔏Token-gating using badges
  • Integrations
    • Using badges with Snapshot
    • Guild.xyz for token gating
    • Using with Gnosis Safe
    • On OpenSea, Metamask etc
  • Get Help
    • 🕺Discord/Twitter
Powered by GitBook
On this page

Was this helpful?

  1. Documentation
  2. Contracts

Airdrop a Badge

Install the contracts

npm -i @otterspace-xyz/otterspace-contracts

Call the airdrop function on the contracts to mint an non-consented Badge

import { Contract, Signer } from 'ethers'
import Badges from '@otterspace-xyz/contracts/out/Badges.sol/Badges.json' assert { type: 'json' }

const BADGES_CONTRACT_ADDRESS = '0x7F9279B24D1c36Fa3E517041fdb4E8788dc63D25'

const mintBadge = async (
    toAddress: string,
		fromAddress: Signer,
    badgeSpecURI: string
): Promise<ContractCallResult> => {
    const contract = new Contract(BADGES_CONTRACT_ADDRESS, Badges.abi, fromAddress)
    const doAirdrop = contract['airdrop']
    return await doAirdrop([toAddress], badgeSpecURI)
}
PreviousCreate a Badge SpecNextAdding to allowlist

Last updated 1 year ago

Was this helpful?

🛠️
🪂