Skip to main content

ASTRO Allocation Points

Overview

The Generator contract allocates token rewards (ASTRO) for various LP tokens and distributes them pro-rata to LP stakers. In order to update allocation points (and the distribution of ASTRO emissions), an on-chain proposal must be submitted.

The proposal takes in an executable_message that points to the setup_pools endpoint within the Generator contract. The setup_pools endpoint creates a new list of pools with allocation points and updates the contract’s config.

Using the Astroport Web App

Use when submitting a proposal to adjust allocation points through the Astroport Web App. This tutorial walks you through the Executable Messages field of the proposal.

Vec<ProposalMessage>

The Executable Messages field in our proposal takes in a vector containing objects of type ProposalMessage. Each ProposalMessage requires the following parameters:

  • order: The order of execution of the message
  • msg: Execution message of type CosmosMsg

_29
[
_29
{
_29
{
_29
"wasm": {
_29
"execute": {
_29
"contract_addr": generatorAddress,
_29
"msg": toBase64(
_29
{
_29
"setup_pools": {
_29
"pools" : [
_29
[
_29
"terra18mcmlf4v23ehukkh7qxgpf5tznzg6893fxmf9ffmdt9phgf365zqvmlug6",
_29
"1538"
_29
],
_29
[
_29
"terra16esjk7qqlgh8w7p2a58yxhgkfk4ykv72p7ha056zul58adzjm6msvc674t",
_29
"30018"
_29
],
_29
etc...
_29
]
_29
}
_29
}
_29
),
_29
"funds": []
_29
}
_29
}
_29
}
_29
}
_29
]

wasm

CosmosMsg is an enum that supports various types of messages. To adjust allocation points, our CosmosMsg must be of type wasm. Furthermore, our wasm message must be of type execute. In the backgrund, we are creating a wasm contract call to the setup_pools endpoint in the Generator contract.


_29
[
_29
{
_29
{
_29
"wasm": {
_29
"execute": {
_29
"contract_addr": generatorAddress,
_29
"msg": toBase64(
_29
{
_29
"setup_pools": {
_29
"pools" : [
_29
[
_29
"terra18mcmlf4v23ehukkh7qxgpf5tznzg6893fxmf9ffmdt9phgf365zqvmlug6",
_29
"1538"
_29
],
_29
[
_29
"terra16esjk7qqlgh8w7p2a58yxhgkfk4ykv72p7ha056zul58adzjm6msvc674t",
_29
"30018"
_29
],
_29
etc...
_29
]
_29
}
_29
}
_29
),
_29
"funds": []
_29
}
_29
}
_29
}
_29
}
_29
]

execute

The execute operation requires the following parameters:

  • contract_addr: Address of the contract where the execute message is being sent to. For adjusting allocation points, this would be the Generator contract.
  • msg: A binary encoded message containing our contract call.
  • funds: Any funds to send along with our transaction.
NOTE

This tutorial uses placeholder variables for contract addresses. Use the actual string representation of each contract address when submitting a proposal.

msg

The code in this section uses a custom function (toBase64) to display our binary message - this function needs to be defined elsewhere to be used and is not accessible within the Astroport Web App.

Use for demonstration purposes only. The actual string representation of our message will be an encoded binary, which will be covered below.


_29
[
_29
{
_29
{
_29
"wasm": {
_29
"execute": {
_29
"contract_addr": generatorAddress,
_29
"msg": toBase64(
_29
{
_29
"setup_pools": {
_29
"pools" : [
_29
[
_29
"terra18mcmlf4v23ehukkh7qxgpf5tznzg6893fxmf9ffmdt9phgf365zqvmlug6",
_29
"1538"
_29
],
_29
[
_29
"terra16esjk7qqlgh8w7p2a58yxhgkfk4ykv72p7ha056zul58adzjm6msvc674t",
_29
"30018"
_29
],
_29
etc...
_29
]
_29
}
_29
}
_29
),
_29
"funds": []
_29
}
_29
}
_29
}
_29
}
_29
]

setup_pools

