Coder Social home page Coder Social logo

blocksend's Introduction

Blocksend

Presentation

BlockSend allow you to send money abroad with reduce fees and transparency. The application used the blockchain technology to transfer value without slippage and with a low cost.

Context

This project was done for the the Alyra certification (Blockchain school), the subject was free but must used blockchain technology and some technical figures were imposed.

Collaborators

We are a team of 6 people, we have a 2 developers (Ayoub ZGUAID and Fabrice PAYET), and 4 consultants (Élodie, Rafael, Ashley and Anis).

Objective

The objective was to have an application that allow user to send money abroad with a low cost and transparency. We build simple interface to add contacts and configure a transfer.

Organization

To share, organize, collaborate and track the progress of the project: - Board Trello - Confluence for doc - design with Figma

We have a daily technical meeting every day at 5pm. We use Discord to communicate with others team members. We organized the trello as a Kanban board, describing the differents steps of our workflow (to do, in progress, code review, test, etc...)

Architecture

We choose to have an hybrid architecture with a smart contract on the blockchain and a backend to store some confidential data in a centralised database. The user will allow the smart contract to transfer their EURe and the backend will detect when the user have a sufficient balance to make the onchain transfer.

Architecture globale

Getting Started

  1. Install test and solidity dependencies
npm install
  1. Install Truffle
npm install -g truffle
  1. Migrate the contracts with truffle.
truffle migrate --network 'network_name'
  1. Run the webpack server for front-end hot reloading
npm run dev

Tests

This box comes with truffle contracts testing and front-end testing with jest

  1. Truffle contract tests
truffle test

Building for Production

The dapp is deployed on Matic mainnet. Here the addresses of the contracts:

BlockSendToken address: 0xF942FF4024F90233E50aC47C1E8Bd36fCbf2f3a8
BlockSendRouter address: 0x5Ebec560AF9FDd6d7ceCe6dB74afd8Ed4f35979c
BlockSendStakingRewards address: 0x922330Ea0B38Cf27645ed6E3080222136508d4A2

The dapp is accessible here : BlockSend

Example of an onchain transfer

  1. Migrate the contracts with truffle.
truffle migrate --network 'network_name'
  1. Create production bundle
npm run build
  1. The production build will be compiled in the build/app folder.

Realization

Smart Contracts

We have three smart contracts that interact with each other, the SC BlockSendRouter is the only minter of the token so that we guarantee that the token is minted correctly when the user makes a claim of his rewards from the Router. The SC Router is also responsible for transferring the rewards that the stackers will share at the end of the stacking period

Smart Contracts exchanges

BlockSend Token

An ERC20 stndard token that the users can claim as a rewards for their tranfers.

BlockSend Router

The main contract that handles the business logic of the remittance. it allows money to be routed from the user wallet to the off-ramp solution (HUB2 in our architecture). Money routing is done in several steps: - Transfer of EURe from the user's wallet after prior approval. - Wrapping EURe in jEUR with Jarvis Wrapper. - Redeem USDC with jEUR via Jarvis Syntherium. - Calculate the BlockSend fees to be charged taking into account the network fees that BlockSend bears. - Calculate the rewards that will be redistributed after the stacking of the rewards. - Sent the UCDC to the Off-Ramp solution with the additional info sent from the BackEnd.

BlockSend Stacking

The contract that handle the stacking the tokens and redistributing the rewards to the stackers.

Stacking

Front end

We build a frontend with ReactJs and NextJS. We used the library Wagmi and EthersJs to interact with the smart contract.

Back end

We have a backend with NodeJs and NestJs. We have a centralized datatabase to store personal data (RGPD). A match between the onchain transfer and the data stored in backend is done, and when the transfer onchain is completed a notification is sent to the offchain provider (HUB2).

Unit tests

Contract: BlockSendStakingRewards
     Test stack revert (1066ms)
     Test unstack revert too soon (119ms)
     Test unstack revert no staked tokens (114ms)
     Test claim rewards revert too soon to claim rewards (114ms)
     Test unstack revert No staked tokens (110ms)
     Test on only router (38ms)
     Test add rawards revert (202ms)
    ✔️ check unstack done  (202ms)
Contract: BlockSendToken
     has a name
     has a symbol
     has a decimal
     check first balance
     check balance after transfer (302ms)
     check approval done (94ms)
     check if transferFrom done (381ms)
     check mint done (150ms)
Only minter can mint
     check only minter done (946ms)
Pausable: paused
     check pause and unpause done (91ms)
     check pause and unpause done (291ms)


  11 passing (5s)

blocksend's People

Contributors

fabricepayet avatar zguaid 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.