Code Monkey home page Code Monkey logo

circles-contracts's Introduction

Circles Contracts

Chat Server Backers License Build Status Follow Circles

This is the initial smart contract implementation for the Circles universal basic income platform.

Note: This is not yet intended for deployment in a production system.

Website // Whitepaper // Chat

Basic design

There are several components:

Token

This is derived from standard ERC20 implementations, with two main differences: The balance for the "owner" (UBI receiver) is calculated based on the time elapsed since the contract was created, and there is an "hubTransfer" function that allows trusted transitive exchanges. Tokens belong to the hub that deployed them, and can only transact transitively with tokens from the same hub. Tokens have owners, which can be an external account or any kind of contract - in our deployment, they will be gnosis safes.

Hub

This is the location of system-wide variables and the trust graph. It has special permissions on all tokens that were deployed through it and have authorized it to perform transitive exchanges. Hub has an owner, which should at least be a multisig, (in our deployment this will also be a gnosis safe) but can in practice be any type of address.

contract diagram

Illustrated here are some of the main available calls:

  • Signup method of the hub deploys a circles token
  • Safe or external account makes trust connections within the hub with the trust method
  • Users send transitive transactions with the hub, which has special permissions on tokens

Getting started

Requires node version 10

Clone down this repo and npm install

With ganache running (npm run ganache), in a new console window, node_modules/.bin/truffle compile then node_modules/.bin/truffle migrate

Note: This is a work in progress and this should be done only for contribution and exploration purposes.

Testing

Requires node version 10 npm test will re-build the contracts / tests and run all of the tests in the test directory.

Tests are executed with the help of Truffle and written in javascript using Mocha with the Chai assertion library.

When you run npm test a new local blockchain will be started with ganache-cli (unless you already have one running). The contracts will be deployed and the javascript tests will make transactions to this chain.

Helper functions defined in test/helpers provides functionality for more complicated tests such as: reading the event log, or checking for an EVM "revert / throw", or changing the blockstamp times.

License

GNU Affero General Public License v3.0 AGPL-3.0

circles-contracts's People

Contributors

ana0 avatar d-xo avatar edzillion avatar jake-gillberg avatar mrchico avatar shkfnly avatar

Watchers

 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.