Bytepay is a platform that supports paid tasks to complete open-source projects on Github.
docker run --rm -p 10086:80 sulnong/bytepay:app-v1
docker pull sulnong/bytepay:test
docker run --rm sulnong/bytepay:test
git clone git@github.com:bytepayment/bytepaytest.git
cd bytepay/test
npm i
npm run test
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...
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.
docker-compose up
Above command would start three containers:
Note:
get_owner
get_balance
Parameter:
name | type |
---|---|
account | AccountId |
get_whitelist
Parameter:
name | type | description |
---|---|---|
current | AccountId | current user |
account | AccountId | target users |
recharge
Parameter:
name | type |
---|---|
amount | Balance |
set_whitelist
Parameter:
name | type | description |
---|---|---|
account | AccountId | target users |
amount | Balance | target user quota |
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.修改波卡的单位换算