Skip to content

daedalus-industries/climate-kitties

Repository files navigation

VCUs - also known as Climate Kitties

This is a simple NFT project for Voluntary Carbon Units, informally referred to within as the technology used is the same as the popular CryptoKitties trading games.

Once minted, either locally or on the Kovan testnet through the hosted dashboard, VCUs (or Climate Kitties 🙂) have the same behaviour as most ERC721 tokens. They work in the same wallets, and can be sold on collectables exchanges like OpenSea or BoxSwap.

VCUs differ from most tokens as they can be retired. Retired VCUs can no longer be transferred, and have a retirement date. VCUs can also be negotiable [they can be assigned to another legal person] or non-negotiable. Non-negotiable VCUs can be transferred once after minting, and are then automatically retired and cannot be transferred again.

Since this automatic retirement is a feature of the token not the exchange or wallet, this does not prevent the VCU from being sold through a 3rd party service. Other requirements, such as KYC or AML measures, could be similiarly introduced without breaking compatibility with the wider Ethereum ecosystem.

The kitties are currently immortal, that’s to say, having issued one we cannot recall or destroy it (or control how it is transferred). But this can be changed, and arbitrary governance mechanisms introduced. See Circle’s USDC for example. (Which with some fiddling, Climate Kitties can already use through OpenSea.)

Currently we use a small webservice on Google Cloud for image hosting. Its failure would not affect anything other than image on each kittie. In the future, we should be able to remove this but we need to understand the metadata requirements better.

Prerequisites

The code dependencies are fully described in package.json. Only npm install is needed.

For deployment only GCloud has been configured [the app.yaml files], and this will require the Cloud CLI for deployment from your machine.

The use of the Node Version Manager is recommened.

Contracts and components

Web

There are two website components: the minting dashboard (found at app/ ) and the metadata server (which is simply app.js).

Both are deployable by following the GCloud App Engine guide for nodejs.

Dashboard

The minting dashboard has its own package.json, and its own copies of the contracts JSON src/contracts. The dashboard contracts JSON is copied automatically when using the root tasks npm run migrate:local or npm run migrate:local. It is based on the standard React+Drizzle template.

Metadata Server

The metadata server shares its dependencies and contracts JSON with the root Truffle project.

Contracts

Note
To migrate to a public network, the environment variable MNEMONIC should be set to the desired BIP39 wallet seed phrase.

Currently, only the Voluntary Carbon Unit NFT token is implemented. It is contained in the source file VoluntaryCarbonUnit.sol.

Due to the extra metadata required, the standard mint(to, id) function is not supported. Use mintVcu(…​) instead.

Minting a new VCU requires the sending address to have minter permissions granted by calling token.addMinter(address) from the owning address.

Note that the standard migration tasks in NPM, that is migrate:local and migrate:rinkeby reset the network as we do not have an upgrade strategy for this prototype. As we Git ignore all the contract JSON, we don’t have even the most basic packaging solution either.

Quick start

Running locally

  1. Install root dependencies npm install

  2. Start a local chain npx ganache-cli

  3. Migrate to the local chain npm run migrate:local

  4. Start the metadata server npm run start

  5. Switch into the dashboard directory cd app

  6. Install dashboard dependencies npm install

  7. Start the dashboard npm run start

Note that there will be domain mismatch between the metadata server, and that given by tokenURI(…​) called on the local chain instance of the Voluntary Carbon Unit NFT.

Also only my MetaMask wallet address is added as a minter in migrations/4_nifty_minter.js. Fire up npx truffle console --network local to add your own.

Unit Testing

npm run test

Only the root Truffle project is currently unit tested.

Contribution Guidelines

This project is open source software released with an Apache 2.0 license.

Submitting Issues

Please submit issues and add them to the appropriate Milestone, as well as any relevant tags.

Merging Pull Requests

Keep your branch up to date with develop using rebase instead of merge.

Commit Messages

  • The 50/72 rule. The first line should be capitalized and can go up to 50 chars, following lines should preferably be wrapped at 72

  • Bullet points are good, please use indentation though. For the bullet, you can choose between asterisks or hyphens. For the first line, try to be specific. e.g: "Ensure keys are unique" instead of "Fix a bug with keys" If you’re adding or changing existing tests, they should go on the same commit.

Areas for Future Work

Nicer dashboard

Currently the dashboard uses the <ContractData> and <ContractForm> Drizzle-React elements for everything. This does not allow of validation or things like rendering the numeric country code in a nice way.

There’s also no display of the user’s own VCUs, or the ability to look-up VCUs.

Better modeling of VCUs

Our current modelling of the VCUs is crude, and does not allow for any fungibility, even within a single conservation project or vintage.

We need a clearer understanding of what data is fixed, what can be updated, how the amendment process works, etc. We also currently use the OpenSea "standard" for additional ERC721 attributes despite it not being an EIP.

Would also be interesting to look at the ERC1155 proposal for a single contract to represent an arbitarily large "universe" of tokens, as well as standards for NFT tokens to "own" fungible tokens.

0x Integation

There’s a half finished 0x Instant integration at public/shop.html. This will be easier to complete if 0x merge the required code for Instant to handle ERC721 NFTs. See the file for more details.

To make it useful, the dashboard would need wiring up to OpenRelay.xyz, initial code in app/src/0x.

Creation Process

We currently treat the VCUs as being simply "minted" into existence. In reality this is a multi-step multi-party process which is initiated by the project owner, not the VCU scheme sponsor.

Validation Games

It would be interesting to attempt to set-up so-called verification games, where audits and challenging those audits could be incentivised.

Fiat Bridge

There should be some ability in the system to accept USD/SGD/EURs etc. Preferably using a credit card. Safello have in interesting third-party integration for the European market. (Note: Author is a shareholder in Safello 🙂)