To adjust ASTRO allocation points a pool, our proposal msg must point to the setup_pools endpoint in the Generator contract.

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

  • The message expects LP token addresses, not pair addresses.

  • The message expects a vector of LP contract addresses. Specifying a single address rewrites all active pools with the pools specified in the message. You can query the generator contract to include previous LP token addresses and allocation points.


_38
{
_38
"setup_pools": {
_38
"pools" : [
_38
[
_38
"terra18mcmlf4v23ehukkh7qxgpf5tznzg6893fxmf9ffmdt9phgf365zqvmlug6",
_38
"1538"
_38
],
_38
[
_38
"terra16esjk7qqlgh8w7p2a58yxhgkfk4ykv72p7ha056zul58adzjm6msvc674t",
_38
"30018"
_38
],
_38
[
_38
"terra1ckmsqdhlky9jxcmtyj64crgzjxad9pvsd58k8zsxsnv4vzvwdt7qke04hl",
_38
"40026"
_38
],
_38
[
_38
"terra1kggfd6z0ad2k9q8v24f7ftxyqush8fp9xku9nyrjcs2wv0e4kypszfrfd0",
_38
"6666"
_38
],
_38
[
_38
"terra1cq22eugxwgp0x34cqfrxmd9jkyy43gas93yqjhmwrm7j0h5ecrqq5j7dgp",
_38
"6666"
_38
],
_38
[
_38
"terra1khsxwfnzuxqcyza2sraxf2ngkr3dwy9f7rm0uts0xpkeshs96ccsqtu6nv",
_38
"11257"
_38
],
_38
[
_38
"terra1h3z2zv6aw94fx5263dy6tgz6699kxmewlx3vrcu4jjrudg6xmtyqk6vt0u",
_38
"6666"
_38
],
_38
[
_38
"terra1ces6k6jp7qzkjpwsl6xg4f7zfwre0u23cglg69hhj3g20fhygtpsu24dsy",
_38
"2152"
_38
]
_38
]
_38
}
_38
}

Encoding our setup_pools msg

Our setup_pools message needs to be encoded and and passed as an input into our msg parameter within our execute call.

Since we are using the Astroport Web App to submit our proposal, we will encode our message manually using an online Base64 encoder.


_38
{
_38
"setup_pools": {
_38
"pools" : [
_38
[
_38
"terra18mcmlf4v23ehukkh7qxgpf5tznzg6893fxmf9ffmdt9phgf365zqvmlug6",
_38
"1538"
_38
],
_38
[
_38
"terra16esjk7qqlgh8w7p2a58yxhgkfk4ykv72p7ha056zul58adzjm6msvc674t",
_38
"30018"
_38
],
_38
[
_38
"terra1ckmsqdhlky9jxcmtyj64crgzjxad9pvsd58k8zsxsnv4vzvwdt7qke04hl",
_38
"40026"
_38
],
_38
[
_38
"terra1kggfd6z0ad2k9q8v24f7ftxyqush8fp9xku9nyrjcs2wv0e4kypszfrfd0",
_38
"6666"
_38
],
_38
[
_38
"terra1cq22eugxwgp0x34cqfrxmd9jkyy43gas93yqjhmwrm7j0h5ecrqq5j7dgp",
_38
"6666"
_38
],
_38
[
_38
"terra1khsxwfnzuxqcyza2sraxf2ngkr3dwy9f7rm0uts0xpkeshs96ccsqtu6nv",
_38
"11257"
_38
],
_38
[
_38
"terra1h3z2zv6aw94fx5263dy6tgz6699kxmewlx3vrcu4jjrudg6xmtyqk6vt0u",
_38
"6666"
_38
],
_38
[
_38
"terra1ces6k6jp7qzkjpwsl6xg4f7zfwre0u23cglg69hhj3g20fhygtpsu24dsy",
_38
"2152"
_38
]
_38
]
_38
}
_38
}

Final Result

Once we encode our message, our final Executable Message that we would submit to the Astroport Web App to adjust allocation points ends up looking something like the code in this section.

You can see our contract call to the setup_pools endpoint by decoding our msg using a Base64 decoder.


