-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Artem Ryabov
committed
Dec 1, 2020
1 parent
38c496f
commit 3333b37
Showing
16 changed files
with
187 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.