/stablecoin

Tezos stablecoin smart contract

Primary LanguageHaskellMIT LicenseMIT

Tezos Stablecoin

Build status

Tezos Stablecoin project implements an FA2-compatible token smart contract. It is based on CENTRE Fiat Token. The contract is implemented in the LIGO language. See the ligo/ folder. Contract specification is available.

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

Stablecoin client

We have a stablecoin-client executable that allows deploying and interacting with the stablecoin contract. You can download it as a static Linux binary from GitHub releases. Please refer to the haskell/ directory for details.

Haskell bindings

Apart from LIGO implementation of the contract we have a Haskell library with data types corresponding to this contract. It is based on the morley framework. It allows us to use features of morley (such as testing engine) with this contract.

Tests

Tests are implemented in the same Haskell package. 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.3.0 in both Carthagenet and Delphinet.

Carthagenet

FA1.2 Gas cost FA2 Gas cost FA1.2 Tx cost FA2 Tx cost
origination 448089 464076 12.695322 ꜩ 12.273509 ꜩ
transfer 412046 431839 0.041564 ꜩ 0.043558 ꜩ

Delphinet

FA1.2 Gas cost FA2 Gas cost FA1.2 Tx cost FA2 Tx cost
origination 75082 71888 3.178771 ꜩ 3.07229 ꜩ
transfer 77585 74804 0.008117 ꜩ 0.007853 ꜩ

Measuring

To measure and collect these numbers:

  1. Configure your tezos-client to use a carthagenet or 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.

Issue Tracker

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

License

MIT