_13
[
_13
{
_13
{
_13
"wasm": {
_13
"execute": {
_13
"contract_addr": "terra1gc4d4v82vjgkz0ag28lrmlxx3tf6sq69tmaujjpe7jwmnqakkx0qm28j2l", // generatorAddress
_13
"msg": "ewogICJzZXR1cF9wb29scyI6IHsKICAgICJwb29scyIgOiBbCiAgICAgIFsKICAgICAgICAidGVycmExOG1jbWxmNHYyM2VodWtraDdxeGdwZjV0em56ZzY4OTNmeG1mOWZmbWR0OXBoZ2YzNjV6cXZtbHVnNiIsCiAgICAgICAgIjE1MzgiCiAgICAgIF0sCiAgICAgIFsKICAgICAgICAidGVycmExNmVzams3cXFsZ2g4dzdwMmE1OHl4aGdrZms0eWt2NzJwN2hhMDU2enVsNThhZHpqbTZtc3ZjNjc0dCIsCiAgICAgICAgIjMwMDE4IgogICAgICBdLAogICAgICBbCiAgICAgICAgInRlcnJhMWNrbXNxZGhsa3k5anhjbXR5ajY0Y3Jnemp4YWQ5cHZzZDU4azh6c3hzbnY0dnp2d2R0N3FrZTA0aGwiLAogICAgICAgICI0MDAyNiIKICAgICAgXSwKICAgICAgWwogICAgICAgICJ0ZXJyYTFrZ2dmZDZ6MGFkMms5cTh2MjRmN2Z0eHlxdXNoOGZwOXhrdTlueXJqY3Myd3YwZTRreXBzemZyZmQwIiwKICAgICAgICAiNjY2NiIKICAgICAgXSwKICAgICAgWwogICAgICAgICJ0ZXJyYTFjcTIyZXVneHdncDB4MzRjcWZyeG1kOWpreXk0M2dhczkzeXFqaG13cm03ajBoNWVjcnFxNWo3ZGdwIiwKICAgICAgICAiNjY2NiIKICAgICAgXSwKICAgICAgWwogICAgICAgICJ0ZXJyYTFraHN4d2ZuenV4cWN5emEyc3JheGYybmdrcjNkd3k5ZjdybTB1dHMweHBrZXNoczk2Y2NzcXR1Nm52IiwKICAgICAgICAiMTEyNTciCiAgICAgIF0sCiAgICAgIFsKICAgICAgICAidGVycmExaDN6Mnp2NmF3OTRmeDUyNjNkeTZ0Z3o2Njk5a3htZXdseDN2cmN1NGpqcnVkZzZ4bXR5cWs2dnQwdSIsCiAgICAgICAgIjY2NjYiCiAgICAgIF0sCiAgICAgIFsKICAgICAgICAidGVycmExY2VzNms2anA3cXpranB3c2w2eGc0Zjd6ZndyZTB1MjNjZ2xnNjloaGozZzIwZmh5Z3Rwc3UyNGRzeSIsCiAgICAgICAgIjIxNTIiCiAgICAgIF0KICAgIF0KICB9Cn0=",
_13
"funds": []
_13
}
_13
}
_13
}
_13
}
_13
]

Vec<ProposalMessage>

The Executable Messages field in our proposal takes in a vector containing objects of type ProposalMessage. Each ProposalMessage requires the following parameters:

  • order: The order of execution of the message
  • msg: Execution message of type CosmosMsg

wasm

CosmosMsg is an enum that supports various types of messages. To adjust allocation points, our CosmosMsg must be of type wasm. Furthermore, our wasm message must be of type execute. In the backgrund, we are creating a wasm contract call to the setup_pools endpoint in the Generator contract.

execute

The execute operation requires the following parameters:

  • contract_addr: Address of the contract where the execute message is being sent to. For adjusting allocation points, this would be the Generator contract.
  • msg: A binary encoded message containing our contract call.
  • funds: Any funds to send along with our transaction.
NOTE

This tutorial uses placeholder variables for contract addresses. Use the actual string representation of each contract address when submitting a proposal.

msg

The code in this section uses a custom function (toBase64) to display our binary message - this function needs to be defined elsewhere to be used and is not accessible within the Astroport Web App.

Use for demonstration purposes only. The actual string representation of our message will be an encoded binary, which will be covered below.

setup_pools

