Skip to content

Commit

Permalink
Aligned with net.ton.dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem Ryabov committed Dec 1, 2020
1 parent 38c496f commit 3333b37
Show file tree
Hide file tree
Showing 16 changed files with 187 additions and 190 deletions.
14 changes: 0 additions & 14 deletions scripts/check_node_sync_status.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
#!/bin/bash -eE

# Copyright 2020 TON DEV SOLUTIONS LTD.
#
# Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy of the
# License at:
#
# https://www.ton.dev/licenses
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific TON DEV software governing permissions and limitations
# under the License.

SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)
# shellcheck source=env.sh
. "${SCRIPT_DIR}/env.sh"
Expand Down
12 changes: 12 additions & 0 deletions scripts/confirmer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Confirmer script do:

Confirming multisig transactions.

Using two files `wallets.txt` and `p.txt` as wallets adreses and passphrases source.

Doing simple test for un empty payload and elector destinaton adress.


You need to dowload latest tonoscli and SafeMultisigWallet.abi.json as usual and put it near the script.
Install `jq` too.

62 changes: 62 additions & 0 deletions scripts/confirmer/confirm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/bash -eE

#check for the destination wallet

L_PATH="./"
L_FILE="confirmer.log"

function f_output() {
TS=$(date +%s)
TD=$(date +%FT%T%Z)
echo "${TD};${TS};${1}" >>"${L_PATH}${L_FILE}"
echo "${TD};${TS};${1}"
}

function f_check_trans() {
W_SOURCE=$1 # Source wallet
W_DEST=$2 # Destination wallet
W_PHRASE=$3 # seed phrase
TRAN=0

OUTPUT=$(${L_PATH}tonos-cli run "${W_SOURCE}" getTransactions {} --abi ${L_PATH}SafeMultisigWallet.abi.json | sed -ne '/Result/,$ p' | sed 's/Result: //')
N_TRAN=$(echo "${OUTPUT}" | jq '.transactions | length')

if [ "${N_TRAN}" == "" ]; then
f_output "${W_SOURCE};Bad_contract;"
elif [ "${N_TRAN}" -eq 0 ]; then
f_output "${W_SOURCE};No_transactions;"
else
while [ "${TRAN}" -lt "${N_TRAN}" ]; do
T_DEST=$(echo "${OUTPUT}" | jq -r ".transactions[${TRAN}].dest")
T_ID=$(echo "${OUTPUT}" | jq -r ".transactions[${TRAN}].id")
T_VALUE=$(echo "${OUTPUT}" | jq -r ".transactions[${TRAN}].value")
T_PAYLOAD=$(echo "${OUTPUT}" | jq -r ".transactions[${TRAN}].payload")
T_VALUE_D=$(printf "%d\n" "${T_VALUE}")
if [ "${T_DEST}" == "${W_DEST}" ] && [ "${T_PAYLOAD}" != "te6ccgEBAQEAAgAAAA==" ]; then
# shellcheck disable=SC2086
# shellcheck disable=SC2015
${L_PATH}tonos-cli call "${W_SOURCE}" confirmTransaction \
'{"transactionId":"'${T_ID}'"}' \
--abi ${L_PATH}SafeMultisigWallet.abi.json \
--sign "${W_PHRASE}" &&
f_output "${W_SOURCE};${T_ID};${T_DEST};${T_VALUE_D};Good;" ||
f_output "${W_SOURCE};${T_ID};${T_DEST};${T_VALUE_D};Network_error;"
else
f_output "${W_SOURCE};${T_ID};${T_DEST};${T_VALUE_D};Bad"
fi
TRAN=$((TRAN + 1))
done
fi
}

# ========= MAIN

# shellcheck disable=SC2207
WALLETS=($(cat ${L_PATH}wallets.txt))
WALLETS_NUM=$(wc -l ${L_PATH}wallets.txt | awk '{print $1}')
IFS=$'\n'
# shellcheck disable=SC2207
PHRASES=($(cat ${L_PATH}/p.txt))
for i in $(seq 0 $((WALLETS_NUM - 1))); do
f_check_trans "${WALLETS["$i"]}" -1:3333333333333333333333333333333333333333333333333333333333333333 "${PHRASES["$i"]}"
done
5 changes: 5 additions & 0 deletions scripts/confirmer/p.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
put your phrases there one by one
second passphrace for the wallet one
plus one
etc

12 changes: 12 additions & 0 deletions scripts/confirmer/tonlabs-cli.conf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"url": "https://main.ton.dev",
"wc": 0,
"addr": null,
"wallet": null,
"abi_path": null,
"keys_path": null,
"retries": 5,
"timeout": 60000,
"is_json": false,
"depool_fee": 0.5
}
4 changes: 4 additions & 0 deletions scripts/confirmer/wallets.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
put your wallets there one by one
-1:xxx
-1:yyy
-1:zzz
14 changes: 0 additions & 14 deletions scripts/create_wallet.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
#!/bin/bash -eE

# Copyright 2020 TON DEV SOLUTIONS LTD.
#
# Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy of the
# License at:
#
# https://www.ton.dev/licenses
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific TON DEV software governing permissions and limitations
# under the License

SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)
# shellcheck source=env.sh
. "${SCRIPT_DIR}/env.sh"
Expand Down
14 changes: 0 additions & 14 deletions scripts/deploy_wallet.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
#!/bin/bash -eE

# Copyright 2020 TON DEV SOLUTIONS LTD.
#
# Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy of the
# License at:
#
# https://www.ton.dev/licenses
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific TON DEV software governing permissions and limitations
# under the License.

SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)
# shellcheck source=env.sh
. "${SCRIPT_DIR}/env.sh"
Expand Down
14 changes: 0 additions & 14 deletions scripts/env.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
#!/bin/bash -eE

# Copyright 2020 TON DEV SOLUTIONS LTD.
#
# Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy of the
# License at:
#
# https://www.ton.dev/licenses
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific TON DEV software governing permissions and limitations
# under the License.

if [ "$DEBUG" = "yes" ]
then
set -x
Expand Down
15 changes: 0 additions & 15 deletions scripts/msig_genaddr.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
#!/bin/bash -eE

# Copyright 2020 TON DEV SOLUTIONS LTD.
#
# Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy of the
# License at:
#
# https://www.ton.dev/licenses
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific TON DEV software governing permissions and limitations
# under the License.
#

SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)
# shellcheck source=env.sh
. "${SCRIPT_DIR}/env.sh"
Expand Down
14 changes: 0 additions & 14 deletions scripts/preinit.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
#!/bin/bash -eE

# Copyright 2020 TON DEV SOLUTIONS LTD.
#
# Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy of the
# License at:
#
# https://www.ton.dev/licenses
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific TON DEV software governing permissions and limitations
# under the License.

SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)
# shellcheck source=env.sh
. "${SCRIPT_DIR}/env.sh"
Expand Down
14 changes: 0 additions & 14 deletions scripts/run.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
#!/bin/bash -eE

# Copyright 2020 TON DEV SOLUTIONS LTD.
#
# Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy of the
# License at:
#
# https://www.ton.dev/licenses
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific TON DEV software governing permissions and limitations
# under the License.

SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)
# shellcheck source=env.sh
. "${SCRIPT_DIR}/env.sh"
Expand Down
14 changes: 0 additions & 14 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
#!/bin/bash -eE

# Copyright 2020 TON DEV SOLUTIONS LTD.
#
# Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy of the
# License at:
#
# https://www.ton.dev/licenses
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific TON DEV software governing permissions and limitations
# under the License.

SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)
# shellcheck source=env.sh
. "${SCRIPT_DIR}/env.sh"
Expand Down
13 changes: 12 additions & 1 deletion scripts/tonlabs-cli.conf.json
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
{"url":"https://main.ton.dev","wc":0,"addr":null,"abi_path":null,"keys_path":null}
{
"url": "https://main.ton.dev",
"wc": 0,
"addr": null,
"wallet": null,
"abi_path": null,
"keys_path": null,
"retries": 5,
"timeout": 60000,
"is_json": false,
"depool_fee": 0.5
}
14 changes: 0 additions & 14 deletions scripts/validator.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
#!/bin/bash -eE

# Copyright 2020 TON DEV SOLUTIONS LTD.
#
# Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy of the
# License at:
#
# https://www.ton.dev/licenses
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific TON DEV software governing permissions and limitations
# under the License.

#DEBUG="yes"

if [ "$DEBUG" = "yes" ]; then
Expand Down
Loading

0 comments on commit 3333b37

Please sign in to comment.