This repository has been archived by the owner on Dec 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: add execution functions * chore: fix cargo conflict * chore: fix cargo conflict * chore: add execution function financial smart contract * chore: add broker address param * chore: fix conflict with main * chore: fix conflict * chore: fix conflict * chore: fix conflict with main * fix: address in close margin position * chore: update elys binding reference * chore: update cargo lock * Update Cargo.toml --------- Co-authored-by: Cosmic Vagabond <[email protected]>
- Loading branch information
1 parent
f50b3cc
commit 0301b08
Showing
15 changed files
with
267 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use super::*; | ||
use elys_bindings::types::EarnType; | ||
|
||
pub fn claim_rewards_request( | ||
env: Env, | ||
info: MessageInfo, | ||
_deps: DepsMut<ElysQuery>, | ||
withdraw_type: EarnType, | ||
) -> Result<Response<ElysMsg>, ContractError> { | ||
let msg = ElysMsg::withdraw_rewards( | ||
env.contract.address.into_string(), | ||
info.sender.into_string(), | ||
withdraw_type, | ||
); | ||
|
||
let resp = Response::new().add_message(msg); | ||
|
||
Ok(resp) | ||
} |
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,18 @@ | ||
use super::*; | ||
// delegator_address, validator_address, denom | ||
pub fn claim_validator_commission_request( | ||
env: Env, | ||
info: MessageInfo, | ||
_deps: DepsMut<ElysQuery>, | ||
validator_address: String, | ||
) -> Result<Response<ElysMsg>, ContractError> { | ||
let msg = ElysMsg::withdraw_validator_commissions( | ||
env.contract.address.into_string(), | ||
info.sender.into_string(), | ||
validator_address, | ||
); | ||
|
||
let resp = Response::new().add_message(msg); | ||
|
||
Ok(resp) | ||
} |
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,20 @@ | ||
use super::*; | ||
use cosmwasm_std::Int128; | ||
|
||
pub fn eden_cancel_vest_request( | ||
env: Env, | ||
info: MessageInfo, | ||
_deps: DepsMut<ElysQuery>, | ||
amount: u64, | ||
) -> Result<Response<ElysMsg>, ContractError> { | ||
let msg = ElysMsg::eden_cancel_vesting( | ||
env.contract.address.into_string(), | ||
info.sender.into_string(), | ||
Int128::from(amount), | ||
"ueden".to_string(), | ||
); | ||
|
||
let resp = Response::new().add_message(msg); | ||
|
||
Ok(resp) | ||
} |
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,20 @@ | ||
use super::*; | ||
use cosmwasm_std::Int128; | ||
|
||
pub fn eden_vest_request( | ||
env: Env, | ||
info: MessageInfo, | ||
_deps: DepsMut<ElysQuery>, | ||
amount: u64, | ||
) -> Result<Response<ElysMsg>, ContractError> { | ||
let msg: ElysMsg = ElysMsg::eden_vesting( | ||
env.contract.address.into_string(), | ||
info.sender.into_string(), | ||
Int128::from(amount), | ||
"ueden".to_string(), | ||
); | ||
|
||
let resp = Response::new().add_message(msg); | ||
|
||
Ok(resp) | ||
} |
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,23 @@ | ||
use super::*; | ||
use cosmwasm_std::Coin; | ||
|
||
pub fn elys_cancel_unstake_request( | ||
env: Env, | ||
info: MessageInfo, | ||
_deps: DepsMut<ElysQuery>, | ||
validator_address: String, | ||
amount: Coin, | ||
creation_height: i64, | ||
) -> Result<Response<ElysMsg>, ContractError> { | ||
let msg = ElysMsg::cancel_unbonding( | ||
env.contract.address.into_string(), | ||
info.sender.into_string(), | ||
validator_address, | ||
amount, | ||
creation_height, | ||
); | ||
|
||
let resp = Response::new().add_message(msg); | ||
|
||
Ok(resp) | ||
} |
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,27 @@ | ||
use super::*; | ||
use cosmwasm_std::Coin; | ||
|
||
pub fn elys_redelegation_request( | ||
env: Env, | ||
info: MessageInfo, | ||
_deps: DepsMut<ElysQuery>, | ||
// the amount to be staked in base denomination. | ||
validator_src_address: String, | ||
// The asset to be staked | ||
validator_dst_address: String, | ||
// The validator Address is required only if the staked asset is | ||
// uelys. | ||
amount: Coin | ||
) -> Result<Response<ElysMsg>, ContractError> { | ||
let msg = ElysMsg::begin_redelegate( | ||
env.contract.address.into_string(), | ||
info.sender.into_string(), | ||
validator_src_address, | ||
validator_dst_address, | ||
amount, | ||
); | ||
|
||
let resp = Response::new().add_message(msg); | ||
|
||
Ok(resp) | ||
} |
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,35 @@ | ||
use super::*; | ||
use cosmwasm_std::Int128; | ||
|
||
pub fn stake_request( | ||
env: Env, | ||
info: MessageInfo, | ||
deps: DepsMut<ElysQuery>, | ||
// the amount to be staked in base denomination. | ||
amount: u64, | ||
// The asset to be staked | ||
asset: String, | ||
// The validator Address is required only if the staked asset is | ||
// uelys. | ||
validator_address: Option<String> | ||
) -> Result<Response<ElysMsg>, ContractError> { | ||
let querier = ElysQuerier::new(&deps.querier); | ||
let address = info.sender.into_string(); | ||
let balance = querier.get_balance(address.to_owned(), asset.to_owned())?; | ||
let token_amount: u128 = balance.amount.into(); | ||
if token_amount < amount as u128 { | ||
return Err(ContractError::InsufficientBalanceError { balance: balance.amount.into(), amount: amount }); | ||
} | ||
|
||
let msg = ElysMsg::stake_token( | ||
env.contract.address.into_string(), | ||
address, | ||
Int128::from(amount), | ||
asset, | ||
validator_address, | ||
); | ||
|
||
let resp = Response::new().add_message(msg); | ||
|
||
Ok(resp) | ||
} |
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,27 @@ | ||
use super::*; | ||
use cosmwasm_std::Int128; | ||
|
||
pub fn unstake_request( | ||
env: Env, | ||
info: MessageInfo, | ||
_deps: DepsMut<ElysQuery>, | ||
// the amount to be staked in base denomination. | ||
amount: u64, | ||
// The asset to be staked | ||
asset: String, | ||
// The validator Address is required only if the staked asset is | ||
// uelys. | ||
validator_address: Option<String> | ||
) -> Result<Response<ElysMsg>, ContractError> { | ||
let msg = ElysMsg::unstake_token( | ||
env.contract.address.into_string(), | ||
info.sender.into_string(), | ||
Int128::from(amount), | ||
asset, | ||
validator_address, | ||
); | ||
|
||
let resp = Response::new().add_message(msg); | ||
|
||
Ok(resp) | ||
} |
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