To adjust ASTRO allocation points a pool, our proposal msg must point to the setup_pools endpoint in the Generator contract.

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

  • The message expects LP token addresses, not pair addresses.

  • The message expects a vector of LP contract addresses. Specifying a single address rewrites all active pools with the pools specified in the message. You can query the generator contract to include previous LP token addresses and allocation points.

Encoding our setup_pools msg

Our setup_pools message needs to be encoded and and passed as an input into our msg parameter within our execute call.

Since we are using the Astroport Web App to submit our proposal, we will encode our message manually using an online Base64 encoder.

Final Result

Once we encode our message, our final Executable Message that we would submit to the Astroport Web App to adjust allocation points ends up looking something like the code in this section.

You can see our contract call to the setup_pools endpoint by decoding our msg using a Base64 decoder.


_29
[
_29
{
_29
{
_29
"wasm": {
_29
"execute": {
_29
"contract_addr": generatorAddress,
_29
"msg": toBase64(
_29
{
_29
"setup_pools": {
_29
"pools" : [
_29
[
_29
"terra18mcmlf4v23ehukkh7qxgpf5tznzg6893fxmf9ffmdt9phgf365zqvmlug6",
_29
"1538"
_29
],
_29
[
_29
"terra16esjk7qqlgh8w7p2a58yxhgkfk4ykv72p7ha056zul58adzjm6msvc674t",
_29
"30018"
_29
],
_29
etc...
_29
]
_29
}
_29
}
_29
),
_29
"funds": []
_29
}
_29
}
_29
}
_29
}
_29
]

Submitting a Proposal Directly

Before continuing with this section, make sure to read the section above on adjusting allocation points through the Astroport Web App. The Astroport Web App essentially wraps our executable message (covered above) within a submit_proposal message to the Assembly contract. This section will focus on completing this last step.

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 message containing our contract call to submit_proposal

_29
{
_29
"send": {
_29
"contract": assemblyAddress,
_29
"amount": "1000", // testnet deposit amount
_29
"msg": toBase64(
_29
{
_29
"submit_proposal": {
_29
"title": "update astro emissions",
_29
"description": "proposal to adjust astro allocation points inactive pair",
_29
"link": "https://forum.astroport.fi/",
_29
"messages": [
_29
{
_29
{
_29
"wasm": {
_29
"execute": {
_29
"contract_addr": generatorAddress,
_29
"msg": "ewogICJzZXR1cF9wb29scyI6IHsKICAgICJwb29scyIgOiBbCiAgICAgIFsKICAg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AgIjIxNTIiCiAgICAgIF0KICAgIF0KICB9Cn0=",
_29
"funds": []
_29
}
_29
}
_29
}
_29
}
_29
],
_29
"ibc_channel": "channel..."
_29
}
_29
}
_29
),
_29
}
_29
}

submit_proposal

Our encoded message performs a contract call to the submit_proposal endpoint in the Assembly contract.

submit_proposal takes in the following parameters:

  • title: Proposal title
  • description: Description for the proposal
  • link: Link to forum discussion
  • messages: Proposal message containing our binary contract call to setup_pools
  • ibc_channel: If the proposal should be executed on a remote chain, this field should specify the governance channel

All further steps to the messages parameter can be found above.


