This repository has been archived by the owner on Nov 3, 2024. It is now read-only.
Releases: pomelo-io/pomelo-grants-contract
Releases · pomelo-io/pomelo-grants-contract
Pomelo v1.0.0 Release Notes
Security Audits
- Sentnl Audit (2021-10)
SHA256 Checksum
Local
eosio-cpp version 1.7.0
$ git clone https://github.com/pomelo-io/pomelo-app.git
$ cd pomelo-app
$ git checkout v1.0.0
$ eosio-cpp app.pomelo.cpp -I include
$ shasum -a 256 app.pomelo.wasm
6116cbae46cc7239d0246a53e1e627f27d91f8fc9739e02064aa9198eefe43e7 app.pomelo
blanc++ version 12.0.1
$ blanc++ app.pomelo.cpp -I include
$ shasum -a 256 app.pomelo.wasm
68a2a0d1693833683ef7d29856c46fdbd2c528d72969d0cf091e29355555f51b app.pomelo
EOS Mainnet
$ cleos -u https://api.eosn.io get code app.pomelo
code hash: 68a2a0d1693833683ef7d29856c46fdbd2c528d72969d0cf091e29355555f51b
Usage
@user
# create grant and join round
cleos push action app.pomelo setproject '["author.eosn", "grant", "grant1", "fundingacc", ["EOS", "USDT"]]' -p author.eosn
cleos push action app.pomelo joinround '["grant1", 101]' -p author.eosn
# fund grant
cleos transfer user1 app.pomelo "10.0000 EOS" "grant:grant1"
# fund bounty
cleos transfer user1 app.pomelo "10.0000 EOS" "bounty:bounty1"
@admin
# configure app
cleos push action app.pomelo setconfig '[1, 500, 500, "login.eosn", "fee.pomelo"]' -p app.pomelo
cleos push action app.pomelo token '["4,EOS", "eosio.token", 10000, 1]' -p app.pomelo
cleos push action app.pomelo token '["4,USDT", "tethertether", 10000, 0]' -p app.pomelo
# create matching round and season add it to season and start it
cleos push action app.pomelo setround '[101, 1, "Grant Round #1", 100000]' -p app.pomelo
cleos push action app.pomelo setseason '[1, "2021-05-19T20:00:00", "2021-05-25T20:00:00", "2021-05-19T20:00:00", "2021-05-25T20:00:00", "Season 1", 100000]' -p app.pomelo
# approve grant by admin
cleos push action app.pomelo enable '["grant", "grant1", "ok"]' -p app.pomelo
Definitions
Roles
role |
description |
---|---|
Backend | Pomelo Backend |
Admin | Pomelo Admins |
Owners | Grant/Bounty Owners |
SC | Smart Contract |
Table of Content
- TABLE
globals
- TABLES
grants
&bounties
- TABLE
transfers
- TABLE
match
- TABLE
seasons
- TABLE
rounds
- TABLE
tokens
- ACTION
setconfig
- ACTION
setseason
- ACTION
setgrant
- ACTION
enable
- ACTION
setround
- ACTION
joinround
- ACTION
unjoinround
- ACTION
cleartable
- ACTION
removeuser
- ACTION
collapse
- ACTION
token
TABLE globals
{uint16_t} season_id
- season ID (0 = not active){uint64_t} grant_fee
- grant fee (bips - 1/100 1%){uint64_t} bounty_fee
- bounty fee (bips - 1/100 1%){name} login_contract
- EOSN Login contract{name} fee_account
- fee
example
{
"season_id": 1,
"grant_fee": 500,
"bounty_fee": 500,
"login_contractt": "login.eosn",
"fee_account": "fee.pomelo",
}
TABLES grants
and bounties
multi-indexes
param |
index_position |
key_type |
---|---|---|
byauthor |
2 | i64 |
bystatus |
3 | i64 |
byupdated |
4 | i64 |
params
{name} id
- (primary key) project name ID (used in memo to receive funds, must be unique){name} type
- (❗️IMMUTABLE) project type (ex:grant/bounty
){name} author_user_id
- (❗️IMMUTABLE) author (Pomelo User Id){name} [funding_account=""]
- funding account (EOS account){set<symbol_code>} [accepted_tokens=["EOS"]]
- accepted tokens (ex:["EOS"]
){name} [status="pending"]
- status (pending/ok/disabled
){time_point_sec} created_at
- created at time{time_point_sec} updated_at
- updated at time
example
{
"id": "mygrant",
"type": "grant",
"author_user_id": "user1.eosn",
"funding_account": "myreceiver",
"accepted_tokens": ["EOS"],
"status": "ok",
"created_at": "2020-12-06T00:00:00",
"updated_at": "2020-12-06T00:00:00",
}
TABLE transfers
- scope:
get_self() {name}
multi-indexes
param |
index_position |
key_type |
---|---|---|
byfrom |
2 | i64 |
byuser |
3 | i64 |
byseason |
4 | i64 |
byround |
5 | i64 |
bygrant |
6 | i64 |
byvalue |
7 | i64 |
bycreated |
8 | i64 |
params
{uint64_t} transfer_id
- (primary key) token transfer ID{name} from
- EOS account sender{name} to
- EOS account receiver{extended_asset} ext_quantity
- amount of tokens transfered{asset} fee
- fee charged and sent toglobal.fee_account
{string} memo
- transfer memo{name} user_id
- Pomelo user account ID{uint16_t} season_id
- participating season ID{uint16_t} round_id
- participating round ID{name} project_type
- project type ("grant" / "bounty"){name} project_id
- project ID{double} value
- valuation at time of received{checksum256} trx_id
- transaction ID{time_point_sec} created_at
- created at time
example
{
"transfer_id": 10001,
"from": "myaccount",
"to": "pomelo",
"ext_quantity": {"contract": "eosio.token", "quantity": "15.0000 EOS"},
"fee": "1.0000 EOS",
"memo": "grant:grant1",
"user_id": "user1.eosn",
"season_id": 1,
"round_id": 101,
"project_type": "grant",
"project_id": "grant1",
"value": 100.0,
"trx_id": "3bf31f6c32a8663bf3fdb0993a2bf3784d181dc879545603dca2046f05e0c9e1",
"created_at": "2020-12-06T00:00:00"
}
TABLE match
- scope:
round_id {uint64_t}
params
{name} grant_id
- (primary key) grant ID{uint16_t} round_id
- round ID{uint64_t} total_users
- total number of users{double} sum_value
- sum of all user value contributions{double} sum_boost
- sum of all user contributions boosts{double} sum_sqrt
- sum of square root of contributions (quadratic funding metric){double} square
- total square of the square roots (quadratic funding metric){time_point_sec} updated_at
- updated at time
example
{
"grant_id": "grant1",
"round_id": 101,
"total_users": 2,
"sum_value": 150.0,
"sum_boost": 325.0,
"sum_sqrt": 25.0,
"square": 625.0,
"updated_at": "2020-12-06T00:00:00"
}
TABLE users
- scope:
{uint16_t} round_id
multi-indexes
param |
index_position |
key_type |
---|---|---|
bydonated |
2 | i64 |
byboosted |
3 | i64 |
params
{name} user_id
- (primary key) grant ID{double} multiplier
- current user multiplier{double} value
- total amount contributed by user in this round{double} boost
- total boost amount for user in this round{vector<contribution_t>} contributions
- vector of user's contributions (donated + boost) to each project{time_point_sec} updated_at
- updated at time
example
{
"user_id": "user1",
"multiplier": 1.25,
"contributions": [{"id": "grant1", "value": 24.0}, {"id": "grant2", "value": 10.0}],
"updated_at": "2020-12-06T00:00:00"
}
TABLE seasons
params
{uint16_t} season_id
- (primary key) season_id{string} description
- season description{vector<uint16_t>} round_ids
- round ids participating in this season{double} match_value
- total matching pool value for this season{time_point_sec} start_at
- start at time{time_point_sec} end_at
- end at time{time_point_sec} submission_start_at
- submission start time{time_point_sec} submission_end_at
- submission end time{time_point_sec} created_at
- created at time{time_point_sec} updated_at
- updated at time
example
{
"season_id": 1,
"description": "Season #1",
"round_ids": [101, 102, 103],
"match_value": 100000,
"start_at": "2020-12-06T00:00:00",
"end_at": "2020-12-12T00:00:00",
"submission_start_at": "2020-11-06T00:00:00",
"submission_end_at": "2020-12-06T00:00:00",
"created_at": "2020-12-06T00:00:00",
"updated_at": "2020-12-06T00:00:00",
}
TABLE rounds
params
{uint64_t} round_id
- (primary key) matching rounds{string} description
- grant text description{uint16_t} season_id
- season ID{set<name>} grant_ids
- grants IDs participating{set<name>} user_ids
- user IDs participating{vector<extended_asset>} donated_tokens
- donated tokens{double} match_value
- estimated value of the matching pool{double} sum_value
- total value donated this round{double} sum_boost
- total boost received this round{double} sum_square
- square of total sqr...