mirror of
https://github.com/BiPhan4/DefiHackathon-2022.git
synced 2025-04-02 10:41:42 -04:00
final product. Transfering funds not perfected
This commit is contained in:
parent
9c560ff59f
commit
3d49ceec73
5 changed files with 24 additions and 12 deletions
|
@ -1 +1 @@
|
|||
bb14886bfd94d6402eb40a6632d5b0fb7ec24f9120c1ce8d83f771776402c48b counter.wasm
|
||||
20828f78f4b256f0563c2fbb65b5361504f948dd4910dfe54e981aa5670f73a8 counter.wasm
|
||||
|
|
|
@ -1 +1 @@
|
|||
77a2fd2a04bd7c5f38ca2e35452d08b97c5bb8191121406e100d58fa20409974 ./target/wasm32-unknown-unknown/release/counter.wasm
|
||||
07b18dc271100d7c375e9ff1de8a767899ffa745dd52dbaa0ce9ab587346d78e ./target/wasm32-unknown-unknown/release/counter.wasm
|
||||
|
|
Binary file not shown.
|
@ -4,7 +4,7 @@ use cosmwasm_std::{Order, Uint128, Coin, BankMsg, CosmosMsg, Uint256, to_binary,
|
|||
use cw2::set_contract_version;
|
||||
|
||||
use crate::error::ContractError;
|
||||
use crate::msg::{ExecuteMsg, InstantiateMsg, totalPayersResponse, QueryMsg};
|
||||
use crate::msg::{ExecuteMsg, InstantiateMsg, totalPayersResponse, QueryMsg, self};
|
||||
use crate::state::{State, STATE, BALANCES};
|
||||
|
||||
// version info for migration info
|
||||
|
@ -75,9 +75,7 @@ pub fn try_payup(deps: DepsMut, info: MessageInfo) -> Result<Response, ContractE
|
|||
|
||||
if deposit_amount.is_zero() {
|
||||
return Err(ContractError::ZeroDeposit {});
|
||||
}
|
||||
/*is depost amount 50% of config.bill
|
||||
*/
|
||||
}
|
||||
|
||||
let msg = CosmosMsg::Bank(BankMsg::Send {
|
||||
to_address: config.storeowner.to_string(),
|
||||
|
@ -89,7 +87,7 @@ pub fn try_payup(deps: DepsMut, info: MessageInfo) -> Result<Response, ContractE
|
|||
],
|
||||
});
|
||||
|
||||
Ok(Response::new().add_message(msg))
|
||||
return Ok(Response::new().add_message(msg));;
|
||||
}
|
||||
|
||||
#[cfg_attr(not(feature = "library"), entry_point)]
|
||||
|
@ -99,13 +97,27 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult<Binary> {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
pub fn QueryPayers(deps: Deps) -> StdResult<totalPayersResponse> {
|
||||
let state = STATE.load(deps.storage)?;
|
||||
Ok(totalPayersResponse { payers: state.TotalPayers})
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
//pub createorder(deps: DepsMut, info: MessageInfo: i32) -> Result<Response, ContractError>{
|
||||
//}
|
||||
for index in 0..state.TotalPayers{
|
||||
let config = STATE.load(deps.storage)?;
|
||||
let to_be_paid: (state.bill)*(1/(state.TotalPayers));
|
||||
|
||||
let Divided_Amount: Uint = BALANCES[index];
|
||||
let deposit_amount: Uint128 = info
|
||||
.funds
|
||||
.iter()
|
||||
.find(|c| c.denom == "uluna")
|
||||
.map(|c| Uint128::from(c.amount))
|
||||
.unwrap_or_else(Uint128::zero);
|
||||
|
||||
if deposit_amount.is_zero() {
|
||||
return Err(ContractError::ZeroDeposit {});
|
||||
}
|
||||
|
||||
}*/
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"localterra": {
|
||||
"counter": {
|
||||
"codeId": "7",
|
||||
"codeId": "13",
|
||||
"contractAddresses": {
|
||||
"default": "terra1y45vkh0n6kplaeqw6ratuertapxupz53wdg6vd"
|
||||
"default": "terra1dazgw2z5sxe7hgt43p0e3xyljnu45tlzwraccz"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue