Skip to content

Commit 48a908e

Browse files
committed
removed forward params for channel balance
1 parent cf81f80 commit 48a908e

File tree

4 files changed

+6
-27
lines changed

4 files changed

+6
-27
lines changed

contracts/cw-ics20-latest/src/contract.rs

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ pub fn handle_increase_channel_balance_ibc_receive(
206206
&dst_channel_id,
207207
&ibc_denom,
208208
remote_amount.clone(),
209-
false,
210209
)?;
211210
// we need to save the data to update the balances in reply
212211
let reply_args = ReplyArgs {
@@ -236,14 +235,8 @@ pub fn handle_reduce_channel_balance_ibc_receive(
236235
) -> Result<Response, ContractError> {
237236
is_caller_contract(caller, contract_addr)?;
238237
// because we are transferring back, we reduce the channel's balance
239-
reduce_channel_balance(
240-
storage,
241-
src_channel_id.as_str(),
242-
&ibc_denom,
243-
remote_amount,
244-
false,
245-
)
246-
.map_err(|err| StdError::generic_err(err.to_string()))?;
238+
reduce_channel_balance(storage, src_channel_id.as_str(), &ibc_denom, remote_amount)
239+
.map_err(|err| StdError::generic_err(err.to_string()))?;
247240

248241
// keep track of the single-step reply since we need ibc data to undo reducing channel balance and local data for refunding.
249242
// we use a different item to not override REPLY_ARGS
@@ -505,7 +498,6 @@ pub fn execute_transfer_back_to_remote_chain(
505498
&msg.local_channel_id,
506499
&ibc_denom,
507500
amount_remote,
508-
false,
509501
)?;
510502

511503
// prepare ibc message
@@ -673,7 +665,7 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult<Binary> {
673665
match msg {
674666
QueryMsg::Port {} => to_binary(&query_port(deps)?),
675667
QueryMsg::ListChannels {} => to_binary(&query_list(deps)?),
676-
QueryMsg::Channel { id, forward } => to_binary(&query_channel(deps, id)?),
668+
QueryMsg::Channel { id } => to_binary(&query_channel(deps, id)?),
677669
QueryMsg::ChannelWithKey { channel_id, denom } => {
678670
to_binary(&query_channel_with_key(deps, channel_id, denom)?)
679671
}
@@ -949,7 +941,6 @@ mod test {
949941
mock_env(),
950942
QueryMsg::Channel {
951943
id: "channel-3".to_string(),
952-
forward: Some(true),
953944
},
954945
)
955946
.unwrap();
@@ -963,7 +954,6 @@ mod test {
963954
mock_env(),
964955
QueryMsg::Channel {
965956
id: "channel-10".to_string(),
966-
forward: Some(true),
967957
},
968958
)
969959
.unwrap_err();
@@ -2027,13 +2017,12 @@ mod test {
20272017
let amount = Uint128::from(10u128);
20282018
let reduce_amount = Uint128::from(1u128);
20292019
let mut deps = setup(&[channel], &[]);
2030-
increase_channel_balance(deps.as_mut().storage, channel, ibc_denom, amount, false).unwrap();
2020+
increase_channel_balance(deps.as_mut().storage, channel, ibc_denom, amount).unwrap();
20312021
reduce_channel_balance(
20322022
deps.as_mut().storage,
20332023
channel,
20342024
ibc_denom,
20352025
Uint128::from(1u128),
2036-
false,
20372026
)
20382027
.unwrap();
20392028

@@ -2062,7 +2051,7 @@ mod test {
20622051
let override_amount = Uint128::from(100u128);
20632052
let total_sent_override = Uint128::from(1000u128);
20642053
let mut deps = setup(&[channel], &[]);
2065-
increase_channel_balance(deps.as_mut().storage, channel, ibc_denom, amount, false).unwrap();
2054+
increase_channel_balance(deps.as_mut().storage, channel, ibc_denom, amount).unwrap();
20662055

20672056
// unauthorized case
20682057
let unauthorized = handle_override_channel_balance(

contracts/cw-ics20-latest/src/ibc_tests.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,6 @@ mod test {
611611
receive_channel,
612612
pair_mapping_key.as_str(),
613613
remote_amount.clone(),
614-
false,
615614
)
616615
.unwrap();
617616
destination.receiver = "trx-mainnet0x73Ddc880916021EFC4754Cb42B53db6EAB1f9D64".to_string();

contracts/cw-ics20-latest/src/msg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ pub enum QueryMsg {
153153
ListChannels {},
154154
/// Returns the details of the name channel, error if not created.
155155
#[returns(ChannelResponse)]
156-
Channel { id: String, forward: Option<bool> },
156+
Channel { id: String },
157157
/// Returns the details of the name channel, error if not created.
158158
#[returns(ChannelWithKeyResponse)]
159159
ChannelWithKey { channel_id: String, denom: String },

contracts/cw-ics20-latest/src/state.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,8 @@ pub fn increase_channel_balance(
142142
channel: &str,
143143
denom: &str, // should be ibc denom
144144
amount: Uint128,
145-
_forward: bool,
146145
) -> Result<(), ContractError> {
147146
let state = CHANNEL_REVERSE_STATE;
148-
// if forward {
149-
// state = CHANNEL_FORWARD_STATE;
150-
// }
151-
152147
state.update(storage, (channel, denom), |orig| -> StdResult<_> {
153148
let mut state = orig.unwrap_or_default();
154149
state.outstanding += amount;
@@ -163,12 +158,8 @@ pub fn reduce_channel_balance(
163158
channel: &str,
164159
denom: &str, // should be ibc denom
165160
amount: Uint128,
166-
_forward: bool,
167161
) -> Result<(), ContractError> {
168162
let state = CHANNEL_REVERSE_STATE;
169-
// if forward {
170-
// state = CHANNEL_FORWARD_STATE;
171-
// }
172163
state.update(
173164
storage,
174165
(channel, denom),

0 commit comments

Comments
 (0)