The MiniMe Token: Open Sourced by Giveth

Jordi Baylina, a few other Ethereum superstars and I are working on Giveth: a completely open source donation platform that will enable generous individuals the ability to donate effectively and transparently to the projects and causes that they wish to support.

There will be a blog post that will further detail Giveth when we officially come out of stealth mode, but no need for that to delay the peer review of our first major contribution to the Ethereum ecosystem!

The MiniMe token is a cloneable ERC 20 token. It is designed to easily spawn tokens that have the same balance distribution as the parent token at any given block number. This gives ANY developer the ability to give extra functionality to token holders while leaving the original token unaffected.

UPDATE!

We exited Stealth mode! Please Join our Slack and feel free to donate to support our continued open source development by sending ether to revolution.eth (which resolves to
0xB94c53B0E67FABac3d97173482663Ef597D4174a) with a gas limit of 133,333, you will receive 1 Giveth token for every ether donated and every wei that Giveth spends is explicitly explained and accounted for on the blockchain.

“MiniMe, you complete me!” — ERC20 Token Standard

The MiniMe token makes it trivial for ANYONE to upgrade a DApp/DAO midstream to include new features in a decentralized fashion, without having to migrate to a new token contract and without having to ask for permission.

This functionality would have been incredibly useful when building The DAO’s many withdraw contracts and we think it will be very helpful for other projects as well!

The code is well documented, please feel free to review, make issues and help us improve this token contract! Even if you are merely an aspiring Solidity developer, you can get a lot out of looking over the MiniMe Contract as the comments that explain the code’s functions are very detailed and tailored for inexperienced developers.

So Many Applications

If this token contract is used as the base token, then clones can be easily generated at any given block number, this allows for incredibly powerful functionality, effectively the ability for anyone to give extra features to the token holders without having to migrate to a new contract. Some of the applications that the MiniMe token contract can be used for are:

  1. Generating a voting token that is burned when you vote.
  2. Generating a “coupon” token that is redeemed when you use it.
  3. Generating a token for a “spinoff” DAO.
  4. Generating a token that can be used to give explicit support to an action or a campaign, like polling.
  5. Generating a token to enable the token holders to collect daily, monthly or yearly payments.
  6. Generating a token to limit participation in a token sale or similar event to holders of a specific token.
  7. Generating a token that allows a central party complete control to transfer/generate/destroy tokens at will.
  8. All the applications the standard ERC 20 token can be used for, but with the ability to upgrade in the future as desired in a decentralized fashion.

All these applications and more are enabled by the MiniMe Token Contract. The most amazing thing is that ANYONE can give new functionality to MiniMe token holders in a permissionless yet safe manner without affecting the parent token’s intended functionality.

Here’s a brief description of the main functionalities added to the contract (taken from the token’s ReadMe.md).

The MiniMe token is easy to clone!

Anybody can create a new clone token from any token using this contract with an initial distribution identical to the original token at a specified block. The address calling the createCloneToken function will become the token controller and the token’s default settings can be specified in the function call.

function createCloneToken(
 string _cloneTokenName,
 uint8 _cloneDecimalUnits,
 string _cloneTokenSymbol,
 uint _snapshotBlock,
 bool _isConstant
 ) returns(address) {

Once the clone token is created, it acts as a completely independent token, with it’s own unique functionalities.

Balance history is registered and available to be queried

All MiniMe Tokens maintain a history of the balance changes that occur during each block. Two calls are introduced to read the totalSupply and the balance of any address at any block in the past.

function totalSupplyAt(uint _blockNumber) constant returns(uint)
function balanceOfAt(address _holder, uint _blockNumber) constant returns(uint)

Optional token controller

The controller of the contract can generate/destroy/transfer tokens at its own discretion. The controller can be a regular account, but the intention is for the controller to be another contract that imposes transparent rules on the token’s issuance and functionality. The Token Controller is not required for the MiniMe token to function, if there is no reason to generate/destroy/transfer tokens, the token controller can be set to 0x0 and this functionality will be disabled.

For example, you can see this example Token Controller contract could be set as the controller of the MiniMe Token and at the end of the token creation period, the controller can be changed to the 0x0 address, to guarantee that no new tokens will be created.

To create and destroy tokens, these two functions are introduced:

function generateTokens(address _holder, uint _value) onlyController
function destroyTokens(address _holder, uint _value) onlyController

The Token’s Controller can freeze transfers

If transfersEnabled == false, tokens cannot be transferred by the users, however they can still be created, destroyed, and transferred by the controller. The controller can also toggle this flag.

// Allows tokens to be transferred if true or frozen if false
function enableTransfers(bool _transfersEnabled) onlyController