Skip to main content
logo

delegator

The purpose of this contract is to bootstrap the security of Mars Hub blockchain.

At launch, Mars Hub will have a genesis validator set of 10–20 members, each having exactly 1 MARS token. The decision was made that each genesis validator only gets 1 token and not more, such that they don't have an unfair advantage over those who join post-genesis. However, this also means that for a brief period after launch, the network will have a very low security (10–20 MARS worth of security, to be specific). If a user is eligible for a big airdrop, they can potentially create a validator with the airdrop tokens right after launch and hijack the network.

To mitigate this risk, the Mars community pool will have a portion of its tokens (~1% of total supply may be a reasonable amount) deposited into this "delegator" contract, which then delegates the tokens evenly to each of the genesis validators. At instantiation, the contract will be given an ending_time for these delegations. Once the ending time is elapsed, anyone can invoke a method on the contract to unbond these delegations. Once unbonding is completed, anyone can invoke refund to return all funds to the community pool.

InstantiateMsg

Instantiates the Delegator contract.

json
msg.rs
Copy

_4
{
_4
"bond_denom": "...",
_4
"ending_time": 123
_4
}

ParamsTypeDescription
bond_denomStringDenomination of the coin that will be staked
ending_timeu64The ending time for the delegation program, as UNIX timestamp. Once this time has elapsed, anyone can invoke the unbond method to unbond the delegations. Additionally, Mars Hub governance can decide to prematurely end the delegation program if they see fit, ignoring the ending time, by invoking the force_unbond sudo message.

ExecuteMsg

bond

Delegate tokens that the contract holds evenly to the current validator set.

json
msg.rs
Copy

_3
{
_3
"bond": {}
_3
}

unbond

Unbond the delegations. Can be invoked by anyone after ending_time is reached.

json
msg.rs
Copy

_3
{
_3
"unbond": {}
_3
}

refund

Donate all coins held by the contract to the community pool.

json
msg.rs
Copy

_3
{
_3
"refund": {}
_3
}

SudoMsg

Forcibly unbond the delegations.

This "sudo" message can only be invoked by the gov module, and ignores whether the ending_time has been reached.

force_unbond

json
msg.rs
Copy

_3
{
_3
"force_unbond": {}
_3
}

QueryMsg

config

Return the contract configuration.

json
msg.rs
Copy

_3
{
_3
"config": {}
_3
}

Config (response)