Skip to content

Latest commit

 

History

History
205 lines (141 loc) · 5.29 KB

README.md

File metadata and controls

205 lines (141 loc) · 5.29 KB

Bytepay

Bytepay is a platform that supports paid tasks to complete open-source projects on Github.

Visit Our Online Project (Recommend)

Bytepay


How to run this project (dev mode)

1. Run docker command

docker run --rm -p 10086:80 sulnong/bytepay:app-v1

2. Open your browser

Open http://localhost:10086

How To Run Test

Method 1 - By docker

docker pull sulnong/bytepay:test
docker run --rm sulnong/bytepay:test

Method 2 - By local environment

git clone git@github.com:bytepayment/bytepaytest.git
cd bytepay/test
npm i
npm run test

Test Report

After you run the command

Notice: Test will create an issue and does the main workflow like create task, apply task and pay for the task.

In the end, test report would print an issue html url, please visit to check detail.

You will get a test repost as following:

  Github Public Repo
    ✔ get() should be ok (1545ms)

  Github Public Userinfo
    ✔ get() should be ok (964ms)

  Interact With Repo
    ✔ userinfo:get() should be ok (2046ms)
    ✔ binded-repos:get() should be ok (1007ms)
    ✔ all-repos:get() should be ok (8579ms)
    ✔ unbind a binded repo should be ok (1118ms)
    ✔ bind a unbind repo should be ok (1246ms)

  Polkadot Related API
    ✔ userinfo:get() should be ok (901ms)
    ✔ polkadot-address:get() should be ok (809ms)
    ✔ polkadot-mnemonic:get() should be null (715ms)
    ✔ polkadot-account-info:get() should be ok (800ms)
    ✔ developer:bind_own_address() should be ok (2291ms)
    ✔ polkadot-transfers-record:get() should be ok (2380ms)
    ✔ polkadot-transfer:signAndSend() should be ok (1394ms)
    ✔ polkadot:ensure-transfer-success() should be ok (7984ms)

  Get Tasks From Bytepay
    ✔ dev_task:get() should be ok (2866ms)
    ✔ author_task:get() should be ok (1473ms)

  Interact With Repo
    ✔ Issue:create() should be ok (1196ms)
    ✔ Task:create() sould be ok (3206ms)
    ✔ Task:apply() should be ok (3531ms)
    ✔ Task:pay() should be ok (4686ms)
    ✔ Task:check() should be ok (2000ms)


  22 passing (60s)
Please visit https://github.com/bytepayment/bytepaytest/issues/4 check this full workflow...

Ink! Transfer Contract

source code was ./smart-contract/lib.rs

Notice:

Since canvas-ui could not upload contract now, visit opened issue for detail, we provide off-chain test.

cd contract/polka
cargo +nightly test

Above command would failed because deposit doesn't works. see opened issue for detail.

Run all in local mode

docker-compose up

Above command would start three containers:

  1. mongo - local database
  2. web - our bytepay frontend web
  3. app-server - bytepay backend server

Note:

contract

near

view method

View contract owner: get_owner

Check balance: get_balance

Parameter:

name type
account AccountId

View whitelist restrictions for a specified account: get_whitelist

Parameter:

name type description
current AccountId current user
account AccountId target users

change method

Recharge: recharge

Parameter:

name type
amount Balance

Set up a whitelist: set_whitelist

Parameter:

name type description
account AccountId target users
amount Balance target user quota

The contract administrator initiates a transfer transaction: transfer

Parameter:

name type description
from AccountId payer
to AccountId payee
amount Balance money

use near-cli call example:

near view <contract_account> get_balance '{"account": "account.testnet"}'

// 查询合约的部署账号
near view lafyun.testnet get_owner
// 查询余额
near view lafyun.testnet get_balance '{"account": "lafyun.testnet"}'
// 充值
near call 'lafyun.testnet' recharge '{"amount":1 }' --accountId lafyun.testnet 
// 设置白名单
near call 'lafyun.testnet' set_whitelist '{"account": "hankeke.testnet","amount":1 }' 
--accountId lafyun.testnet  

// 转账
near call 'lafyun.testnet' transfer '{"from": "hankeke.testnet","to":"lafyun.testnet","amount":0.1 }' --accountId lafyun.testnet  

// 发布生产 1.修改near创建账户逻辑 2.修改波卡的单位换算