Skip to content

ERC-721 Non-Fungible Token that gives the holder the right to promote a pool on https://pools.fyi. Read more about the design, rationale, and implementation at: https://blocklytics.org/blog/fyi-tokens-nfts-digital-ads

License

Notifications You must be signed in to change notification settings

blocklytics/promoted-pools-contracts

Repository files navigation

Promoted Pools ERC721 contracts

Installation

Run

npm install

If you run into an error while building the dependencies and you're on a Mac, run the code below, remove your node_modules folder, and do a fresh npm install:

xcode-select --install # Install Command Line Tools if you haven't already.
sudo xcode-select --switch /Library/Developer/CommandLineTools # Enable command line tools
sudo npm explore npm -g -- npm install node-gyp@latest # Update node-gyp

Deploying

Deploying to the Rinkeby network

  1. You'll need to sign up for Infura and get an API key.
  2. Using your API key and the private key for your Metamask wallet (make sure you're using a Metamask private key that you're comfortable using for testing purposes), run:
export INFURA_KEY="<infura_key>"
export PRIVATE_KEY="<metmask_private_key>"
truffle deploy --network rinkeby

Pinning the contract terms to IPFS

You will need an IPFS hash of the most recent terms and conditions (located in the terms directory) in order to mint your tokens. Each version is specified by the number that serves as the filename.

An easy way to pin data to IPFS is to use a service like Pinata to upload the file. Upload the latest version of the terms, copy the hash that's returned, and then run:

export TERMS_HASH="<ipfs_hash>"

Setting token environment variables

After deploying to the Rinkeby network, there will be a contract on Rinkeby that will be viewable on Rinkeby Etherscan. For example, here is a recently deployed contract. You should set this contract address and the address of your Metamask account as environment variables when running the minting script:

export OWNER_ADDRESS="<my_address>"
export NFT_CONTRACT_ADDRESS="<deployed_contract_address>"
export NETWORK="rinkeby"
node scripts/mint.js

Note: When running the minting script on mainnet, your environment variable needs to be set to mainnet not live. The environment variable affects the Infura URL in the minting script, not truffle. When you deploy, you're using truffle and you need to give truffle an argument that corresponds to the naming in truffle.js (--network live). But when you mint, you're relying on the environment variable you set to build the URL, so you need to use the term that makes Infura happy (mainnet). Truffle and Infura use the same terminology for Rinkeby, but different terminology for mainnet. If you start your minting script, but nothing happens, double check your environment variables.

About

ERC-721 Non-Fungible Token that gives the holder the right to promote a pool on https://pools.fyi. Read more about the design, rationale, and implementation at: https://blocklytics.org/blog/fyi-tokens-nfts-digital-ads

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published