Skip to main content

Dual Rewards

Overview

Integrating dual rewards combines the previous two tutorials in this section (adjusting allocation points and integrating proxy contracts) within 1 proposal message. Adjusting allocation points adjusts the amount of ASTRO emissions pool's receive while integrating proxy contracts enables third-party token rewards.

A proposal message that combines both effectively enables Dual Rewards for a given pool.

Prerequisites

Using the Astroport Web App

Use when submitting a proposal to integrate Dual Rewards through the Astroport Web App. This tutorial walks through the complete and encoded proposal. To learn more about each Executable Messages in the proposal, visit the tutorials in prerequisites.

Complete Proposal

The complete proposal that we would submit to the Astroport Web App combines our two previous proposals into one. Note that integrating proxy contracts requires 2 proposals itself (set_allowed_reward_proxies and move_to_proxy). In total, the proposal for Dual Rewards should contain 3 executable messages, the last one pointing to the setup_pools endpoint in the Generator contract.

For more details on structuring each message, visit ASTRO Allocation Points and Proxy Contracts.


_68
[
_68
{
_68
{
_68
"wasm": {
_68
"execute": {
_68
"contract_addr": generatorAddress,
_68
"msg": toBase64(
_68
{
_68
"setup_pools": {
_68
"pools": [
_68
[
_68
"terra...",
_68
"1538"
_68
],
_68
[
_68
"terra...",
_68
"30018"
_68
],
_68
etc...
_68
]
_68
}
_68
}
_68
),
_68
"funds": []
_68
}
_68
}
_68
}
_68
},
_68
{
_68
{
_68
"wasm": {
_68
"execute": {
_68
"contract_addr": generatorAddress,
_68
"msg": toBase64(
_68
{
_68
"set_allowed_reward_proxies": {
_68
"proxies": [
_68
"terra...",
_68
"terra...",
_68
etc...
_68
]
_68
}
_68
}
_68
),
_68
"funds": []
_68
}
_68
}
_68
}
_68
},
_68
{
_68
{
_68
"wasm": {
_68
"execute": {
_68
"contract_addr": generatorAddress,
_68
"msg": toBase64(
_68
{
_68
"move_to_proxy": {
_68
"lp_token": exLPToken,
_68
"proxy": exProxyAddress
_68
}
_68
}
_68
),
_68
"funds": []
_68
}
_68
}
_68
}
_68
}
_68
]

Encoded Proposal

After encoding each contract call, our final Executable Message that we would submit to the Astroport Web App to integrate dual rewards ends up looking something like the code in this section.

You can see our each contract call to the setup_pools, set_allowed_reward_proxies, and move_to_proxy endpoints by decoding our msgs using a Base64 decoder.


_35
[
_35
{
_35
{
_35
"wasm": {
_35
"execute": {
_35
"contract_addr": "terra1gc4d4v82vjgkz0ag28lrmlxx3tf6sq69tmaujjpe7jwmnqakkx0qm28j2l",
_35
"msg": "ewogICJzZXR1cF9wb29scyI6IHsKICAgICJwb29scyIgOiBbCiAgICAgIFsKICAgICAgICAidGVycmExOG1jbWxmNHYyM2VodWtraDdxeGdwZjV0em56ZzY4OTNmeG1mOWZmbWR0OXBoZ2YzNjV6cXZtbHVnNiIsCiAgICAgICAgIjE1MzgiCiAgICAgIF0sCiAgICAgIFsKICAgICAgICAidGVycmExNmVzams3cXFsZ2g4dzdwMmE1OHl4aGdrZms0eWt2NzJwN2hhMDU2enVsNThhZHpqbTZtc3ZjNjc0dCIsCiAgICAgICAgIjMwMDE4IgogICAgICBdLAogICAgICBbCiAgICAgICAgInRlcnJhMWNrbXNxZGhsa3k5anhjbXR5ajY0Y3Jnemp4YWQ5cHZzZDU4azh6c3hzbnY0dnp2d2R0N3FrZTA0aGwiLAogICAgICAgICI0MDAyNiIKICAgICAgXSwKICAgICAgWwogICAgICAgICJ0ZXJyYTFrZ2dmZDZ6MGFkMms5cTh2MjRmN2Z0eHlxdXNoOGZwOXhrdTlueXJqY3Myd3YwZTRreXBzemZyZmQwIiwKICAgICAgICAiNjY2NiIKICAgICAgXSwKICAgICAgWwogICAgICAgICJ0ZXJyYTFjcTIyZXVneHdncDB4MzRjcWZyeG1kOWpreXk0M2dhczkzeXFqaG13cm03ajBoNWVjcnFxNWo3ZGdwIiwKICAgICAgICAiNjY2NiIKICAgICAgXSwKICAgICAgWwogICAgICAgICJ0ZXJyYTFraHN4d2ZuenV4cWN5emEyc3JheGYybmdrcjNkd3k5ZjdybTB1dHMweHBrZXNoczk2Y2NzcXR1Nm52IiwKICAgICAgICAiMTEyNTciCiAgICAgIF0sCiAgICAgIFsKICAgICAgICAidGVycmExaDN6Mnp2NmF3OTRmeDUyNjNkeTZ0Z3o2Njk5a3htZXdseDN2cmN1NGpqcnVkZzZ4bXR5cWs2dnQwdSIsCiAgICAgICAgIjY2NjYiCiAgICAgIF0sCiAgICAgIFsKICAgICAgICAidGVycmExY2VzNms2anA3cXpranB3c2w2eGc0Zjd6ZndyZTB1MjNjZ2xnNjloaGozZzIwZmh5Z3Rwc3UyNGRzeSIsCiAgICAgICAgIjIxNTIiCiAgICAgIF0KICAgIF0KICB9Cn0=",
_35
"funds": []
_35
}
_35
}
_35
}
_35
},
_35
{
_35
{
_35
"wasm": {
_35
"execute": {
_35
"contract_addr": "terra1gc4d4v82vjgkz0ag28lrmlxx3tf6sq69tmaujjpe7jwmnqakkx0qm28j2l",
_35
"msg": "ewogICAgInNldF9hbGxvd2VkX3Jld2FyZF9wcm94aWVzIjogewogICAgICAgICJwcm94aWVzIjogWwogICAgICAgICAgJ3RlcnJhMTRld3ZxMzl2ZzIzajBoY2VzZWN2Nmhremt3a3ZybnV4emQ1c2RkbXJ5OWx4NnFyaGF4Y3FqZHg2ZXInLAogICAgICAgICAgJ3RlcnJhMTV5dXE2NGxwNzRkZjBkNXBkY213emVwODBqMGFhNGhzM2ZrdHF5dXB6NGE4MmF5dmR3MnM0cmR5a3YnLAogICAgICAgICAgJ3RlcnJhMTJqdnptMmN5MzN6c3B2cDhhc243bnM5OGpteWs0ODllczJjeTJqOGs5MjZtcjJuN21ldHFoYTQzMHEnLAogICAgICAgICAgJ3RlcnJhMXlhcTQyM2trbTV1bTgzdnhhYXAyMHJ6a255OWhobGhxYWQ4d3pkYzQzejIwY214bXVranF6NDZlMGYnLAogICAgICAgICAgJ3RlcnJhMXkzcGpuNmcwYXd6cGttZTJuZnA0bnp1NzVhZTZ3dWhkZnp0ZG4ycHFqdTV0bHpoa3BoanE1c3QydHMnCiAgICAgICAgXQogICAgfQp9",
_35
"funds": []
_35
}
_35
}
_35
}
_35
},
_35
{
_35
{
_35
"wasm": {
_35
"execute": {
_35
"contract_addr": "terra1gc4d4v82vjgkz0ag28lrmlxx3tf6sq69tmaujjpe7jwmnqakkx0qm28j2l",
_35
"msg": "ewogICAgIm1vdmVfdG9fcHJveHkiOiB7CiAgICAgICAgImxwX3Rva2VuIjogInRlcnJhMXM0bHMwYW1rNTZ2dmZndjVqdnNkYWN2cjM5cjNhNzZwNDl3Z3BsdjByMjdueHQ3ZzN1Z3Fwd3VsOTciLAogICAgICAgICJwcm94eSI6ICJ0ZXJyYTF5M3BqbjZnMGF3enBrbWUybmZwNG56dTc1YWU2d3VoZGZ6dGRuMnBxanU1dGx6aGtwaGpxNXN0MnRzIgogICAgfSAKfQ==",
_35
"funds": []
_35
}
_35
}
_35
}
_35
}
_35
]

Complete Proposal

The complete proposal that we would submit to the Astroport Web App combines our two previous proposals into one. Note that integrating proxy contracts requires 2 proposals itself (set_allowed_reward_proxies and move_to_proxy). In total, the proposal for Dual Rewards should contain 3 executable messages, the last one pointing to the setup_pools endpoint in the Generator contract.

For more details on structuring each message, visit ASTRO Allocation Points and Proxy Contracts.

Encoded Proposal

After encoding each contract call, our final Executable Message that we would submit to the Astroport Web App to integrate dual rewards ends up looking something like the code in this section.

You can see our each contract call to the setup_pools, set_allowed_reward_proxies, and move_to_proxy endpoints by decoding our msgs using a Base64 decoder.


_68
[
_68
{
_68
{
_68
"wasm": {
_68
"execute": {
_68
"contract_addr": generatorAddress,
_68
"msg": toBase64(
_68
{
_68
"setup_pools": {
_68
"pools": [
_68
[
_68
"terra...",
_68
"1538"
_68
],
_68
[
_68
"terra...",
_68
"30018"
_68
],
_68
etc...
_68
]
_68
}
_68
}
_68
),
_68
"funds": []
_68
}
_68
}
_68
}
_68
},
_68
{
_68
{
_68
"wasm": {
_68
"execute": {
_68
"contract_addr": generatorAddress,
_68
"msg": toBase64(
_68
{
_68
"set_allowed_reward_proxies": {
_68
"proxies": [
_68
"terra...",
_68
"terra...",
_68
etc...
_68
]
_68
}
_68
}
_68
),
_68
"funds": []
_68
}
_68
}
_68
}
_68
},
_68
{
_68
{
_68
"wasm": {
_68
"execute": {
_68
"contract_addr": generatorAddress,
_68
"msg": toBase64(
_68
{
_68
"move_to_proxy": {
_68
"lp_token": exLPToken,
_68
"proxy": exProxyAddress
_68
}
_68
}
_68
),
_68
"funds": []
_68
}
_68
}
_68
}
_68
}
_68
]

