Code Monkey home page Code Monkey logo

swap-smart-contract's Introduction

Sample Hardhat Project

This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, and a script that deploys that contract.

Project Description

  • Create an order-based swap contract that allows users to deposit various kind of tokens.

  • These tokens can be purchased by others with another token specified by the depositors.

  • For example; Ada deposits 100 link tokens, she wants in return, as a payment, 20W3B tokens for for 100 link tokens.

  • A swap smart contract that allow users to swap between two tokens, for example Link token and W3B token

  • You need to determine the price of link token and web3bridge token,

  • Assuming link is $50,

  • Assuming W3B is $200,

  • Therefore, assuming a user wants to swap Link to W3B token, he needs to create an order, by putting all informaton necessary e.g, the token address he wants to swap, the token address he wants to receive, the amount he want to swap, and deadline.

  • Use struct to identify each order and a mapping of uint to struct to identify each order,

  • After someone has created an order, another user can decide to execute the order by inputing the ID of the order he wants to execute and send the token to the user that created the order while he get the token that was use to execute order.

Try running some of the following tasks:

npx hardhat help
npx hardhat test
GAS_REPORT=true npx hardhat test
npx hardhat node
npx hardhat run scripts/deploy.ts

swap-smart-contract's People

Contributors

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