# Proposals

# Proposal

jigu.core.proposal.Proposal

Stores information pertaining to a submitted proposal, such as its status and time of the voting period.

# Attributes

Content
content

The content of the proposal.

int
id

The proposal's ID.

str
proposal_status

The proposal's status.

JiguBox[str, Coins]
final_tally_result

The proposal's tally result, mapping account address to deposited coins.

Timestamp
submitted_time

The time the proposal was submitted and the deposit period started.

Timestamp
deposit_end_time

Time that the deposit period will end.

Coins
total_deposit

The total amount of coins deposited by all users.

Timestamp
voting_start_time

Time the voting period will start.

Timestamp
voting_end_time

Time the voting period will end.

# Content

jigu.core.proposal.Content

This is an abstract interface for proposal types. Do not work with this class, use its instances instead. All subclasses of Content have the attributes title and description.

# Attributes

str
title

Proposal content's title.

str
description

Proposal content's description.

# Text Proposal

jigu.core.proposal.TextProposal

Implements Content. Basic proposal which describes the candidate proposition that must be put into effect manually if passed. Used as a general-purpose way of discovering community's sentiment / interest for an arbitrary change.

from jigu.core.proposal import TextProposal

TextProposal(
    "List LUNA on ... exchange",
    "We should make efforts to list LUNA on ... exchange because XXX",
)
str
title

Proposal content's title.

str
description

Proposal content's description.

# Community Pool Spend Proposal

jigu.core.proposal.CommunityPoolSpendRequest

Implements Content. Proposal that disburses funds from the Distribution module's community pool to the specified recipient if passed.

from jigu.core import Coins
from jigu.core.proposal import CommunityPoolSpendRequest

CommunityPoolSpendRequest(
    "Let's give terra... a bit of LUNA!",
    "This person will receive a stipend to work on Terra initatives.",
    recipient="terra...",
    amount=Coins(uluna=5000000)
)
str
title

Proposal content's title.

str
description

Proposal content's description.

AccAddress
recipient

The account address of the recipient.

Coins
amount

Amount of tokens to be disbursed from the community pool

# Tax Rate Update Proposal

jigu.core.proposal.TaxRateUpdateProposal

Implements Content. A proposal for a direct and immediate change to the treasury's tax rate state, which governs transaction fees. If passed, the new tax rate is put into effect immediately, after clamping.

from jigu.core import Dec
from jigu.core.proposal import TaxRateUpdateProposal

TaxRateUpdateProposal(
    "Let's increase tax rate!",
    "We need higher taxes to curb demand.",
    tax_rate=Dec("0.05")
)
str
title

Proposal content's title.

str
description

Proposal content's description.

Dec
tax_rate

New proposed value for tax rate.

# Reward Weight Update Proposal

jigu.core.proposal.RewardWeightUpdateProposal

Implements Content. A proposal for a direct and immediate change to the treasury's reward weight state, which governs staking and validator returns. If passed, the new reward weight is put into effect immediately, after clamping.

from jigu.core import Dec
from jigu.core.proposal import RewardWeightUpdateProposal

RewardWeightUpdateProposal(
    "Let's decrease reward rate!",
    "LUNA price is way too high",
    reward_weight=Dec("0.05")
)
str
title

Proposal content's title.

str
description

Proposal content's description.

Dec
reward_weight

New proposed value for reward weight.

# Parameter Change Proposal

jigu.core.proposal.ParameterChangeProposal
from jigu.core.proposal import ParamtererChangeProposal

# You can use both the original Cosmos ParamStore key or the JSON key.
# They will be converted to canonical form.

ParameterChangeProposal(
    "Interoperability of ParamStore and JSON keys",
    "You can mix usage of both keys within one proposal.",
    changes = {
        "staking": {
            "UnbondingTime": 15000000, # ParamStore key (unbonding_time)
            "max_validators": 15 # JSON key (MaxValidators)
        },
        "market": {
            "minspread": Dec("0.25"), # ParamStore key (min_spread)
            "base_pool": Dec("5320392039"), # JSON key (basepool)
        }
    }
)

Implements Content. Describes a proposal for directly altering the value of the module parameters. Normally, if you are manually building the list of parameter changes, you will need to know the original ParamStore key from reading params.go from each module in the Golang code. Jigu will automatically convert the JSON-serialized parameter key name to the ParamStore name.

If you want to select a couple parameters to change for your proposal, you'll first include the subspace (module it belongs to, such as "oracle" or "distribution"), and then just the specific keys that you want to include in your changes as members of a dict.

str
title

Proposal content's title.

str
description

Proposal content's description.

ParamChanges
changes

Proposed parameter changes. If you supply a dict, it will automatically get converted to ParamChanges.

Expand to see all parameter subspaces and keys
from jigu.core import Coin, Dec, Coins
from jigu.core.proposal import ParamtererChangeProposal

ParameterChangeProposal(
    "Example of all parameters",
    "Shows the subspace and keys of each parameter.",
    changes={
        "distribution": { # subspace
            "community_tax": Dec(0), # key
            "base_proposer_reward": Dec("0.01"),
            "bonus_proposer_reward": Dec("0.04"),
            "withdraw_addr_enabled": True,
        },
        "staking": {
            "unbonding_time": 1814400000000000,
            "max_validators": 100,
            "max_entries": 7,
            "bond_denom": "uluna",
        },
        "slashing": {
            "max_evidence_age": 1814400000000000,
            "signed_blocks_window": 10000,
            "min_signed_per_window": Dec("0.05"),
            "downtime_jail_duration": 600000000000,
            "SlashFractionDoubleSign": Dec("0.05"),
            "slash_fraction_downtime": Dec("0.0001"),
        },
        "treasury": {
            "tax_policy": PolicyConstraints(
                rate_min=Dec("0.001"),
                rate_max=Dec("0.01"),
                cap=Coin("usdr", 1000000),
                change_max=Dec("0.00025"),
            ),
            "reward_policy": PolicyConstraints(
                rate_min=Dec("0.05"),
                rate_max=Dec("0.5"),
                cap=Coin("unused", 0),
                change_max=Dec("0.025"),
            ),
            "seigniorage_burden_target": Dec("0.67"),
            "mining_increment": Dec("1.07"),
            "window_short": 4,
            "window_long": 52,
            "window_probation": 18,
        },
        "oracle": {
            "vote_period": 5,
            "vote_threshold": Dec("0.5"),
            "reward_band": Dec("0.07"),
            "reward_distribution_window": 5256000,
            "whitelist": [
                "ukrw",
                "usdr",
                "uusd",
                "umnt"
            ],
            "slash_fraction": Dec("0.0001"),
            "slash_window": 432000,
            "min_valid_per_window": Dec("0.05"),
        },
        "market": {
            "pool_recovery_period": 14400,
            "base_pool": Dec("250000000000"),
            "min_spread": Dec("0.02"),
            "illiquid_tobin_tax_list": [{
                "denom": "umnt",
                "tax_rate": Dec("0.02")
            }],
        },
        "gov": {
            "deposit_params": {
                "min_deposit": Coins(uluna=512000000),
                "max_deposit_period": 1209600000000000,
            },
            "voting_params": {"voting_period": 1209600000000000},
            "tally_params": {
                "quorum": Dec("0.4"),
                "threshold": Dec("0.5"),
                "veto": Dec("0.334"),
            },
        },
    },
)

# Parameter Changes

jigu.core.proposal.ParamChanges

A data structure that makes it easy to build valid parameter changes for ParameterChangeProposals, as well as deserializes parameter change data from proposals on the blockchain.

There is no need to create this structure yourself, though you can pass it in to ParameterChangeProposal and it will still work (it automatically gets generated from a dict for you).

# Attribute access for subspace and key

You can directly access a ParameterChangeProposal's changes through attributes

from jigu import Terra

soju = Terra("soju-0013", "https://soju-lcd.terra.dev")

soju.gov.proposal(44).content.changes.oracle
# -> JiguBox

soju.gov.proposal(44).content.changes.oracle.reward_band
# -> Dec
Updated on: 3/10/2020, 10:08:20 AM