Skip to content

Commit 161f4ad

Browse files
committed
fix reply func
1 parent 26e0554 commit 161f4ad

File tree

11 files changed

+56
-894
lines changed

11 files changed

+56
-894
lines changed

contracts/amaci/src/contract.rs

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::circuit_params::match_vkeys;
22
use crate::error::ContractError;
33
use crate::groth16_parser::{parse_groth16_proof, parse_groth16_vkey};
4-
use crate::msg::{ExecuteMsg, Groth16ProofType, InstantiateMsg, InstantiationData, QueryMsg};
4+
use crate::msg::{ExecuteMsg, Groth16ProofType, InstantiateMsg, QueryMsg};
55
use crate::state::{
66
Admin, Groth16ProofStr, MessageData, Period, PeriodStatus, PubKey, QuinaryTreeRoot, RoundInfo,
77
StateLeaf, VotingTime, Whitelist, ADMIN, CERTSYSTEM, COORDINATORHASH,
@@ -2029,40 +2029,6 @@ pub fn query_can_sign_up(deps: Deps, sender: String) -> StdResult<bool> {
20292029
// pub fn query_user_balance_of(deps: Deps, sender: String) -> StdResult<Uint256> {
20302030
// Ok(user_balance_of(deps, &sender)?)
20312031
// }
2032-
#[cfg_attr(not(feature = "library"), entry_point)]
2033-
pub fn reply(deps: DepsMut, env: Env, reply: Reply) -> Result<Response, ContractError> {
2034-
match reply.id {
2035-
CREATED_ROUND_REPLY_ID => reply_created_round(deps, env, reply.result.into_result()),
2036-
id => Err(ContractError::UnRecognizedReplyIdErr { id }),
2037-
}
2038-
}
2039-
2040-
pub fn reply_created_round(
2041-
deps: DepsMut,
2042-
_env: Env,
2043-
reply: Result<SubMsgResponse, String>,
2044-
) -> Result<Response, ContractError> {
2045-
let response = reply.map_err(StdError::generic_err)?;
2046-
let data = response.data.ok_or(ContractError::DataMissingErr {})?;
2047-
// let response = parse_instantiate_response_data(&data)?;
2048-
let response = match parse_instantiate_response_data(&data) {
2049-
Ok(data) => data,
2050-
Err(err) => {
2051-
return Err(ContractError::Std(cosmwasm_std::StdError::generic_err(
2052-
err.to_string(),
2053-
)))
2054-
}
2055-
};
2056-
2057-
let addr = Addr::unchecked(response.contract_address);
2058-
let data = InstantiationData { addr: addr.clone() };
2059-
let resp = Response::new()
2060-
.add_attribute("action", "created_round")
2061-
.add_attribute("round_addr", addr.to_string())
2062-
.set_data(to_json_binary(&data)?);
2063-
2064-
Ok(resp)
2065-
}
20662032

20672033
#[cfg(test)]
20682034
mod tests {}

contracts/amaci/src/error.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,4 @@ pub enum ContractError {
9898

9999
#[error("No matching circuit size.")]
100100
NotMatchCircuitSize {},
101-
102-
#[error("Un recognized reply id {id}")]
103-
UnRecognizedReplyIdErr { id: u64 },
104-
105-
#[error("Data missing")]
106-
DataMissingErr {},
107101
}

contracts/amaci/src/msg.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,3 @@ pub enum QueryMsg {
203203
#[returns(Uint256)]
204204
QueryPreDeactivateRoot {},
205205
}
206-
207-
#[cw_serde]
208-
pub struct InstantiationData {
209-
pub addr: Addr,
210-
}

contracts/amaci/src/multitest/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::state::{
88
};
99
use crate::utils::uint256_from_hex_string;
1010
use crate::{
11-
contract::{execute, instantiate, query, reply},
11+
contract::{execute, instantiate, query},
1212
msg::*,
1313
};
1414

0 commit comments

Comments
 (0)