-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #495 from confio/491-oc-remuneration
OC + AP payments contract
- Loading branch information
Showing
14 changed files
with
1,567 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[alias] | ||
wasm = "build --release --target wasm32-unknown-unknown" | ||
wasm-debug = "build --target wasm32-unknown-unknown" | ||
unit-test = "test --lib" | ||
schema = "run --example schema" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
[package] | ||
name = "tgrade-tc-payments" | ||
version = "0.9.0" | ||
authors = ["Mauro Lacy <[email protected]>"] | ||
edition = "2021" | ||
description = "Oversight Community / Arbiter Pool payments contract" | ||
repository = "https://github.com/confio/tgrade-contracts" | ||
homepage = "https://tgrade.finance" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[lib] | ||
crate-type = ["cdylib", "rlib"] | ||
|
||
[features] | ||
# for more explicit tests, cargo test --features=backtraces | ||
backtraces = ["cosmwasm-std/backtraces"] | ||
# use library feature to disable all instantiate/execute/query exports | ||
library = [] | ||
|
||
[dependencies] | ||
cw2 = "0.13.2" | ||
cw-controllers = "0.13.2" | ||
cw-storage-plus = "0.13.2" | ||
chrono = "0.4.19" | ||
cosmwasm-schema = "1.0.0-beta8" | ||
cosmwasm-std = "1.0.0-beta8" | ||
schemars = "0.8" | ||
serde = { version = "1.0.103", default-features = false, features = ["derive"] } | ||
thiserror = "1.0.21" | ||
tg-bindings = "0.9.0" | ||
tg4 = "0.9.0" | ||
|
||
[dev-dependencies] | ||
cw-multi-test = "0.13.2" | ||
tg4-engagement = "0.9.0" | ||
tg-voting-contract = "0.9.0" | ||
tg-bindings-test = "0.9.0" | ||
tg-utils = "0.9.0" | ||
tgrade-trusted-circle = { version = "0.9.0", path = "../tgrade-trusted-circle" } | ||
tgrade-ap-voting = { version = "0.9.0", path = "../tgrade-ap-voting" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# TGrade Trusted Circle Payments | ||
|
||
This contract makes regular payments to the Oversight Community and Arbiter Pool members. | ||
|
||
## Init | ||
|
||
To create it, you must pass the Trusted Circle and the Arbiter pool contract addresses. | ||
As well as an optional `admin`, if you wish it to be mutable. | ||
|
||
```rust | ||
pub struct InstantiateMsg { | ||
/// Admin (if set) can change the payment amount and period | ||
pub admin: Option<String>, | ||
/// Trusted Circle / OC contract address | ||
pub oc_addr: String, | ||
/// Arbiter pool contract address | ||
pub ap_addr: String, | ||
/// The required payment amount, in the payments denom | ||
pub denom: String, | ||
/// The required payment amount, in the TC denom | ||
pub payment_amount: u128, | ||
/// Payment period | ||
pub payment_period: Period, | ||
} | ||
|
||
pub enum Period { | ||
Daily, | ||
Monthly, | ||
Yearly | ||
} | ||
``` | ||
|
||
## Messages | ||
|
||
#### Notes | ||
- This contract is to be funded from block rewards, i.e. its address and distribution percentage must be in the `distribution_contracts` tgrade_valset list. | ||
- If there are not enough funds to make a `payment_amount` to all OC + AP members, the existing funds are distributed to the engagement point holders. | ||
- Funds are distributed directly to members through `Bank::Send`. This assumes the total number of members is small (less than thirty). | ||
- If both OC and AP addresses are of the same contract, they are treated as different addresses, i.e. each member will be paid "twice". | ||
- The contract would need an `EndBlocker` privilege, to check the payment time, and execute it if appropriate. | ||
Alternatively, a cron contract could call the payment entry point with a frequency greater or equal than that of `payment_period`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use std::env::current_dir; | ||
use std::fs::create_dir_all; | ||
|
||
use cosmwasm_schema::{export_schema, export_schema_with_title, remove_schemas, schema_for}; | ||
|
||
use tgrade_tc_payments::msg::PaymentListResponse; | ||
pub use tgrade_tc_payments::msg::{ExecuteMsg, InstantiateMsg, QueryMsg}; | ||
use tgrade_tc_payments::state::PaymentsConfig; | ||
|
||
fn main() { | ||
let mut out_dir = current_dir().unwrap(); | ||
out_dir.push("schema"); | ||
create_dir_all(&out_dir).unwrap(); | ||
remove_schemas(&out_dir).unwrap(); | ||
|
||
export_schema_with_title(&schema_for!(InstantiateMsg), &out_dir, "InstantiateMsg"); | ||
export_schema_with_title(&schema_for!(ExecuteMsg), &out_dir, "ExecuteMsg"); | ||
export_schema_with_title(&schema_for!(QueryMsg), &out_dir, "QueryMsg"); | ||
export_schema(&schema_for!(PaymentsConfig), &out_dir); | ||
export_schema(&schema_for!(PaymentListResponse), &out_dir); | ||
} |
Oops, something went wrong.