Giter Site home page Giter Site logo

ayudateam / smart-contracts Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sogurcurrency/smart-contracts

0.0 1.0 0.0 20.27 MB

Sogur's smart-contracts

Home Page: https://www.sogur.com

License: GNU General Public License v3.0

Python 28.12% JavaScript 43.37% Solidity 28.51%

smart-contracts's Introduction

Sögur's Smart Contracts

This repository contains the code used in Sögur's system of smart contracts. For more information, visit our website: https://www.sogur.com/

Sögur's smart contract system is based on two ERC-20 tokens:

  1. SGrToken: Sögur's main token - the Sögur currency.
  2. SGNToken: Sögur's stakeholder remuneration token - represent the right to receive up to 15 SGRs per 1 SGN.

In addition to these ERC-20 based smart contracts, the smart contract system includes other contracts needed to support SGR's and SGN's functionality.

SGR Token

In addition to its ERC-20 (i.e. transferability) utility, the SGR token serves as its own market-maker, i.e mints new SGR tokens upon receiving of ETH and pays back ETH when SGR tokens are burned.

To support the zero-time execution of SGR's market-making operations, the smart contract system must:

  1. Calculate SGR/ETH price according to Sögur's monetary model.
  2. Enforces Saga's KYC/AML policy, limiting the ability to transact using SGR and SGN tokens to pre-approved addresses.

ETH to SGR exchange

The exchange of ETH to SGR is done by calling the public payable exchange() function. Assuming the sending address is allowed to buy SGR, all ETH sent is exchanged to SGR and sent back to the sender's address.

The contract's fallback function can also be used with the exact same functionality.

SGR to ETH exchange

The exchange of SGR to ETH is done by calling the transfer(to, value) function, with the contract's address as the to paramter.

SGN Token

In addition to its ERC-20 (i.e. transferability) utility, the SGN token can be converted to SGR tokens according to Sögur's monetary model.

The conversion is done by either:

  1. calling the convert(value) function, with value the amount of SGN tokens (in wei) to be converted.
  2. calling the transfer(to, value) function, with the contract's address as to and the amount to be converted as value.

Test instructions

Instructions for runnig JS tests in both truffle and solidity coverage libraries.

Using node version v10.16.3 & npm version 6.9.0.

  1. clone or download this repository on branch master
  2. enter smart-contracts folder
  3. run npm install
  4. run npm run build
  5. run npm run test 1 for running all tests using truffle or run npm run test 2 for running all tests using solidity coverage.
Special thanks to barakman for his contribution

smart-contracts's People

Contributors

ronsabo 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.