@hanzo/contracts

    0.1.2 • Public • Published

    Contracts

    npm build dependencies downloads license chat

    Smart contracts developed for the Hanzo Platform

    This is a collection of Solidity contracts developed for the Hanzo Platform. Designed to meet a broad range of needs, our contracts play well with Truffle and provide a cutting edge framework for contract development.

    Install

    $ npm install @hanzo/contracts

    Usage

    Import the contracts you want to use:

    import "@hanzo/contracts/Owned.sol"
    import "@hanzo/contracts/Versioned.sol"
    
    contract Version is Owned {
        function version() public pure returns (string) {
            return "1.0.0";
        }
    
        function boolean() public pure returns (bool) {
            return true;
        }
    }
    
    contract Contract is Versioned {}

    And interact with them as you would normally:

    let Contract = artifacts.require('./Contract.sol')
    let Version  = artifacts.require('./Version.sol')
    
    contract('Contract', async () => {
      let contract, version, proxy = null
    
      before(async () => {
        contract = await Contract.deployed()
        version  = await Version.deployed()
        await contract.setVersion(version.address)
    
        // Use current version's ABI and provide simple interface to a versioned
        // smart contract.
        proxy = await Version.at(contract.address)
      })
    
      it('should return result from proxied method', async () => {
        let v = await proxy.boolean.call()
        assert.equal(v, true, 'boolean() did not return expected boolean')
      })
    })

    You can find more examples of our contracts in use in our test suite.

    About Hanzo

    Hanzo enables businesses to launch and operate blockchain networks, develop decentralized applications and deliver compelling experiences.

    License

    BSD

    Install

    npm i @hanzo/contracts

    DownloadsWeekly Downloads

    9

    Version

    0.1.2

    License

    BSD-3-Clause

    Unpacked Size

    17.8 kB

    Total Files

    21

    Last publish

    Collaborators

    • hanzo-io
    • zeekay