-
Notifications
You must be signed in to change notification settings - Fork 78
Tgrade home
Rust language for the cosmwasm smart contracts.
Typescript with React for the dApp.
Go Language for the blockchain.
We have open sourced the Tgrade dapp (written in Typescript using the Cosmos SDK) as a professional example of a front-end UI available here a recent and more elegant solution to connect a wallet would be to use Cosmos kit even if not included in the Tgrade dapp at this time.
If you are comfortable with Rust and want to start writing smart contracts Cosmwasm has an academy that teaches you just that, for free! check availability here, or just view the documentation if you are starting from scratch the best place to learn about the Rust language is reading "The Book"
To upgrade Tgrade please review the following documentation & scripts: Upgrade Guide
-
confio/poe/v1beta1/genesis.proto
- ArbiterPoolContractConfig
- CommunityPoolContractConfig
- EngagementContractConfig
- GenesisState
- ImportDump
- MixerContractConfig
- MixerContractConfig.Sigmoid
- OversightCommitteeContractConfig
- PoEContract
- SeedContracts
- StakeContractConfig
- TG4Member
- ValidatorVotingContractConfig
- ValsetContractConfig
- VotingRules
-
confio/poe/v1beta1/query.proto
GenesisState - initial state of module
Field | Type | Label | Description |
---|---|---|---|
params |
Params | Params of this module |
Params defines the set of module parameters.
Field | Type | Label | Description |
---|---|---|---|
minimum_gas_prices |
cosmos.base.v1beta1.DecCoin | repeated | Minimum stores the minimum gas price(s) for all TX on the chain. When multiple coins are defined then they are accepted alternatively. The list must be sorted by denoms asc. No duplicate denoms or zero amount values allowed. For more information see https://docs.cosmos.network/master/modules/auth/01_concepts.html |
QueryMinimumGasPricesRequest is the request type for the Query/MinimumGasPrices RPC method.
QueryMinimumGasPricesResponse is the response type for the Query/MinimumGasPrices RPC method.
Field | Type | Label | Description |
---|---|---|---|
minimum_gas_prices |
cosmos.base.v1beta1.DecCoin | repeated |
Query defines the gRPC querier service.
Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
---|---|---|---|---|---|
MinimumGasPrices |
QueryMinimumGasPricesRequest | QueryMinimumGasPricesResponse | GET | /tgrade/globalfee/v1beta1/minimum_gas_prices |
Params defines the parameters for the PoE module.
Field | Type | Label | Description |
---|---|---|---|
historical_entries |
uint32 | HistoricalEntries is the number of historical entries to persist. | |
initial_val_engagement_points |
uint64 | InitialValEngagementPoints defines the number of engagement for any new validator joining post genesis | |
min_delegation_amounts |
cosmos.base.v1beta1.Coin | repeated | MinDelegationAmount defines the minimum amount a post genesis validator needs to self delegate to receive any engagement points. One must be exceeded. No minimum condition set when empty. |
PoEContractType type of PoE contract
Name | Number | Description |
---|---|---|
UNDEFINED | 0 | |
STAKING | 1 | |
VALSET | 2 | |
ENGAGEMENT | 3 | |
MIXER | 4 | |
DISTRIBUTION | 5 | |
OVERSIGHT_COMMUNITY | 6 | |
OVERSIGHT_COMMUNITY_PROPOSALS | 7 | |
COMMUNITY_POOL | 8 | |
VALIDATOR_VOTING | 9 | |
ARBITER_POOL | 10 | |
ARBITER_POOL_VOTING | 11 |
ArbiterPoolContractConfig initial setup config for the trusted circle
Field | Type | Label | Description |
---|---|---|---|
name |
string | Name of TRUSTED_CIRCLE | |
escrow_amount |
cosmos.base.v1beta1.Coin | EscrowAmount The required escrow amount, in the default denom (utgd) | |
voting_rules |
VotingRules | VotingRules rules for the tally | |
deny_list_contract_address |
string | DenyListContractAddress is an optional cw4 contract with list of addresses denied to be part of TrustedCircle | |
dispute_cost |
cosmos.base.v1beta1.Coin | DisputeCost The required dispute amount, in the default denom (utgd) | |
waiting_period |
google.protobuf.Duration |
CommunityPoolContractConfig initial setup config for the contract
Field | Type | Label | Description |
---|---|---|---|
voting_rules |
VotingRules | VotingRules rules for the tally |
EngagementContractConfig initial setup config
Field | Type | Label | Description |
---|---|---|---|
halflife |
google.protobuf.Duration |
GenesisState - initial state of module
Field | Type | Label | Description |
---|---|---|---|
params |
Params | params defines all the parameter of the module | |
seed_contracts |
SeedContracts | SeedContracts stores and instantiates the Proof of Engagement contracts on the chain. | |
import_dump |
ImportDump | ImportDump restores the state from an exported state genesis |
ImportDump has all module data for non seed mode.
Field | Type | Label | Description |
---|---|---|---|
contracts |
PoEContract | repeated | Contracts PoE contract addresses and types |
Mixer contract setup. See https://github.com/confio/poe-contracts/tree/main/contracts/tg4-mixer
Field | Type | Label | Description |
---|---|---|---|
sigmoid |
MixerContractConfig.Sigmoid | Sigmoid returns a sigmoid-like value of staked amount times engagement points. See the Proof-of-Engagement white-paper for details. |
Field | Type | Label | Description |
---|---|---|---|
max_points |
uint64 | ||
p |
string | ||
s |
string |
OversightCommitteeContractConfig initial setup config for the trusted circle
Field | Type | Label | Description |
---|---|---|---|
name |
string | Name of TRUSTED_CIRCLE | |
escrow_amount |
cosmos.base.v1beta1.Coin | EscrowAmount The required escrow amount, in the default denom (utgd) | |
voting_rules |
VotingRules | VotingRules rules for the tally | |
deny_list_contract_address |
string | DenyListContractAddress is an optional cw4 contract with list of addresses denied to be part of TrustedCircle |
PoEContract address and type information
Field | Type | Label | Description |
---|---|---|---|
contract_type |
PoEContractType | ContractType type. | |
address |
string | Address is the bech32 address string |
SeedContracts contains the contract configuration and group members to setup all PoE contracts on chain.
Field | Type | Label | Description |
---|---|---|---|
gen_txs |
bytes | repeated | GenTxs defines the genesis transactions to create a validator. |
bootstrap_account_address |
string | BootstrapAccountAddress single address that is set as bootstrap-account for the PoE contracts in seed mode. | |
engagement |
TG4Member | repeated | Engagement weighted members of the engagement group. Validators should be in here. |
stake_contract_config |
StakeContractConfig | ||
valset_contract_config |
ValsetContractConfig | ||
engagement_contract_config |
EngagementContractConfig | ||
bond_denom |
string | BondDenom defines the bondable coin denomination. | |
oversight_committee_contract_config |
OversightCommitteeContractConfig | ||
community_pool_contract_config |
CommunityPoolContractConfig | ||
validator_voting_contract_config |
ValidatorVotingContractConfig | ||
oversight_community_members |
string | repeated | |
arbiter_pool_members |
string | repeated | |
arbiter_pool_contract_config |
ArbiterPoolContractConfig | ||
mixer_contract_config |
MixerContractConfig |
StakeContractConfig initial setup config
Field | Type | Label | Description |
---|---|---|---|
min_bond |
uint64 | ||
tokens_per_point |
uint64 | ||
unbonding_period |
google.protobuf.Duration | ||
claim_autoreturn_limit |
uint32 |
TG4Member member of the Engagement group.
Field | Type | Label | Description |
---|---|---|---|
address |
string | Address is the bech32 address string | |
points |
uint64 |
ValidatorVotingContractConfig CommunityPoolContractConfig
Field | Type | Label | Description |
---|---|---|---|
voting_rules |
VotingRules | VotingRules rules for the tally |
ValsetContractConfig initial setup config
Field | Type | Label | Description |
---|---|---|---|
min_points |
uint64 | ||
max_validators |
uint32 | MaxValidators The maximum number of validators that can be included in the Tendermint validator set. | |
epoch_length |
google.protobuf.Duration | EpochLength We update the Tendermint validator set only once per epoch. Epoch # is env.block.time/epoch_length (round down). The first block with a new epoch number will trigger a new validator calculation. | |
epoch_reward |
cosmos.base.v1beta1.Coin | ||
scaling |
uint32 | Scaling is the factor to multiply cw4-group weights to produce the Tendermint validator power | |
fee_percentage |
string | FeePercentage is the percentage of total accumulated fees that is subtracted from tokens minted as rewards. 50% by default. To disable this feature just set it to 0 (which effectively means that fees don't affect the per-epoch reward). | |
community_pool_reward_ratio |
string | CommunityPoolRewardRation in percentage | |
engagement_reward_ratio |
string | EngagementRewardRatio reward ration in percentage for all | |
validator_reward_ratio |
string | ValidatorRewardRation in percentage for all | |
auto_unjail |
bool | AutoUnjail if set to true, we will auto-unjail any validator after their jailtime is over. | |
double_sign_slash_ratio |
string | DoubleSignSlashRatio Validators who are caught double signing are jailed forever and their bonded tokens are slashed based on this value. | |
verify_validators |
bool | When a validator joins the valset, verify they sign the first block since joining or jail them for a period otherwise. |
The verification happens every time the validator becomes an active validator, including when they are unjailed or when they just gain enough power to participate. |
| offlineJailDuration
| google.protobuf.Duration | | OfflineJailDuration duration to jail a validator for in case they don't sign their first epoch boundary block. After the period, they have to pass verification again, ad infinitum. |
VotingRules contains configuration for the tally.
Field | Type | Label | Description |
---|---|---|---|
voting_period |
uint32 | VotingPeriod Voting period in days | |
quorum |
string | Quorum voting quorum percentage (1-100) | |
threshold |
string | Threshold voting threshold percentage (50-100) | |
allow_end_early |
bool | AllowEndEarly If true, and absolute threshold and quorum are met, we can end before voting period finished. (Recommended value: true, unless you have special needs) |
QueryContractAddressRequest is the request type for the Query/ContractAddress RPC method.
Field | Type | Label | Description |
---|---|---|---|
contract_type |
PoEContractType | ContractType is the type of contract |
QueryContractAddressRequest is the response type for the Query/ContractAddress RPC method.
Field | Type | Label | Description |
---|---|---|---|
address |
string |
QueryUnbondingPeriodRequest is request type for the Query/UnbondingPeriod RPC method
QueryUnbondingPeriodResponse is response type for the Query/UnbondingPeriod RPC method
Field | Type | Label | Description |
---|---|---|---|
time |
google.protobuf.Duration | Time is the time that must pass |
QueryValidatorDelegationRequest is request type for the Query/ValidatorDelegation RPC method
Field | Type | Label | Description |
---|---|---|---|
validator_addr |
string | validator_addr defines the validator address to query for. |
QueryValidatorDelegationResponse is response type for the Query/ValidatorDelegation RPC method
Field | Type | Label | Description |
---|---|---|---|
balance |
cosmos.base.v1beta1.Coin |
QueryValidatorEngagementRewardRequest is the request type for the Query/ValidatorEngagementReward RPC method.
Field | Type | Label | Description |
---|---|---|---|
validator_address |
string | validator_address defines the validator address to query for. |
QueryValidatorEngagementRewardResponse is the response type for the Query/ValidatorEngagementReward RPC method.
Field | Type | Label | Description |
---|---|---|---|
reward |
cosmos.base.v1beta1.DecCoin |
QueryValidatorOutstandingRewardRequest is the request type for the Query/ValidatorOutstandingReward RPC method.
Field | Type | Label | Description |
---|---|---|---|
validator_address |
string | validator_address defines the validator address to query for. |
QueryValidatorOutstandingRewardResponse is the response type for the Query/ValidatorOutstandingReward RPC method.
Field | Type | Label | Description |
---|---|---|---|
reward |
cosmos.base.v1beta1.DecCoin |
QueryValidatorUnbondingDelegationsRequest is required type for the Query/ValidatorUnbondingDelegations RPC method
Field | Type | Label | Description |
---|---|---|---|
validator_addr |
string | validator_addr defines the validator address to query for. | |
pagination |
cosmos.base.query.v1beta1.PageRequest | pagination defines an optional pagination for the request. |
QueryValidatorUnbondingDelegationsResponse is response type for the Query/ValidatorUnbondingDelegations RPC method.
Field | Type | Label | Description |
---|---|---|---|
entries |
cosmos.staking.v1beta1.UnbondingDelegationEntry | repeated | unbonding delegation entries |
pagination |
cosmos.base.query.v1beta1.PageResponse | pagination defines the pagination in the response. |
Query defines the gRPC querier service.
Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
---|---|---|---|---|---|
ContractAddress |
QueryContractAddressRequest | QueryContractAddressResponse | ContractAddress queries the address for one of the PoE contracts | GET | /tgrade/poe/v1beta1/contract/{contract_type} |
Validators |
.cosmos.staking.v1beta1.QueryValidatorsRequest | .cosmos.staking.v1beta1.QueryValidatorsResponse | Validators queries all validators that match the given status. | GET | /tgrade/poe/v1beta1/validators |
Validator |
.cosmos.staking.v1beta1.QueryValidatorRequest | .cosmos.staking.v1beta1.QueryValidatorResponse | Validator queries validator info for given validator address. | GET | /tgrade/poe/v1beta1/validators/{validator_addr} |
UnbondingPeriod |
QueryUnbondingPeriodRequest | QueryUnbondingPeriodResponse | Validator queries validator info for given validator address. | GET | /tgrade/poe/v1beta1/unbonding |
ValidatorDelegation |
QueryValidatorDelegationRequest | QueryValidatorDelegationResponse | ValidatorDelegation queries self delegated amount for given validator. | GET | /poe/tgrade/v1beta1/validators/{validator_addr}/delegation |
ValidatorUnbondingDelegations |
QueryValidatorUnbondingDelegationsRequest | QueryValidatorUnbondingDelegationsResponse | ValidatorUnbondingDelegations queries unbonding delegations of a validator. | GET | /tgrade/poe/v1beta1/validators/{validator_addr}/unbonding_delegations |
HistoricalInfo |
.cosmos.staking.v1beta1.QueryHistoricalInfoRequest | .cosmos.staking.v1beta1.QueryHistoricalInfoResponse | HistoricalInfo queries the historical info for given height. | GET | /tgrade/poe/v1beta1/historical_info/{height} |
ValidatorOutstandingReward |
QueryValidatorOutstandingRewardRequest | QueryValidatorOutstandingRewardResponse | ValidatorOutstandingRewards queries rewards of a validator address. | GET | /tgrade/poe/v1beta1/validators/{validator_address}/outstanding_reward |
ValidatorEngagementReward |
QueryValidatorEngagementRewardRequest | QueryValidatorEngagementRewardResponse | ValidatorEngagementReward queries rewards of a validator address. | GET | /tgrade/poe/v1beta1/validators/{validator_address}/engagement_reward |
MsgCreateValidator defines a PoE message for creating a new validator. Based on the SDK staking.MsgCreateValidator
Field | Type | Label | Description |
---|---|---|---|
description |
cosmos.staking.v1beta1.Description | Description meta data | |
operator_address |
string | OperatorAddress is the bech32 address string | |
pubkey |
google.protobuf.Any | Pubkey public key | |
amount |
cosmos.base.v1beta1.Coin | Amount defines the initial staking amount from a liquid balance | |
vesting_amount |
cosmos.base.v1beta1.Coin | VestingAmount defines the initial staking amount from a vesting account balance |
MsgCreateValidatorResponse defines the MsgCreateValidator response type.
MsgDelegate defines a SDK message for performing a self delegation of coins by a node operator
Field | Type | Label | Description |
---|---|---|---|
operator_address |
string | ||
amount |
cosmos.base.v1beta1.Coin | ||
vesting_amount |
cosmos.base.v1beta1.Coin |
MsgDelegateResponse defines the Msg/Delegate response type.
MsgUndelegate defines a SDK message for performing an undelegation from a node operator
Field | Type | Label | Description |
---|---|---|---|
operator_address |
string | ||
amount |
cosmos.base.v1beta1.Coin |
MsgUndelegateResponse defines the Msg/Undelegate response type.
Field | Type | Label | Description |
---|---|---|---|
completion_time |
google.protobuf.Timestamp |
MsgCreateValidator defines a PoE message for updating validator metadata
Field | Type | Label | Description |
---|---|---|---|
description |
cosmos.staking.v1beta1.Description | New Description meta data | |
operator_address |
string | OperatorAddress is the bech32 address string Also know as "signer" in other messages |
MsgUpdateValidatorResponse defines the MsgUpdateValidator response type.
Msg defines the staking Msg service.
Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
---|---|---|---|---|---|
CreateValidator |
MsgCreateValidator | MsgCreateValidatorResponse | CreateValidator defines a method for creating a new validator. | ||
UpdateValidator |
MsgUpdateValidator | MsgUpdateValidatorResponse | MsgCreateValidator defines a method for updating validator metadata | ||
Delegate |
MsgDelegate | MsgDelegateResponse | Delegate defines a method for performing a self delegation of coins by a node operator | ||
Undelegate |
MsgUndelegate | MsgUndelegateResponse | Undelegate defines a method for performing an undelegation from a node operator |
RegisteredPrivilege stores position and privilege name
Field | Type | Label | Description |
---|---|---|---|
position |
uint32 | ||
privilege_type |
string |
TgradeContractDetails is a custom extension to the wasmd ContractInfo
Field | Type | Label | Description |
---|---|---|---|
registered_privileges |
RegisteredPrivilege | repeated |
Contract struct encompasses ContractAddress, ContractInfo, and ContractState
Field | Type | Label | Description |
---|---|---|---|
contract_address |
string | ||
contract_info |
cosmwasm.wasm.v1.ContractInfo | ||
kv_model |
KVModel | ||
custom_model |
CustomModel |
CustomModel contains the raw json data for a contract to seed its state on import
Field | Type | Label | Description |
---|---|---|---|
msg |
bytes | Msg json encoded message to be passed to the contract on import |
Field | Type | Label | Description |
---|---|---|---|
params |
cosmwasm.wasm.v1.Params | Params sdk type Params for wasmd | |
codes |
cosmwasm.wasm.v1.Code | repeated | Codes has all stored wasm codes and metadata |
contracts |
Contract | repeated | Contracts contains all instantiated contracts, state and metadata |
sequences |
cosmwasm.wasm.v1.Sequence | repeated | Sequences names and values |
gen_msgs |
cosmwasm.wasm.v1.GenesisState.GenMsgs | repeated | GenMsgs has wasmd sdk type messages to execute in the genesis phase |
privileged_contract_addresses |
string | repeated | PrivilegedContractAddresses is a list of contract addresses that can have special permissions |
pinned_code_ids |
uint64 | repeated | PinnedCodeIDs has codeInfo ids for wasm codes that are pinned in cache |
KVModel is a wrapper around the wasmd default key value model.
Field | Type | Label | Description |
---|---|---|---|
models |
cosmwasm.wasm.v1.Model | repeated |
PromoteToPrivilegedContractProposal gov proposal content type to remove "privileges" from a contract
Field | Type | Label | Description |
---|---|---|---|
title |
string | Title is a short summary | |
description |
string | Description is a human readable text | |
contract |
string | Contract is the address of the smart contract |
PromoteToPrivilegedContractProposal gov proposal content type to add "privileges" to a contract
Field | Type | Label | Description |
---|---|---|---|
title |
string | Title is a short summary | |
description |
string | Description is a human readable text | |
contract |
string | Contract is the address of the smart contract |
QueryContractsByPrivilegeTypeRequest is the request type for the Query/ContractsByPrivilegeType RPC method
Field | Type | Label | Description |
---|---|---|---|
privilege_type |
string |
QueryContractsByPrivilegeTypeResponse is the response type for the Query/ContractsByPrivilegeType RPC method
Field | Type | Label | Description |
---|---|---|---|
contracts |
string | repeated | contracts are a set of contract addresses |
QueryPrivilegedContractsResponse is the request type for the Query/PrivilegedContracts RPC method
QueryPrivilegedContractsResponse is the response type for the Query/PrivilegedContracts RPC method
Field | Type | Label | Description |
---|---|---|---|
contracts |
string | repeated | contracts are a set of contract addresses |
Query provides defines the gRPC querier service
Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
---|---|---|---|---|---|
PrivilegedContracts |
QueryPrivilegedContractsRequest | QueryPrivilegedContractsResponse | PrivilegedContracts returns all privileged contracts | GET | /tgrade/twasm/v1beta1/contracts/privileged |
ContractsByPrivilegeType |
QueryContractsByPrivilegeTypeRequest | QueryContractsByPrivilegeTypeResponse | ContractsByPrivilegeType returns all contracts that have registered for the privilege type | GET | /tgrade/twasm/v1beta1/contracts/privilege/{privilege_type} |
tgrade keys add my-key
tgrade keys add my-other-key --recover
tgrade keys show -a my-key
tgrade q bank balances tgrade1mdcqr6r3fwxkxwvu5zee7hgpqmhr4a4jm59m3d --node=https://rpc.internal-12.tgrade.confio.run:443
tgrade tx bank send my-other-key tgrade1mdcqr6r3fwxkxwvu5zee7hgpqmhr4a4jm59m3d 10tgd -b block --chain-id=tgrade-internal-12 --node=https://rpc.internal-12.tgrade.confio.run:443 --fees=10000utgd
Join the Tgrade discord to ask questions or to meet others also building on Tgrade to discuss strategies, best practices etc...