Coder Social home page Coder Social logo

cnhc-contracts's Introduction

CNH Coin (CNHC)

CNHC Group Limit (CGL)-issued CNH-collateralized ERC20 stablecoin public smart contract repository.

https://www.cnhc.to

The contract can be found here

The whitepaper can be found here.

ABI, Address, and Verification

The contract abi is in CNHCToken.abi. It is the abi of the implementation contract. CNHCToken.json is fully compiled file generated by truffle. See also our independent security audits by PeckShield and Beosin in audit-reports.

Contract Specification

CNHC is an ERC20 token that is Centrally Minted and Burned by CGL, representing the trusted party backing the token with CNH.

ERC20 Token

The public interface of CNHC is the ERC20 interface specified by EIP-20.

  • name()
  • symbol()
  • decimals()
  • totalSupply()
  • balanceOf(address who)
  • transfer(address to, uint256 value)
  • approve(address spender, uint256 value)
  • allowance(address owner, address spender)
  • transferFrom(address from, address to, uint256 value)

And the usual events.

  • event Transfer(address indexed from, address indexed to, uint256 value)
  • event Approval(address indexed owner, address indexed spender, uint256 value)

Typical interaction with the contract will use transfer to move the token as payment. Additionally, a pattern involving approve and transferFrom can be used to allow another address to move tokens from your address to a third party without the need for the middleperson to custody the tokens, such as in the 0x protocol.

Controlling the token supply

The total supply of CNHC is backed by fiat held in reserve at CGL. There is a owner address can submit proposals for minting and burning the token and several voters can audit the proposals based on the actual movement of cash in and out of the reserve based on requests for the purchase and redemption of CNHC.

Votable Events

  • OpenProposal(uint16 pid);
  • CloseProposal(uint16 pid);
  • DoneProposal(uint16 pid);
  • VoteProposal(uint16 pid, address voter);
  • AddVoter(address voter);
  • RemoveVoter(address voter);

Pausing the contract

In the event of a critical security threat, CGL has the ability to pause and unpause transfers and approvals of the CNHC token. The ability is controlled by a single owner role, following OpenZeppelin's Ownable. The simple model for pausing transfers following OpenZeppelin's Pausable.

Contract Tests

To run smart contract tests first start

ganache-cli

in another terminal

Then run

truffle test

cnhc-contracts's People

Contributors

nnnggel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.