{"id":22218787,"url":"https://github.com/jacklightchen/eoslottery","last_synced_at":"2025-03-25T07:23:32.005Z","repository":{"id":102946136,"uuid":"179947801","full_name":"jacklightChen/eoslottery","owner":"jacklightChen","description":"基于EOS智能合约的彩票应用(a lottery based on eos contract)","archived":false,"fork":false,"pushed_at":"2019-04-14T14:30:10.000Z","size":59,"stargazers_count":1,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-30T06:42:16.505Z","etag":null,"topics":["eos","eos-contracts","lottery"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jacklightChen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-07T10:08:18.000Z","updated_at":"2019-04-14T14:36:41.000Z","dependencies_parsed_at":"2023-03-12T11:45:22.442Z","dependency_job_id":null,"html_url":"https://github.com/jacklightChen/eoslottery","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacklightChen%2Feoslottery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacklightChen%2Feoslottery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacklightChen%2Feoslottery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacklightChen%2Feoslottery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jacklightChen","download_url":"https://codeload.github.com/jacklightChen/eoslottery/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245415839,"owners_count":20611619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eos","eos-contracts","lottery"],"created_at":"2024-12-02T22:29:10.898Z","updated_at":"2025-03-25T07:23:31.976Z","avatar_url":"https://github.com/jacklightChen.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# eoslottery\n![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)\n### 简介\n基于EOS的福利彩票\u003cbr\u003e\n预计实现每小时自动开奖并分发奖励\n\n### 使用技术\n智能合约 | ... \n:---:|:---\nEOS | [eosio v1.7.1](https://github.com/EOSIO/eos)\n编译工具 | [eosio.cdt v1.6.1](https://github.com/EOSIO/eosio.cdt)\n测试网 | CryptoKylin Testnet RPC 入口:https://api-kylin.eoslaomao.com\n\n### 目录结构\n```\n.\n├── lottery.hpp\n├── lottery.cpp\n```\n\n### 编译方法\n``` shell\neosio-cpp -abigen -I ./ -o lottery.wasm lottery.cpp\n```\n\n### 合约流程\n用户调用eosio.token的transfer 在memo里填类似1,2,3,4 作为买的4个彩票号码\n合约定时取链上的哈希解析成4个数字来开奖\n\n### action\n* transfer\u003cbr\u003e\n通过apply函数监听eosio.token的transfer转发到这个action进行相关的操作\n* active\u003cbr\u003e\n全局开关\n* delaydraw\u003cbr\u003e\n通过二次延迟开奖规避了一些简单的hack\u003cbr\u003e\n注:二次延迟开奖依旧无法规避精心设计的deferred action的hack\u003cbr\u003e\n故只适合自己鼓捣 不适合商用\n\n### eos问题汇总\nhttps://eosio.stackexchange.com\n\n### 一些常见问题\n1.provided permissions [{\"actor\":\"lottery1test\",\"permission\":\"eosio.code\"}]\n```shell\n合约账户缺少eosio.token的权限\n解决方法:\ncleos -u https://api-kylin.eoslaomao.com set account permission YOUR_ACCOUNT_NAME active '{\"threshold\": 1, \"keys\":[{\"key\":\"YOUR_PUBLIC_KEY\", \"weight\":1}], \"accounts\":[{\"permission\":{\"actor\":\"YOUR_ACCOUNT_NAME\",\"permission\":\"eosio.code\"},\"weight\":1}], \"waits\":[] }' owner -p YOUR_ACCOUNT_NAME\n```\n\n2.asset 运算\n```shell\nAn eosio::asset::amount is of type int64_t, therefore when you divide, any decimal places will be truncated.\n如需对asset类进行运算请使用以下的形式防止一些意外的类型转换损失精度\neosio::asset y(x.amount/10, eosio::symbol(\"EOS\",4)); // Set asset y to have 10th of x\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacklightchen%2Feoslottery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjacklightchen%2Feoslottery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacklightchen%2Feoslottery/lists"}