_29
{
_29
"send": {
_29
"contract": assemblyAddress,
_29
"amount": "1000", // testnet deposit amount
_29
"msg": toBase64(
_29
{
_29
"submit_proposal": {
_29
"title": "update astro emissions",
_29
"description": "proposal to adjust astro allocation points inactive pair",
_29
"link": "https://forum.astroport.fi/",
_29
"messages": [
_29
{
_29
{
_29
"wasm": {
_29
"execute": {
_29
"contract_addr": generatorAddress,
_29
"msg": "ewogICJzZXR1cF9wb29scyI6IHsKICAgICJwb29scyIgOiBbCiAgICAgIFsKICAgICAgICAidGVycmExOG1jbWxmNHYyM2VodWtraDdxeGdwZjV0em56ZzY4OTNmeG1mOWZmbWR0OXBoZ2YzNjV6cXZtbHVnNiIsCiAgICAgICAgIjE1MzgiCiAgICAgIF0sCiAgICAgIFsKICAgICAgICAidGVycmExNmVzams3cXFsZ2g4dzdwMmE1OHl4aGdrZms0eWt2NzJwN2hhMDU2enVsNThhZHpqbTZtc3ZjNjc0dCIsCiAgICAgICAgIjMwMDE4IgogICAgICBdLAogICAgICBbCiAgICAgICAgInRlcnJhMWNrbXNxZGhsa3k5anhjbXR5ajY0Y3Jnemp4YWQ5cHZzZDU4azh6c3hzbnY0dnp2d2R0N3FrZTA0aGwiLAogICAgICAgICI0MDAyNiIKICAgICAgXSwKICAgICAgWwogICAgICAgICJ0ZXJyYTFrZ2dmZDZ6MGFkMms5cTh2MjRmN2Z0eHlxdXNoOGZwOXhrdTlueXJqY3Myd3YwZTRreXBzemZyZmQwIiwKICAgICAgICAiNjY2NiIKICAgICAgXSwKICAgICAgWwogICAgICAgICJ0ZXJyYTFjcTIyZXVneHdncDB4MzRjcWZyeG1kOWpreXk0M2dhczkzeXFqaG13cm03ajBoNWVjcnFxNWo3ZGdwIiwKICAgICAgICAiNjY2NiIKICAgICAgXSwKICAgICAgWwogICAgICAgICJ0ZXJyYTFraHN4d2ZuenV4cWN5emEyc3JheGYybmdrcjNkd3k5ZjdybTB1dHMweHBrZXNoczk2Y2NzcXR1Nm52IiwKICAgICAgICAiMTEyNTciCiAgICAgIF0sCiAgICAgIFsKICAgICAgICAidGVycmExaDN6Mnp2NmF3OTRmeDUyNjNkeTZ0Z3o2Njk5a3htZXdseDN2cmN1NGpqcnVkZzZ4bXR5cWs2dnQwdSIsCiAgICAgICAgIjY2NjYiCiAgICAgIF0sCiAgICAgIFsKICAgICAgICAidGVycmExY2VzNms2anA3cXpranB3c2w2eGc0Zjd6ZndyZTB1MjNjZ2xnNjloaGozZzIwZmh5Z3Rwc3UyNGRzeSIsCiAgICAgICAgIjIxNTIiCiAgICAgIF0KICAgIF0KICB9Cn0=",
_29
"funds": []
_29
}
_29
}
_29
}
_29
}
_29
],
_29
"ibc_channel": "channel..."
_29
}
_29
}
_29
),
_29
}
_29
}

Encoding our submit_proposal msg

Finally, our submit_proposal message needs to be encoded and passed as an input into our msg parameter within our send call.