Submitting a Proposal Directly

An advantage of submitting a proposal directly using, for example, a js script is that you could perform calculations from query results, pass variables, encode your message automatically, and separate multiple proposal messages into their own modular variables. This comes in handy when submitting 3 separate executable messages.

send

To submit a proposal, you need to execute a contract call pointing to the send endpoint in the xASTRO token contract.

The send operation takes in a:

  • contract - Address where xASTRO tokens are being sent to (Assembly address)
  • amount - Amount to send/stake (30,000 xASTRO for mainnet)
  • msg - Binary encoded messages containing our contract call to submit_proposal

_17
{
_17
"send": {
_17
"contract": assemblyAddress,
_17
"amount": "1000", // testnet deposit amount
_17
"msg": toBase64(
_17
{
_17
"submit_proposal": {
_17
"title": "integrate proxy contract",
_17
"description": "Proposal to integrate 3rd party rewards",
_17
"link": "https://forum.astroport.fi/",
_17
"messages": [setup_pools_msg, allow_proxies_msg, move_to_proxy_msg],
_17
"ibc_channel": "..."
_17
}
_17
}
_17
)
_17
}
_17
}

messages

To learn how to structure your proposal modularly, visit Proxy Contracts. Integrating proxy contracts already requires 2 executable messages (allow_proxies_msg and move_to_proxy_msg). Adjusting allocation points would simply add 1 more message: setup_pools_msg.


_17
{
_17
"send": {
_17
"contract": assemblyAddress,
_17
"amount": "1000", // testnet deposit amount
_17
"msg": toBase64(
_17
{
_17
"submit_proposal": {
_17
"title": "integrate proxy contract",
_17
"description": "Proposal to integrate 3rd party rewards",
_17
"link": "https://forum.astroport.fi/",
_17
"messages": [setup_pools_msg, allow_proxies_msg, move_to_proxy_msg],
_17
"ibc_channel": "..."
_17
}
_17
}
_17
)
_17
}
_17
}

setup_pools_msg

setup_pools_msg is our new proposal message. It contains an order of "1" (modifying the order of the other 2 proposals from our previous tutorial). The proposal message points to the setup_pools endpoint in the Generator contract stored in a binary encoded msg.

setup_pools takes in pools - a vector that contains LP token addresses and allocation points.

To learn more about the setup_pools endpoint and proposal, visit the dedicated guide here.


_27
let setup_pools_msg = {
_27
{
_27
"wasm": {
_27
"execute": {
_27
"contract_addr": generatorAddress,
_27
"msg": toBase64(
_27
{
_27
"setup_pools": {
_27
"pools": [
_27
[
_27
"terra...",
_27
"1538"
_27
],
_27
[
_27
"terra...",
_27
"30018"
_27
],
_27
etc...
_27
]
_27
}
_27
}
_27
),
_27
"funds": []
_27
}
_27
}
_27
}
_27
}

send

To submit a proposal, you need to execute a contract call pointing to the send endpoint in the xASTRO token contract.

The send operation takes in a:

  • contract - Address where xASTRO tokens are being sent to (Assembly address)
  • amount - Amount to send/stake (30,000 xASTRO for mainnet)
  • msg - Binary encoded messages containing our contract call to submit_proposal

messages

To learn how to structure your proposal modularly, visit Proxy Contracts. Integrating proxy contracts already requires 2 executable messages (allow_proxies_msg and move_to_proxy_msg). Adjusting allocation points would simply add 1 more message: setup_pools_msg.

setup_pools_msg

setup_pools_msg is our new proposal message. It contains an order of "1" (modifying the order of the other 2 proposals from our previous tutorial). The proposal message points to the setup_pools endpoint in the Generator contract stored in a binary encoded msg.

setup_pools takes in pools - a vector that contains LP token addresses and allocation points.

To learn more about the setup_pools endpoint and proposal, visit the dedicated guide here.


_17
{
_17
"send": {
_17
"contract": assemblyAddress,
_17
"amount": "1000", // testnet deposit amount
_17
"msg": toBase64(
_17
{
_17
"submit_proposal": {
_17
"title": "integrate proxy contract",
_17
"description": "Proposal to integrate 3rd party rewards",
_17
"link": "https://forum.astroport.fi/",
_17
"messages": [setup_pools_msg, allow_proxies_msg, move_to_proxy_msg],
_17
"ibc_channel": "..."
_17
}
_17
}
_17
)
_17
}
_17
}