Giter VIP home page Giter VIP logo

payma's Introduction

payma is a WASM based virtual smart contract supports web3 crypto based secp256k1 wallet on top of polygon chain to build trust with coworkers. It can also be used and injected as a .wasm file into js projects.

๐Ÿค๐Ÿป How it works

note that the transfer process must be called by the payma authority itself.

  • generate secp256k1 keypair for both parties
  • employee deposit the full payment into the polygon split contract
  • on for example every 10 commits, confirmed by the employee followings will be transferred to the contractor and the payma wallet:
fn receive_amount(amount: u64, perc: u8) -> u64{
    let percent = Percentage::from(perc);
    let amount_receive = percent.apply_to(amount);
    amount_receive
}
let payma_commission = receive_amount(deposited_amount, 20);
let mut pure_fee_after_tax = deposited_amount - payma_commission;
while let Ok(confirmed_commits) = get_employee_confirmation().await{
    let cn = confirmed_commits.number;
    pure_fee_after_tax /= cn;
    let contractor_fee = pure_fee_after_tax;
    
    // transfer contractor_fee to the contractor wallet
    // ...
    
}

๐ŸŽฏ Run

cargo run --bin payma

๐Ÿ—๏ธ Build WASM

sudo chmod +x build.sh && ./build.sh

๐Ÿš€ Create, Build, Deploy, Publish Contract on Thirdweb

# Create contract 
sudo npx thirdweb create contract && sudo chmod -R 777 .
# Compiles contract and detects thirdweb extensions implemented on them.
yarn build
# Deploys contract with the thirdweb deploy flow.
yarn deploy
# Publishes contract with the thirdweb publish flow.
yarn publish
# Release contract publicly
yarn release

๐ŸŒ‹ Deploy Payma fastapi Server to Interact with Thirdweb

sudo docker network create -d bridge payma || true
sudo docker build -t thirdweb -f $(pwd)/infra/docker/thirdweb/Dockerfile . --no-cache
sudo docker run -d --restart unless-stopped --network payma --name thirdweb -p 7651:7650 thirdweb

๐Ÿšง WIPs

  • code and deploy split contract
  • fastapi server using thirdweb sdk to call split contract apis
  • diagram
  • cli args using clap
  • wasm compilation

payma's People

Contributors

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