System Coin

ERC20 representation of the coins backed by system collateral

1. Summary

The Coin contract is the user-facing ERC20 token maintaining the accounting for external system coin balances. Most functions are standard for a token with changing supply, but it also has notable features such as the ability to approve transfers based on signed messages.

2. Contract Details & Functions


  • name

  • symbol

  • version

  • decimals

  • changeData - if 1 governance can change the name and/or symbol and no one can use permit(); if different than 1 governance cannot change name or symbol anymore and permit() can be used

  • totalSupply - total coin supply

  • balanceOf(usr: address) - user balance

  • allowance(src: address, dst: address) - approvals

  • nonces(usr: address) - permit nonce

  • wad - fixed point decimal with 18 decimals (for basic quantities, e.g. balances).


  • mint(usr: address, amount: uint256) - mint coins to an address

  • burn(usr: address, amount: uint256) - burn at an address

  • push(usr: address, amount: uint256) - transfer

  • pull(usr: address, amount: uint256)- transfer from

  • move(src: address, dst: address, amount: uint256) - transfer from

  • approve(usr: address, amount: uint256) - allow pulls and moves

  • modifyParameters(parameter: bytes32, data: uint256) - modify the value of changeData

  • setName(name_: string) - change the token's name if changeData is 1

  • setSymbol(symbol_: string) - change the token's symbol if changeData is 1

  • permit(holder: address, spender: address, nonce: uint256, expiry: uint256, allowed: bool, v: uint8, r: bytes32, s: bytes32) - approve by signature; only callable if changeData != 1

  • transfer(dst: address, amount: uint256) - transfers coins from msg.sender to dst

3. Walkthrough

For the most part, coin.sol functions as a typical ERC20 token although it has a couple of core differences:

  1. push, pull & move are aliases for transferFrom in the form of transferFrom(msg.sender, usr, amount) , transferFrom(usr, msg.sender, amount) & transferFrom(src, dst, amount) .

  2. permit is a signature-based approval function. This allows an end-user to sign a message which can then be relayed by another party to submit their approval. This can be useful for applications in which the end-user does not need to hold ETH to pay for gas.