| Crates.io | astroport-generator |
| lib.rs | astroport-generator |
| version | 2.3.2 |
| created_at | 2023-07-20 16:58:20.044047+00 |
| updated_at | 2024-03-26 11:41:09.49215+00 |
| description | Astroport Generator |
| homepage | https://astroport.fi |
| repository | https://github.com/astroport-fi/astroport |
| max_upload_size | |
| id | 921539 |
| size | 364,475 |
The Generator contract allocates token rewards (ASTRO) for various LP tokens and distributes them pro-rata to LP stakers. The Generator supports proxy staking via 3rd party contracts that offer a second reward besides ASTRO token emissions.
Initializes the contract with required addresses and contracts used for reward distributions.
{
"owner": "terra...",
"astro_token": "terra...",
"tokens_per_block": "123",
"start_block": "123",
"vesting_contract": "terra..."
}
update_configUpdate the vesting contract address, generator controller contract address or generator guardian address. Only the contract owner can execute this.
{
"update_config": {
"vesting_contract": "terra...",
"generator_controller": "terra...",
"guardian": "terra...",
"voting_escrow": "terra...",
"generator_limit": 20
}
}
setup_poolsSet up a new list of pools with allocation points.
{
"setup_pools": {
"pools" : [
[
"terra...",
"60"
],
[
"terra...",
"40"
]
]
}
}
update_poolUpdate has_asset_rewards parameter for the given pool.
{
"update_pool": {
"lp_token": "terra...",
"has_asset_rewards": true
}
}
claim_rewardsUpdate rewards and return it to user.
{
"claim_rewards": {
"lp_tokens": ["terra...", "terra...", "terra..."]
}
}
receiveCW20 receive msg.
{
"receive": {
"sender": "terra...",
"amount": "123",
"msg": "<base64_encoded_json_string>"
}
}
depositStakes LP tokens in a specific generator (inside the Generator contract). In order to stake in the Generator contract, you should execute this message inside the contract of the LP token you want to stake.
{
"send": {
"contract": <GeneratorContractAddress>,
"amount": "999",
"msg": "base64-encodedStringOfWithdrawMsg"
}
}
Inside send.msg, you may encode this JSON string into base64 encoding:
{
"deposit": {}
}
depositForStakes LP tokens in the Generator on behalf of another address. In order to stake in the Generator contract, you should execute this message inside the LP token you want to stake.
{
"send": {
"contract": <GeneratorContractAddress>,
"amount": "999",
"msg": "base64-encodedStringOfWithdrawMsg"
}
}
In send.msg, you may encode this JSON string into base64 encoding:
{
"deposit_for": "terra..."
}
withdrawUnstakes LP tokens from the Generator contract and claims outstanding token emissions.
{
"withdraw": {
"lp_token": "terra...",
"amount": "123"
}
}
emergency_withdrawUnstakes LP tokens without caring about rewards. To be used only in emergencies such as a critical bug found in the Generator contract.
{
"emergency_withdraw": {
"lp_token": "terra..."
}
}
send_orphan_rewardSends orphaned rewards (left behind by emergency withdraws) to another address. Only the contract owner can transfer orphan rewards.
{
"send_orphan_reward": {
"recipient": "terra...",
"lp_token": "terra..."
}
}
set_tokens_per_blockSets the total amount of ASTRO distributed per block among all active generators. Only the owner can execute this.
{
"set_tokens_per_block": {
"amount": "123"
}
}
propose_new_ownerCreates a request to change contract ownership. The validity period of the offer is set by the expires_in variable. Only the current owner can execute this.
{
"propose_new_owner": {
"owner": "terra...",
"expires_in": 1234567
}
}
drop_ownership_proposalRemoves the existing offer to change contract ownership. Only the contract owner can execute this.
{
"drop_ownership_proposal": {}
}
claim_ownershipUsed by the newly proposed contract owner to claim contract ownership.
{
"claim_ownership": {}
}
move_to_proxyChange the current dual rewards proxy for a specific LP token. Only the contract owner can execute this.
{
"move_to_proxy": {
"lp_token": "terra...",
"proxy": "terra..."
}
}
update_tokens_blockedlistAdd or remove tokens to and from the tokens blocked list. Only the owner contract or generator guardian can execute this.
{
"update_tokens_blockedlist": {
"add": ["terra...", "terra..."],
"remove": ["terra...", "terra...", "terra..."]
}
}
deactivate_poolSets the allocation point to zero for specified pool. Only the factory contract can execute this.
{
"deactivate_pool": {
"lp_token": "terra..."
}
}
deactivate_poolsSets the allocation point to zero for each pool by the pair type.
{
"deactivate_pool": {
"pair_types": [{"xyk": {}}, {"stable": {}}]
}
}
checkpoint_user_boostUpdates emissions boost for specified generators
{
"checkpoint_user_boost": {
"generators": ["terra...", "terra..."],
"user": "terra..."
}
}
All query messages are described below. A custom struct is defined for each query response.
pool_lengthReturns the total amount of generators that have been created until now.
{
"pool_length": {}
}
depositReturns the amount of a specific LP token that a user currently has staked in the Generator.
{
"deposit": {
"lp_token": "terra...",
"user": "terra..."
}
}
pending_tokenReturns the amount of pending ASTRO and 3rd party token rewards that can be claimed by a user that staked a specific LP token.
{
"pending_token": {
"lp_token": "terra...",
"user": "terra..."
}
}
configReturns the main Generator contract configuration.
{
"config": {}
}
orphan_proxy_rewardsReturns the amount of orphaned proxy rewards left behind by emergency withdrawals.
{
"orphan_proxy_rewards": {
"lp_token": "terra..."
}
}
reward_infoReturns information about token emissions for the specified LP token.
{
"reward_info": {
"lp_token": "terra..."
}
}
pool_infoReturns pool information for the specified LP token.
{
"pool_info": {
"lp_token": "terra..."
}
}
simulate_future_rewardReturns the amount of ASTRO that will be distributed up to a future block and for a specific LP token.
{
"simulate_future_reward": {
"lp_token": "terra...",
"future_block": 999
}
}
list_of_stakersReturns a list of stakers that currently have funds in a specific generator.
{
"list_of_stakers": {
"lp_token": "terra...",
"start_after": "terra...",
"limit": 5
}
}
blocked_tokens_listReturns the list of blocked tokens
{
"blocked_tokens_list": {}
}
active_pool_lengthReturns the total amount of active generators.
{
"active_pool_length": {}
}
user_virtual_amountReturns the current virtual amount in a specific generator
{
"user_virtual_amount": {
"lp_token": "terra...",
"user": "terra..."
}
}
total_virtual_amountReturns the total virtual supply of generator
{
"total_virtual_amount": {
"lp_token": "terra..."
}
}
reward_proxies_listReturns a list of reward proxy contracts which have been ever used
{
"reward_proxies_list": {}
}