Skip to content

Commit 21c48c1

Browse files
committed
Fix contract
1 parent 1c2ee39 commit 21c48c1

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

contracts/ibc-callbacks/src/contract.rs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -127,24 +127,26 @@ pub fn ibc_source_callback(
127127
#[entry_point]
128128
pub fn ibc_destination_callback(
129129
deps: DepsMut,
130-
env: Env,
130+
_env: Env,
131131
msg: IbcDestinationCallbackMsg,
132132
) -> StdResult<IbcBasicResponse> {
133133
let mut counts = load_stats(deps.storage)?;
134134

135-
// Assert that we have the funds we expect.
135+
// Assert that the receiver has the funds in the message.
136136
// This is just for testing purposes and to show that the funds are already available during
137137
// the callback.
138-
for coin in &msg.funds {
139-
let balance = deps
140-
.querier
141-
.query_balance(&env.contract.address, &coin.denom)?;
142-
ensure!(
143-
balance.amount >= coin.amount,
144-
StdError::generic_err(format!(
145-
"Didn't receive expected funds. expected: {coin}, have: {balance}"
146-
))
147-
);
138+
if let Some(transfer) = &msg.transfer {
139+
for coin in &transfer.funds {
140+
let balance = deps
141+
.querier
142+
.query_balance(&transfer.receiver, &coin.denom)?;
143+
ensure!(
144+
balance.amount >= coin.amount,
145+
StdError::generic_err(format!(
146+
"Didn't receive expected funds. expected: {coin}, have: {balance}"
147+
))
148+
);
149+
}
148150
}
149151

150152
// save the receive

0 commit comments

Comments
 (0)