-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(minor-ampd): add command to set rewards proxy (#631)
- Loading branch information
Showing
9 changed files
with
70 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use cosmrs::cosmwasm::MsgExecuteContract; | ||
use cosmrs::tx::Msg; | ||
use error_stack::Result; | ||
use report::ResultCompatExt; | ||
use rewards::msg::ExecuteMsg; | ||
use router_api::Address; | ||
use valuable::Valuable; | ||
|
||
use crate::commands::{broadcast_tx, verifier_pub_key}; | ||
use crate::config::Config; | ||
use crate::{Error, PREFIX}; | ||
|
||
#[derive(clap::Args, Debug, Valuable)] | ||
pub struct Args { | ||
pub proxy_address: Address, | ||
} | ||
|
||
pub async fn run(config: Config, args: Args) -> Result<Option<String>, Error> { | ||
let pub_key = verifier_pub_key(config.tofnd_config.clone()).await?; | ||
|
||
let msg = serde_json::to_vec(&ExecuteMsg::SetVerifierProxy { | ||
proxy_address: args.proxy_address, | ||
}) | ||
.expect("register chain support msg should serialize"); | ||
|
||
let tx = MsgExecuteContract { | ||
sender: pub_key.account_id(PREFIX).change_context(Error::Tofnd)?, | ||
contract: config.rewards.cosmwasm_contract.as_ref().clone(), | ||
msg, | ||
funds: vec![], | ||
} | ||
.into_any() | ||
.expect("failed to serialize proto message"); | ||
|
||
let tx_hash = broadcast_tx(config, tx, pub_key).await?.txhash; | ||
|
||
Ok(Some(format!( | ||
"successfully broadcast set verifier proxy transaction, tx hash: {}", | ||
tx_hash | ||
))) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters