SEEDCHAIN is experimental software and these docs may get out of date quickly. Please join the Discord server for up to date information and support.

Quick start

Seedchain tokens can be minted directly from your contract. Doing this is a great way to create positive climate impact at the core of your project.

When minting directly:

  • Your contract will own the tokens
  • Your contract address profile will record impact under "Tokens"

When airdropping to another address:

  • The target address will own the tokens
  • The target address profile will record impact under "Tokens"
  • Your contract address profile will record impact under "Airdropped tokens"

Also remember:

  • Tokens are non-transferrable
  • If the Seedchain mint fails, the entire transaction will fail

Setup

First, let's install the contract package.

npm install @seedchain/contracts

Now let's initialise the seedchain contract.

Seedchain seedchain = Seedchain(0x8abbdc96403D543812EefD243147b10cBbd4cA4f);

Minting a tree

Seedchain prices are fixed in fiat, so we need to get the latest ETH price before minting.

uint256 price = seedchain.getPrice(100); // Returns price in Wei

Now we've got the price, we can call the payable mint() function and pass the price variable in as the value parameter.

seedchain.mint{value: price}(
    100, // The project ID for trees
    1 // Quantity that we're minting
);

You can see a full list of projects here.

If you want to airdrop to another address, you can use the airdrop() method instead:

seedchain.airdrop{value: price}(
    0x41694639E7445349D3Fe38BaE26BB717Bd4976Ea, // The target address to airdrop to
    100, // The project ID for trees
    1 // Quantity that we're minting
);

That's it! You've minted 1 real tree!

In the future, you'll be able to fetch metadata about your tree via our metadata endpoint, but for now please view your contribution via your profile.

Minting multiple token types

The Seedchain contract supports minting multiple types of token with the same mint() call for the same gas cost. Here's an example if we wanted to mint 10 trees and 5 tonnes of carbon offsets.

uint256 treePrice = seedchain.getPrice(100); // Returns price in Wei
uint256 offsetPrice = seedchain.getPrice(101); // Returns price in Wei

uint256 treeQuantity = 10;
uint256 offsetQuantity = 5;

// Calculate the total price
uint256 totalPrice = treeQuantity * treePrice + offsetPrice + offsetQuantity;

seedchain.mint{value: totalPrice}(
    [100, 101],
    [treeQuantity, offsetQuantity]
);

This method also comes with an airdrop() equivalent:

seedchain.airdrop{value: totalPrice}(
    0x41694639E7445349D3Fe38BaE26BB717Bd4976Ea,
    [100, 101],
    [treeQuantity, offsetQuantity]
);

Need to call methods for a contract that's already deployed? See Impact Routers and Deployer minting.