Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/CirclesUBI/circles-contracts
Fully automated luxury gay space communism contracts
https://github.com/CirclesUBI/circles-contracts
ethereum smart-contracts
Last synced: about 2 months ago
JSON representation
Fully automated luxury gay space communism contracts
- Host: GitHub
- URL: https://github.com/CirclesUBI/circles-contracts
- Owner: CirclesUBI
- License: agpl-3.0
- Created: 2018-08-07T16:06:14.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-10-03T17:25:24.000Z (over 1 year ago)
- Last Synced: 2024-10-29T22:37:35.258Z (3 months ago)
- Topics: ethereum, smart-contracts
- Language: JavaScript
- Homepage:
- Size: 6.48 MB
- Stars: 73
- Watchers: 11
- Forks: 22
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
circles-contracts
Smart Contracts for Circles UBI
Ethereum Smart Contracts for the [`Circles`] UBI system: A decentralised Universal Basic Income platform based on personal currencies.
[`circles`]: https://joincircles.net
## Basic design
There are several components:
### Token contract
This is derived from standard `ERC20` implementations, with two main differences: The ability to mint UBI to the token owner, and the `hubTransfer` function that allows transitive transfers. `Token` contracts store the address of 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 are [`Gnosis Safes`].
[`Gnosis Safes`]: https://github.com/gnosis/safe-contracts
### Hub contract
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. All the parameters in a `Hub` are immutable and it has no owner.
![Circles contract diagram](/assets/ContractDiagram.jpg)
Illustrated here are some of the main available calls:
- `signup` method of the `Hub` deploys a Circles token
- Safe or external accounts make trust connections within the hub with the trust method
- Users send transitive transactions with the hub, which has special permissions on tokens## Installation
```bash
npm i @circles/circles-contracts
```Requires [`Node`] version 14.
[`Node`]: https://nodejs.org/en/download
## Development
Requires [Node](https://nodejs.org/en/download/) version 14. You can change your node version to the tested version with `nvm use`.
Install all required dependencies via `npm install`.
`npm test` will re-build the contracts / tests and run all of the tests in the [test](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`](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.
Note that: We commit the build dir on purpose, because the rest of our stack pulls this repo in from npm and gets the abis from them.
[`Truffle`]: https://truffleframework.com/docs/truffle/testing/writing-tests-in-javascript
[`Mocha`]: https://mochajs.org
[`Chai`]: https://www.chaijs.com## License
GNU Affero General Public License v3.0 [`AGPL-3.0`]
[`AGPL-3.0`]: LICENSE