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.
- Loading branch information
1 parent
d393c74
commit fde26e8
Showing
13 changed files
with
279 additions
and
0 deletions.
There are no files selected for viewing
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 crate::bindings::query::ElysQuery; | ||
use crate::types::EarnType; | ||
|
||
use super::*; | ||
pub fn claim_rewards_request( | ||
_env: Env, | ||
_info: MessageInfo, | ||
_deps: DepsMut<ElysQuery>, | ||
delegator_address: String, | ||
withdraw_type: EarnType, | ||
) -> Result<Response<ElysMsg>, ContractError> { | ||
let msg = ElysMsg::withdraw_rewards( | ||
delegator_address, | ||
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,20 @@ | ||
use crate::bindings::query::ElysQuery; | ||
|
||
use super::*; | ||
// delegator_address, validator_address, denom | ||
pub fn claim_validator_commission_request( | ||
_env: Env, | ||
_info: MessageInfo, | ||
_deps: DepsMut<ElysQuery>, | ||
delegator_address: String, | ||
validator_address: String, | ||
) -> Result<Response<ElysMsg>, ContractError> { | ||
let msg = ElysMsg::withdraw_validator_commissions( | ||
delegator_address, | ||
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,20 @@ | ||
use crate::bindings::query::ElysQuery; | ||
|
||
use super::*; | ||
pub fn eden_cancel_vest_request( | ||
_env: Env, | ||
_info: MessageInfo, | ||
_deps: DepsMut<ElysQuery>, | ||
creator: String, | ||
amount: u64, | ||
) -> Result<Response<ElysMsg>, ContractError> { | ||
let msg = ElysMsg::eden_cancel_vesting( | ||
creator, | ||
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 crate::bindings::query::ElysQuery; | ||
|
||
use super::*; | ||
pub fn eden_vest_request( | ||
_env: Env, | ||
_info: MessageInfo, | ||
_deps: DepsMut<ElysQuery>, | ||
creator: String, | ||
amount: u64, | ||
) -> Result<Response<ElysMsg>, ContractError> { | ||
let msg: ElysMsg = ElysMsg::eden_vesting( | ||
creator, | ||
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 crate::bindings::query::ElysQuery; | ||
|
||
use super::*; | ||
pub fn elys_cancel_unstake_request( | ||
_env: Env, | ||
_info: MessageInfo, | ||
_deps: DepsMut<ElysQuery>, | ||
delegator_address: String, | ||
validator_address: String, | ||
amount: Coin, | ||
creation_height: i64, | ||
) -> Result<Response<ElysMsg>, ContractError> { | ||
let msg = ElysMsg::cancel_unbonding( | ||
delegator_address, | ||
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,28 @@ | ||
use crate::bindings::query::ElysQuery; | ||
|
||
use super::*; | ||
pub fn elys_redelegation_request( | ||
_env: Env, | ||
_info: MessageInfo, | ||
_deps: DepsMut<ElysQuery>, | ||
// the address of the current user. | ||
delegator_address: String, | ||
// 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( | ||
delegator_address, | ||
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,36 @@ | ||
use crate::{bindings::query::ElysQuery, bindings::querier::ElysQuerier}; | ||
|
||
use super::*; | ||
|
||
pub fn stake_request( | ||
_env: Env, | ||
_info: MessageInfo, | ||
deps: DepsMut<ElysQuery>, | ||
// the address of the current user. | ||
address: String, | ||
// 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 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( | ||
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,29 @@ | ||
use crate::bindings::query::ElysQuery; | ||
|
||
use super::*; | ||
|
||
pub fn unstake_request( | ||
_env: Env, | ||
_info: MessageInfo, | ||
_deps: DepsMut<ElysQuery>, | ||
// the address of the current user. | ||
address: String, | ||
// 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( | ||
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
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,10 @@ | ||
use cosmwasm_schema::cw_serde; | ||
|
||
#[cw_serde] | ||
pub enum EarnType { | ||
AllProgram = 0, | ||
UsdcProgram = 1, | ||
ElysProgram = 2, | ||
EdenProgram = 3, | ||
EdenBProgram = 4, | ||
} |
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