Augmint - Stable Digital Tokens - Javascript Library (WIP)
Decentralised stable cryptocurrency on Ethereum
Concept
Decentralized stablecoins targeted to fiat currencies built on Ethereum.
The first Augmint token is AEUR.
1 AEUR ≈ 1 EUR.
- Buy and sell AEUR for ETH or EUR.
- Get a loan in AEUR by depositing ETH.
- Lock AEUR to earn a premium.
Try it: https://www.augmint.org
Manifesto
White Paper
Related repos
augmint-js lib
This lib is heavily under construction. Anything can happen.
Install
yarn add @augmint/js
or
npm install @augmint/js
Example use
import { Augmint } from "@augmint/js";
let web3;
if (window.ethereum) {
web3 = new Web3(window.ethereum);
await window.ethereum.enable();
} else if (typeof window.web3 !== "undefined") {
web3 = new Web3(window.web3.currentProvider);
} else {
}
let connectionConfig;
if (web3) {
connectionConfig = {
givenProvider: web3.currentProvider,
ETHEREUM_CONNECTION_CHECK_INTERVAL: 0
};
} else {
connectionConfig = {
PROVIDER_URL: "wss://rinkbey.infura.io/ws/v3/",
PROVIDER_TYPE: "websocket",
INFURA_PROJECT_ID: ""
};
}
const augmint = await Augmint.create(connectionConfig);
try {
const tx = augmint.rates.setRate(CCY, rate)
.send([{ from: "0x06012c8cf97BEaD5deAe237070F9587f8E7A266d" }])
.onceTxHash( txHash => {.. })
.onceReceipt( receipt => { ...})
.onConfirmation( confirmationNumber => {...}
.onceReceiptConfirmed(5, receipt => {...})
.onceTxRevert( (error, receipt) => { ....});
const txHash = await tx.getTxHash();
const txReceipt = await tx.getReceipt();
const confirmedReceipt = await tx.getConfirmedReceipt(12);
} catch (error) {
}
if (confirmedReceipt.status) {
} else {
}
Specs: test/Transaction.test.js
More examples
Web3.js event style
Deprecated and discouraged but kept for backward compatibility with web3js style events:
tx.on[ce]("transactionHash" | "receipt" | "confirmation" | "error");
Specs: test/Transaction.web3jsStyle.test.js
Construct a transaction with Transaction
class
It's likely not needed for ordinary augmint-js
use
const web3TxObject = rates.instance.methods.setRate(CCY, 100)
const augmintRatesTx = new Transaction(ethereumConnection, web3TxObject, { gasLimit: 200000 } );
augmintRatesTx.send(...).onTxHash(...)
augmint-cli
For local development: launch a docker container with test augmint contracts in ganache
$ yarn augmint-cli # NB: if you are running from within the augmin-js repo then: ./scripts/augmint-cli.sh
augmint-cli : start / stop augmint contracts. Docker image: augmint/contracts:vx.x.x
Usage: /usr/local/bin/augmint-cli ganache {start | stop | run}
start: tries to start container named ganache . If fails then runs (downloads, creates and starts) the container from augmint/contracts:vx.x.x
stop: plain docker stop augmint/contracts:vx.x.x (doesn't check if exists)
run: stops and removes the ganache container if exists. then runs it
Also recreates the container if it exists but image is not as expected (ie. there was a version upgrade)
Publish NPM package
bump the version property in the package.json
release a new version as usual
- merge staging into master
- create a release in github with the vX.X.X tag on master
before npm publish, you need to build the library:
- checkout the master(!) branch
yarn clean
yarn build
npm publish from master branch. test it with --dry-run
Contributions
Augmint is an open and transparent project.
We are looking for great minds to extend our core team. Contributions in any area is much appreciated: development, testing, UX&UI design, legal, marketing, spreading the word etc.
Code of Conduct
Get in touch
Authors
See team on www.augmint.org
The project was born at DECENT Labs
Concept, initial version
Licence
This project is licensed under the GNU Affero General Public License v3.0 license - see the LICENSE file for details.