Skip to content

Pledge

Abstract

This module is responsible for the pledge, destruction, and reward parts related to DaoDst

Contents

  1. Concepts
  2. Messages
  3. Parameters
chat/
├── client
│   └── rest
│        ├── error.go          # Interface error set
│        ├── grpc.go           # GRPC inquiry method
│        ├── handle_pledge.go # Pledge module message preprocessing
│        ├── query.go          # Interface query function
│        ├── rest.go           # Registration of Message and Query Routes
│        └── tx.go             # Tx related methods, including broadcasting, etc
├── keeper
│   ├── genesis.go        # Module State and Export
│   ├── keeper.go         # Store keeper that handles the business logic of the module and has access to a specific subtree of the state tree.
│   ├── msg_server.go     # Provide message service processing logic
│   ├── params.go         # Parameter getter and setter
│   ├── query.go          # State query functions
│   ├── medal.go          # Logic algorithms related to hash coin pledge calculation
│   └── mingkeeper.go     # Logic Algorithm for Foundry Additional Issuance
├── types
│   ├── codec.go          # Type registration for encoding
│   ├── errors.go         # Module-specific errors
│   ├── events.go         # Events exposed to the Tendermint PubSub/Websocket
│   ├── genesis.go        # Genesis state for the module
│   ├── interface.go      # Interface of the module
│   ├── keys.go           # Store keys and utility functions
│   ├── msg.go            # Pledge module transaction messages
│   ├── params.go         # Module parameters that can be customized with governance parameter change proposals
│   └── types.go          # Type collection of modules
├── genesis.go            # ABCI InitGenesis and ExportGenesis functionality
├── handler.go            # Message routing
└── module.go             # Module setup for the module manager

Concepts

Pledge

The pledge module is responsible for the pledge and destruction of DaoDST

DST & HASH

Users can obtain hash tokens by destroying the dst pipeline, while pledging the hash to continuously obtain and select dst rewards at any time,
After reaching a certain level, the hash can be redeemed and traded

HASH

When registering for a chat, it is necessary to destroy a certain amount of dsts and exchange them for hashes according to the calculation. The obtained hashes will be automatically pledged, and according to the rules, each block will receive a reward (dst)
The redemption and trading of hash requires reaching a certain level of free mason

Freemason level

There are some benefits to increasing the level of Freemason, such as unlocking the redemption and trading of hashes, increasing the proportion of hashes obtained by destroying dsts, unlocking more chat rooms, and increasing online storage space for chats.
The free mason level is linked to the hash pledge amount, and the relationship between the hash pledge amount and level can be changed through voting

HASH transfer

Hash transfers will charge more gas, approximately 10000 times that of regular transfers

Destroy DST

When destroying DSTs, additional rewards (dsts) will be issued to the registered and current gateways based on the amount of destruction, as well as additional rewards to the miners

The calculation for exchanging DST for HASH is as follows

Destruction amount/(DST reward issuance amount on the same day/cumulative network HASH acquisition amount)=number of HASH obtained

Pledge HASH

Pledging HASH can continuously earn DST rewards

DST will issue additional shares every time a block is issued, and users will receive dst rewards based on the hash pledge proportion

The calculation of the number of additional issues for each block of dst is as follows

Block inflation=((0.35-Quantity destroyed in the last 100 days)/ 0.35 *(Maximum inflation rate3.65 -Minimum inflation rate1.21)+Minimum inflation rate1.21)/Number of blocks produced per year5259600

Keeper

The Chat module Keeper grants access to the Chat module state and implements statedb.Keeper interface to support the StateDB implementation. The Keeper contains a store key that allows the DB to write to a concrete subtree of the multistore that is only accessible by the Chat module. Instead of using a trie and database for querying and persistence (the StateDB implementation), Daodst uses the Cosmos KVStore (key-value store) and Cosmos SDK Keeper to facilitate state transitions.