_29
{
_29
"send": {
_29
"contract": assemblyAddress,
_29
"amount": "1000", // testnet deposit amount
_29
"msg": toBase64(
_29
{
_29
"submit_proposal": {
_29
"title": "update astro emissions",
_29
"description": "proposal to adjust astro allocation points inactive pair",
_29
"link": "https://forum.astroport.fi/",
_29
"messages": [
_29
{
_29
{
_29
"wasm": {
_29
"execute": {
_29
"contract_addr": generatorAddress,
_29
"msg": "ewogICJzZXR1cF9wb29scyI6IHsKICAgICJwb29scyIgOiBbCiAgICAgIFsKICAgICAgICAidGVycmExOG1jbWxmNHYyM2VodWtraDdxeGdwZjV0em56ZzY4OT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}
_29
}
_29
}
_29
}
_29
],
_29
"ibc_channel": "channel..."
_29
}
_29
}
_29
),
_29
}
_29
}

toBase64

The code in this section uses a custom function (toBase64) to display our binary message - this function needs to be defined elsewhere to be used. The actual string representation of our message would be an encoded binary, similar to our setup_pools message.


_3
let toBase64 = (obj) => {
_3
return Buffer.from(JSON.stringify(obj)).toString("base64");
_3
};

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 message containing our contract call to submit_proposal

submit_proposal

Our encoded message performs a contract call to the submit_proposal endpoint in the Assembly contract.

submit_proposal takes in the following parameters:

  • title: Proposal title
  • description: Description for the proposal
  • link: Link to forum discussion
  • messages: Proposal message containing our binary contract call to setup_pools
  • ibc_channel: If the proposal should be executed on a remote chain, this field should specify the governance channel

All further steps to the messages parameter can be found above.

Encoding our submit_proposal msg

Finally, our submit_proposal message needs to be encoded and passed as an input into our msg parameter within our send call.

toBase64

The code in this section uses a custom function (toBase64) to display our binary message - this function needs to be defined elsewhere to be used. The actual string representation of our message would be an encoded binary, similar to our setup_pools message.


_29
{
_29
"send": {
_29
"contract": assemblyAddress,
_29
"amount": "1000", // testnet deposit amount
_29
"msg": toBase64(
_29
{
_29
"submit_proposal": {
_29
"title": "update astro emissions",
_29
"description": "proposal to adjust astro allocation points inactive pair",
_29
"link": "https://forum.astroport.fi/",
_29
"messages": [
_29
{
_29
{
_29
"wasm": {
_29
"execute": {
_29
"contract_addr": generatorAddress,
_29
"msg": "ewogICJzZXR1cF9wb29scyI6IHsKICAgICJwb29scyIgOiBbCiAgICAgIFsKICAgICAgICAidGVycmExOG1jbWxmNHYyM2VodWtraDdxeGdwZjV0em56ZzY4OTNmeG1mOWZmbWR0OXBoZ2YzNjV6cXZtbHVnNiIsCiAgICAgICAgIjE1MzgiCiAgICAgIF0sCiAgICAgIFsKICAgICAgICAidGVycmExNmVzams3cXFsZ2g4dzdwMmE1OHl4aGdrZms0eWt2NzJwN2hhMDU2enVsNThhZHpqbTZtc3ZjNjc0dCIsCiAgICAgICAgIjMwMDE4IgogICAgICBdLAogICAgICBbCiAgICAgICAgInRlcnJhMWNrbXNxZGhsa3k5anhjbXR5ajY0Y3Jnemp4YWQ5cHZzZDU4azh6c3hzbnY0dnp2d2R0N3FrZTA0aGwiLAogICAgICAgICI0MDAyNiIKICAgICAgXSwKICAgICAgWwogICAgICAgICJ0ZXJyYTFrZ2dmZDZ6MGFkMms5cTh2MjRmN2Z0eHlxdXNoOGZwOXhrdTlueXJqY3Myd3YwZTRreXBzemZyZmQwIiwKICAgICAgICAiNjY2NiIKICAgICAgXSwKICAgICAgWwogICAgICAgICJ0ZXJyYTFjcTIyZXVneHdncDB4MzRjcWZyeG1kOWpreXk0M2dhczkzeXFqaG13cm03ajBoNWVjcnFxNWo3ZGdwIiwKICAgICAgICAiNjY2NiIKICAgICAgXSwKICAgICAgWwogICAgICAgICJ0ZXJyYTFraHN4d2ZuenV4cWN5emEyc3JheGYybmdrcjNkd3k5ZjdybTB1dHMweHBrZXNoczk2Y2NzcXR1Nm52IiwKICAgICAgICAiMTEyNTciCiAgICAgIF0sCiAgICAgIFsKICAgICAgICAidGVycmExaDN6Mnp2NmF3OTRmeDUyNjNkeTZ0Z3o2Njk5a3htZXdseDN2cmN1NGpqcnVkZzZ4bXR5cWs2dnQwdSIsCiAgICAgICAgIjY2NjYiCiAgICAgIF0sCiAgICAgIFsKICAgICAgICAidGVycmExY2VzNms2anA3cXpranB3c2w2eGc0Zjd6ZndyZTB1MjNjZ2xnNjloaGozZzIwZmh5Z3Rwc3UyNGRzeSIsCiAgICAgICAgIjIxNTIiCiAgICAgIF0KICAgIF0KICB9Cn0=",
_29
"funds": []
_29
}
_29
}
_29
}
_29
}
_29
],
_29
"ibc_channel": "channel..."
_29
}
_29
}
_29
),
_29
}
_29
}