Bytepay
Bytepay is a platform that supports paid tasks to complete open-source projects on Github.
Visit Our Online Project (Recommend)
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
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:
- mongo - local database
- web - our bytepay frontend web
- app-server - bytepay backend server
Note:
- backend app server is based on lafyun/app-service, which is a http-backend-server runtime.
- Check Dockerfile to know how we build.
- All our backend implementation is in directory server/functions.
- This script - init.js integrated our backend implementation with lafyun/app-service
contract
near
view method
get_owner
View contract owner: get_balance
Check balance: Parameter:
name | type |
---|---|
account | AccountId |
get_whitelist
View whitelist restrictions for a specified account: Parameter:
name | type | description |
---|---|---|
current | AccountId | current user |
account | AccountId | target users |
change method
recharge
Recharge: Parameter:
name | type |
---|---|
amount | Balance |
set_whitelist
Set up a whitelist: Parameter:
name | type | description |
---|---|---|
account | AccountId | target users |
amount | Balance | target user quota |
transfer
The contract administrator initiates a transfer transaction: 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.修改波卡的单位换算