To support the interface functionality, it imports 4 module Keepers:

  • auth: CURD for accounts
  • bank: CURD for supply and balance
  • comm: Management of gateway related data
  • chat: Management of chat data
type Keeper struct {
    storeKey   sdk.StoreKey
    cdc        codec.BinaryCodec
    paramstore paramtypes.Subspace

    hooks            types.PledgeHooks
    AccountKeeper    types.AccountKeeper
    BankKeeper       types.BankKeeper
    CommKeeper       types.CommKeeper
    ChatKeeper       types.ChatKeeper
    FeeCollectorName string
}

Messages

MsgPledge

Initiate the destruction of dst through this message
    type MsgPledge struct {
        FromAddress      string     `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty" yaml:"from_address"`
        DelegatorAddress string     `protobuf:"bytes,2,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"`
        ValidatorAddress string     `protobuf:"bytes,3,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"`
        Amount           types.Coin `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount"`
    }

MsgWithdrawDelegatorReward

Through this message, select the dst reward for pledge hash
    type MsgWithdrawDelegatorReward struct {
        DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"`
    }

MsgUnpledge

Through this message, redeem the pledged hash
    type MsgUnpledge struct {
        DelegatorAddress string     `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"`
        Amount           types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount"`
    }

MsgBurnGetMedal

Destroy dst to obtain Hash
    type MsgBurnGetMedal struct {
        FromAddress string     `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty" yaml:"from_address"`
        ToAddress   string     `protobuf:"bytes,2,opt,name=to_address,json=toAddress,proto3" json:"to_address,omitempty" yaml:"to_address"`
        Gateway     string     `protobuf:"bytes,3,opt,name=gateway,proto3" json:"gateway,omitempty" yaml:"gateway"`
        BurnCoin    types.Coin `protobuf:"bytes,4,opt,name=burn_coin,json=burnCoin,proto3" json:"burn_coin" yaml:"burn_coin"`
    }

Parameters

The pledge module contains the following module parameters

Params

Key Type Default Value
KeyInflationDays int64 100
InflationMax github_com_cosmos_cosmos_sdk_types.Dec 3.65
InflationMin github_com_cosmos_cosmos_sdk_types.Dec 1.21
GoalBonded github_com_cosmos_cosmos_sdk_types.Dec 0.35
BlocksPerYear uint64 5259600
UnbondingHeight int64 302400
MinBurnCoin github_com_cosmos_cosmos_sdk_types.Coin 100000000000000000000dst
BurnCurrentGatePercent github_com_cosmos_cosmos_sdk_types.Dec 0.1
BurnRegisterGatePercent github_com_cosmos_cosmos_sdk_types.Dec 0.1
BurnDposPercent github_com_cosmos_cosmos_sdk_types.Dec 0.1
BurnReturnDays int64 120
BurnLevels []BurnLevel

BurnLevels

BurnLevels defines the relevant benefits that can be enjoyed by a free mason level, including three types of benefits

  1. The ratio of destroying dst to hash
  2. Chat storage space
  3. The number of chat room unlocked
Level MedalAmount AddPercent RoomAmount
1 100 1 0
2 200 2 0
3 400 3 0
4 800 4 0
5 1600 5 1
6 3200 6 2
7 6400 7 3
8 12800 8 4
9 25600 9 5
10 51200 12 6
11 102400 15 7
12 204800 18 8
13 409600 21 9
14 819200 24 10
15 1638400 27 11
16 3276800 30 12
17 6553600 33 13
18 13107200 36 14
19 26214400 39 15
20 52428800 43 16
21 104857600 47 17
22 209715200 51 18
23 419430400 55 19
24 838860800 59 20
25 1677721600 63 21
26 3355443200 67 22
27 6710886400 71 23
28 13421772800 75 24
29 26843545600 79 25
30 53687091200 84 26
31 107374182400 89 27
32 214748364800 94 28
33 429496729600 100 29