Skip to content

Commit

Permalink
Merge branch 'neutron_audit_oak_19_09_2022_fixes' of github.com:neutr…
Browse files Browse the repository at this point in the history
…on-org/neutron-contracts into feat/new_transaction_filter
  • Loading branch information
ratik committed Nov 16, 2022
2 parents 5a5f0c1 + 9a67728 commit 57baaa3
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion artifacts/checksums.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
2dbfb02266cc61fbed36cc60bffe2abdbe2f825ab9eeece6cdf208f30888217a ibc_transfer.wasm
4d2a9f1b9d6e8181c3ecca744ae5e42667cfe9e4c2dccca1ae08a14235e18508 ibc_transfer.wasm
cbf63b17bd81dcce44a3ba3d5b4e61ec6f1da8e3a1f90041d518ac4397b326bd neutron_interchain_queries.wasm
a34dcff26a3709f5382d526ade65d41384e376eda7a28c07c588f4301554debe neutron_interchain_txs.wasm
e0746b2fc07dfa19ff2dc19b031874ff059118ed551f49128babbca64bae53cb neutron_validators_test.wasm
Expand Down
Binary file modified artifacts/ibc_transfer.wasm
Binary file not shown.
8 changes: 8 additions & 0 deletions contracts/ibc_transfer/schema/execute_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@
"denom": {
"type": "string"
},
"timeout_height": {
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0.0
},
"to": {
"type": "string"
}
Expand Down
12 changes: 9 additions & 3 deletions contracts/ibc_transfer/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ use crate::{
state::{IntegrationTestsSudoMock, INTEGRATION_TESTS_SUDO_MOCK},
};

// Default timeout for IbcTransfer is 10000000 blocks
const DEFAULT_TIMEOUT_HEIGHT: u64 = 10000000;

const CONTRACT_NAME: &str = concat!("crates.io:neutron-contracts__", env!("CARGO_PKG_NAME"));
const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");

Expand All @@ -47,6 +50,7 @@ pub enum ExecuteMsg {
to: String,
denom: String,
amount: u128,
timeout_height: Option<u64>,
},
SetFees {
recv_fee: u128,
Expand Down Expand Up @@ -81,7 +85,8 @@ pub fn execute(
to,
denom,
amount,
} => execute_send(deps, env, channel, to, denom, amount),
timeout_height,
} => execute_send(deps, env, channel, to, denom, amount, timeout_height),

ExecuteMsg::SetFees {
recv_fee,
Expand Down Expand Up @@ -197,6 +202,7 @@ fn execute_send(
to: String,
denom: String,
amount: u128,
timeout_height: Option<u64>,
) -> StdResult<Response<NeutronMsg>> {
let fee = IBC_FEE.load(deps.storage)?;
let coin1 = coin(amount, denom.clone());
Expand All @@ -208,7 +214,7 @@ fn execute_send(
token: coin1,
timeout_height: RequestPacketTimeoutHeight {
revision_number: Some(2),
revision_height: Some(10000000),
revision_height: timeout_height.or(Some(DEFAULT_TIMEOUT_HEIGHT)),
},
timeout_timestamp: 0,
fee: fee.clone(),
Expand All @@ -222,7 +228,7 @@ fn execute_send(
token: coin2,
timeout_height: RequestPacketTimeoutHeight {
revision_number: Some(2),
revision_height: Some(10000000),
revision_height: timeout_height.or(Some(DEFAULT_TIMEOUT_HEIGHT)),
},
timeout_timestamp: 0,
fee,
Expand Down
13 changes: 11 additions & 2 deletions validator_test_upload_contract.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ CONTRACT=${args[0]}

NEUTRON_KEY_NAME=validator_test
GAS_PRICES=0.01untrn
EXPLORER_URL=http://23.109.159.28:3333/
FAUCET_URL=http://23.109.159.28/
EXPLORER_URL=http://explorer.quark.ntrn.info/
FAUCET_URL=https://t.me/+Y_BQropm0_VlZjVi
NODE_URL="${NODE_URL:-tcp://localhost:26657}"

echo "Node url: $NODE_URL"
Expand Down Expand Up @@ -50,6 +50,15 @@ then
fi

echo "Local address in neutron: $NEUTRON_ADDRESS"
echo ""
echo " ##### ### ### ### "
echo "# # ## # # ###### # # ##### # # # # ###### # # #### # # # #### ### ### ### "
echo "# # # # # # # # # # ## ## ## # # ## ## # # ## # # # # ### ### ### "
echo " ##### # # # # ##### # # # # # ## # # # # ##### # ## # # # # # # # # # # # "
echo " # ###### # # # # # ##### # # # # # # # # # # # # # # # "
echo "# # # # # # # # # # # # # # ## # # # # # # ## # # # ### ### ### "
echo " ##### # # ## ###### #### # # # # # # ###### # # #### # # # #### ### ### ### "
echo ""
echo "Key mnemonic: $MNEMONIC"
echo "Key name: $NEUTRON_KEY_NAME"
echo ""
Expand Down

0 comments on commit 57baaa3

Please sign in to comment.