Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treasury support KTON Proposal #306

Merged
merged 19 commits into from
Mar 3, 2020
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .maintain/ci/travis.local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
readonly TEST_CRATES=(
'kton'
'ring'
'staking'
'treasury'
);

function main() {
cargo build

for crate in ${TEST_CRATES[@]}
do
cargo test -p "darwinia-$crate"
done
}

main
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ jobs:
env: RUST_TOOLCHAIN=nightly-2020-02-07 TARGET=native STAKING
script: .maintain/ci/darwinia_test_script.sh staking

- stage: Darwinia Test
env: RUST_TOOLCHAIN=nightly-2020-02-07 TARGET=native TREASURY
script: .maintain/ci/darwinia_test_script.sh treasury

# TODO: remove this when overall test case ready
allow_failures:
- stage: Overall Test
Expand Down
9 changes: 6 additions & 3 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,8 @@ impl pallet_staking::Trait for Runtime {

parameter_types! {
pub const ProposalBond: Permill = Permill::from_percent(5);
pub const ProposalBondMinimum: Balance = 1 * COIN;
pub const RingProposalBondMinimum: Balance = 1 * COIN;
pub const KtonProposalBondMinimum: Balance = 1 * COIN;
pub const SpendPeriod: BlockNumber = 1 * DAYS;
pub const Burn: Permill = Permill::from_percent(50);
}
Expand All @@ -501,9 +502,11 @@ impl pallet_treasury::Trait for Runtime {
type ApproveOrigin = pallet_collective::EnsureMembers<_4, AccountId, CouncilCollective>;
type RejectOrigin = pallet_collective::EnsureMembers<_2, AccountId, CouncilCollective>;
type Event = Event;
type ProposalRejection = ();
type KtonProposalRejection = ();
type RingProposalRejection = ();
type ProposalBond = ProposalBond;
type ProposalBondMinimum = ProposalBondMinimum;
type RingProposalBondMinimum = RingProposalBondMinimum;
type KtonProposalBondMinimum = KtonProposalBondMinimum;
type SpendPeriod = SpendPeriod;
type Burn = Burn;
}
Expand Down
9 changes: 9 additions & 0 deletions frame/balances/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Balances

Balances currently contains **RING** and **KTON**.

**RING** is system token of Darwinia Network, the initial supply before Darwinia network mainnet release is 2 billion.

**KTON** is the staking and governance credential of Darwinia Network, KTON can **only obtained by locking RING**, the initial supply is 0.

At present, some **RING** and **KTON** exist in the Ethereum network and the Tron network in the form of **ERC-20** and **TRC-20**. These TOKENs will be transferred to the Darwinia main network by 1:1 cross-chain conversion after the Darwinia main online.
31 changes: 31 additions & 0 deletions frame/balances/kton/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Kton

To encourage users to make long term commitments and pledge, users can choose to lock RING for 3 - 36 months in the process of Staking, and the system will offer a KTON token as reward for users participating in Staking. During the committed pledge period, users can not unlock their RING. (Unless pay triple amounts of KTON as penalty)

As a result, during RING staking process, user can choose to **lock RING for a period to receive KTON**. The initial supply amount of KTON should be zero, yet before Darwinia Mainnet launch, some users have already started locking their RING in Evolution Land, so there will be some KTON supply at the time of mainnet launch. The earliest design to obtain the KTON by locking the RING appears in the Gringotts of Evolution Land. The related introduction can refer to the Gringotts KTON model [5].

KTON can be pledged to receive Staking power, so as to participate POS mining as well. User may Staking via pledge KTON, if user take back their staking KTON, then related POS mining is stopped, and it takes 14 days for unpledged KTON to arrive.

## FAQ

### What is Kton?

**KTON** is the staking and governance credential of Darwinia Network, KTON can **only obtained by locking RING**, the initial supply is 0.

### Where Kton from?

Users can choose to lock RING for 3 - 36 months in the process of Staking, and the system will offer a KTON token as reward for users participating in Staking.

### When Kton spends?

1. Transfer to other accounts.

2. Burned by slashed.

### What will happen after slashing?

Slashed token goes to tresure.


---
(5): https://forum.evolution.land/topics/55
2 changes: 1 addition & 1 deletion frame/balances/kton/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ decl_error! {
}

decl_storage! {
trait Store for Module<T: Trait> as Balances {
trait Store for Module<T: Trait> as KtonBalances {
/// The total units issued in the system.
pub TotalIssuance get(fn total_issuance) build(|config: &GenesisConfig<T>| {
config.balances.iter().fold(Zero::zero(), |acc: T::Balance, &(_, n)| acc + n)
Expand Down
3 changes: 3 additions & 0 deletions frame/balances/ring/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# RING

**RING** is system token of Darwinia Network, the initial supply before Darwinia network mainnet release is 2 billion.
2 changes: 1 addition & 1 deletion frame/balances/ring/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ decl_error! {
}

decl_storage! {
trait Store for Module<T: Trait<I>, I: Instance=DefaultInstance> as Balances {
trait Store for Module<T: Trait<I>, I: Instance=DefaultInstance> as RingBalances {
/// The total units issued in the system.
pub TotalIssuance get(fn total_issuance) build(|config: &GenesisConfig<T, I>| {
config.balances.iter().fold(Zero::zero(), |acc: T::Balance, &(_, n)| acc + n)
Expand Down
40 changes: 40 additions & 0 deletions frame/treasury/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Treasury Module

The Treasury module provides a "pot" of funds that can be managed by stakeholders in the
system and a structure for making spending proposals from this pot.

- `treasury::Trait`
- `Call`

## Overview

The Treasury Module itself provides the pot to store funds, and a means for stakeholders to
propose, approve, and deny expenditures. The chain will need to provide a method (e.g.
inflation, fees) for collecting funds.

By way of example, the Council could vote to fund the Treasury with a portion of the block
reward and use the funds to pay developers.

### Terminology

- **Proposal:** A suggestion to allocate funds from the pot to a beneficiary.
- **Beneficiary:** An account who will receive the funds from a proposal iff
the proposal is approved.
- **Deposit:** Funds that a proposer must lock when making a proposal. The
deposit will be returned or slashed if the proposal is approved or rejected
respectively.
- **Pot:** Unspent funds accumulated by the treasury module.

## Interface

### Dispatchable Functions

- `propose_spend` - Make a spending proposal and stake the required deposit.
- `set_pot` - Set the spendable balance of funds.
- `configure` - Configure the module's proposal requirements.
- `reject_proposal` - Reject a proposal, slashing the deposit.
- `approve_proposal` - Accept the proposal, returning the deposit.

## GenesisConfig

The Treasury module depends on the `GenesisConfig`.
Loading