Code Monkey home page Code Monkey logo

stablecoin's Introduction

Tezos Stablecoin

Build status

Tezos Stablecoin project implements an FA2-compatible token smart contract. It draws inspiration from popular permissioned asset contracts like CENTRE Fiat Token and other similar contracts. The contract is implemented in the LIGO language. This repository consists of the following:

  1. LIGO source code of the Stablecoin smart contract and auxiliary smart contracts in the ligo/ folder.
  2. Contract specification.
  3. Haskell bindings with data types corresponding to Stablecoin. It is based on the morley framework. It allows us to use features of morley (such as a testing engine called cleveland) with this contract.
  4. stablecoin-client executable that allows deploying and interacting with the Stablecoin smart contract.

Please refer to the haskell/ directory for details regarding stablecoin-client and Haskell bindings.

The project also includes an alternative FA1.2-compatible smart contract, available in the ligo/stablecoin/fa1.2/ folder.

How to get

You can download Michelson source code of all provided smart contracts in release assets. We also provide a static stablecoin-client executable that should work on any x86_64 Linux system. If you are using a different OS or just want to build from sources, see instructions below.

Usage

The recommended way to deploy and interact with Stablecoin is to use stablecoin-client. For example, in order to deploy the contract you can run

./stablecoin-client --user foo deploy --master-minter foo --contract-owner foo --pauser foo --default-expiry 300000

provided you have tezos-client in your $PATH, it's configured to use an appropriate node and knows foo address with sufficient balance to pay for operations.

Build instructions

Tests

Tests are implemented in Haskell. Please refer to the haskell/ directory for details.

Gas / Transaction costs

The tables below show the gas and transaction costs of both versions (FA1.2 and FA2) of the stablecoin contract v1.6.0 in Delphinet.

Delphinet

FA1.2 Gas cost FA2 Gas cost FA1.2 Tx cost FA2 Tx cost
origination 65562 62794 2.867005 ꜩ 2.816774 ꜩ
transfer 67566 65206 0.007115 ꜩ 0.006893 ꜩ

Measuring

To measure and collect these numbers:

  1. Configure your tezos-client to use a delphinet node
  2. Make sure tezos-client has a nettest alias with enough ꜩ
    tezos-client get balance for nettest
    
  3. Run cd haskell && stack test stablecoin:test:stablecoin-nettest
  4. The logs should show these two messages, with two addresses:
    Originated smart contract Stablecoin FA1.2 with address <...>
    Originated smart contract Stablecoin FA2 with address <...>
    
  5. Search for these addresses in https://better-call.dev/, select the "Contracts" tab, you should get 1 search result. Select it to see the origination and transfer costs.

Note that we also run these tests nightly as part of our CI, so another way to do this measurement is to wait for CI to run these tests and find 2 addresses in the logs of the latest scheduled CI run.

Issue Tracker

We use GitHub issues. Feel free to open a new one.

License

MIT

stablecoin's People

Contributors

gromakovsky avatar dcastro avatar sras avatar awkure avatar rvem avatar zhenyavinogradov avatar pasqu4le avatar jacobarluck avatar balsoft avatar

Watchers

James Cloos avatar Liz Pruszko Steininger avatar dog star avatar  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.