Skip to content

Instantly share code, notes, and snippets.

@benjiqq
Last active November 9, 2020 02:08
Show Gist options
  • Save benjiqq/deb3b91abf649080c9a4deef51f1c610 to your computer and use it in GitHub Desktop.
Save benjiqq/deb3b91abf649080c9a4deef51f1c610 to your computer and use it in GitHub Desktop.
PC standard

Participation certifcates (IC) standard

Participation certificate standard. tokens that are not transferrable. they represent receivables for future deliverable assets.

PC's get created exactly once (issuance) and destroyed once (redemption). they are not transfer-able. the purpose of the non-transfer is that in early stages of a venture it is not necessarily desirable to have a market created for tokens. To avoid adding a pause function to standard ERC20, the cleaner approach is to split the financing and issuance into 2 stages.

details

name symbol decimals _issue _redeem

implementation

uint256 private _totalSupply; mapping (address => uint256) private _balances;

/** @dev Creates `amount` tokens and assigns them to `account`, increasing
    * the total supply.
*/
function _issue(address account, uint256 amount) internal virtual {
    require(account != address(0), "mint to the zero address");

    //_beforeTokenTransfer(address(0), account, amount);

    _totalSupply = _totalSupply.add(amount);
    _balances[account] = _balances[account].add(amount);
    emit Transfer(address(0), account, amount);
}
function _redeem(address account, uint256 amount) internal virtual {
    require(account != address(0), "ERC20: burn from the zero address");

    _beforeTokenTransfer(account, address(0), amount);

    _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
    _totalSupply = _totalSupply.sub(amount);
    emit Transfer(account, address(0), amount);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment