|
627 | 627 | else |
628 | 628 | errorMsg=$(jq -r .errorMsg <<< ${signerJSON} 2> /dev/null) |
629 | 629 | echo -e "\e[0m Anchor-Data: ${iconYes}\e[32m JSONLD structure is ok\e[0m"; |
630 | | - { read govActionTitle; read proofDepositReturnAddr; read proofWithdrawalAddr; } <<< $(jq -r '.body.title // "-", .body.onChain.depositReturnAddress // "-", .body.onChain.withdrawals[0].withdrawalAddress // "-"' ${tmpAnchorContent} 2> /dev/null) |
| 630 | + { read govActionTitle; read proofDepositReturnAddr; read proofWithdrawalAddr; } <<< $(jq -r '.body.title // "-", .body.onChain.depositReturnAddress // "-", if (.body.onChain.withdrawals[0]) then ([.body.onChain.withdrawals[].withdrawalAddress] | add) else "-" end' ${tmpAnchorContent} 2> /dev/null) |
631 | 631 | if [[ "${errorMsg}" != "" ]]; then echo -e "\e[0m Notice: ${iconNo} ${errorMsg}\e[0m"; fi |
632 | 632 | authors=$(jq -r --arg iconYes "${iconYes}" --arg iconNo "${iconNo}" '.authors[] | "\\e[0m Signature: \(if .valid then $iconYes else $iconNo end) \(.name) (PubKey \(.publicKey))\\e[0m"' <<< ${signerJSON} 2> /dev/null) |
633 | 633 | if [[ "${authors}" != "" ]]; then echo -e "${authors}\e[0m"; fi |
|
660 | 660 |
|
661 | 661 | echo |
662 | 662 |
|
663 | | - #Show deposit return stakeaddress |
664 | | - case "${actionDepositReturnNetwork,,}${actionDepositReturnKeyType,,}" in |
665 | | - *"scripthash") echo -e "\e[0mDeposit Return-ScriptHash:\e[32m ${actionDepositReturnHash} \e[0m\n" |
| 663 | + #Show deposit return stakeaddress |
| 664 | + case "${actionDepositReturnNetwork,,}${actionDepositReturnKeyType,,}" in |
| 665 | + |
| 666 | + "mainnetkeyhash") actionDepositAddr=$(${bech32_bin} "stake" <<< "e1${actionDepositReturnHash}" 2> /dev/null); |
| 667 | + if [[ $? -ne 0 ]]; then echo -e "\n\e[35mERROR - Could not get Deposit-Return Stake-Address from KeyHash '${actionDepositReturnHash}' !\n\e[0m"; exit 1; fi |
| 668 | + echo -e "\e[0mDeposit return to\e[32m Stake-Addr \e[0m► \e[94m${actionDepositAddr}\e[0m\n" |
| 669 | + ;; |
| 670 | + |
| 671 | + "testnetkeyhash") actionDepositAddr=$(${bech32_bin} "stake_test" <<< "e0${actionDepositReturnHash}" 2> /dev/null); |
| 672 | + if [[ $? -ne 0 ]]; then echo -e "\n\e[35mERROR - Could not get Deposit-Return Stake-Address from KeyHash '${actionDepositReturnHash}' !\n\e[0m"; exit 1; fi |
| 673 | + echo -e "\e[0mDeposit return to\e[32m Stake-Addr \e[0m► \e[94m${actionDepositAddr}\e[0m\n" |
666 | 674 | ;; |
667 | 675 |
|
668 | | - "mainnet"*) actionDepositAddr=$(${bech32_bin} "stake" <<< "e1${actionDepositReturnHash}" 2> /dev/null); |
669 | | - if [[ $? -ne 0 ]]; then echo -e "\n\e[35mERROR - Could not get Deposit-Return Stake-Address from Return-KeyHash '${actionDepositReturnHash}' !\n\e[0m"; exit 1; fi |
670 | | - echo -e "\e[0mDeposit Return-StakeAddr:\e[32m ${actionDepositAddr} \e[0m\n" |
| 676 | + "mainnetscripthash") actionDepositAddr=$(${bech32_bin} "stake" <<< "f1${actionDepositReturnHash}" 2> /dev/null); |
| 677 | + if [[ $? -ne 0 ]]; then echo -e "\n\e[35mERROR - Could not get Deposit-Return Script-Address from ScriptHash '${actionDepositReturnHash}' !\n\e[0m"; exit 1; fi |
| 678 | + echo -e "\e[0mDeposit return to\e[32m ScriptAddr \e[0m► \e[94m${actionDepositAddr} \e[90m(${actionDepositReturnHash})\e[0m\n" |
671 | 679 | ;; |
672 | 680 |
|
673 | | - "testnet"*) actionDepositAddr=$(${bech32_bin} "stake_test" <<< "e0${actionDepositReturnHash}" 2> /dev/null); |
674 | | - if [[ $? -ne 0 ]]; then echo -e "\n\e[35mERROR - Could not get Deposit-Return Stake-Address from Return-KeyHash '${actionDepositReturnHash}' !\n\e[0m"; exit 1; fi |
675 | | - echo -e "\e[0mDeposit Return-StakeAddr:\e[32m ${actionDepositAddr} \e[0m\n" |
| 681 | + "testnetscripthash") actionDepositAddr=$(${bech32_bin} "stake_test" <<< "f0${actionDepositReturnHash}" 2> /dev/null); |
| 682 | + if [[ $? -ne 0 ]]; then echo -e "\n\e[35mERROR - Could not get Deposit-Return Script-Address from ScriptHash '${actionDepositReturnHash}' !\n\e[0m"; exit 1; fi |
| 683 | + echo -e "\e[0mDeposit return to\e[32m ScriptAddr \e[0m► \e[94m${actionDepositAddr} \e[90m(${actionDepositReturnHash})\e[0m\n" |
676 | 684 | ;; |
677 | 685 |
|
678 | | - *) echo -e "\n\e[35mERROR - Unknown network type ${actionDepositReturnNetwork} for the Deposit-Return KeyHash !\n\e[0m"; exit 1; |
| 686 | + *) echo -e "\n\e[35mERROR - Unknown network type '${actionDepositReturnNetwork}' for the Deposit-Return Key/ScriptHash '${actionDepositReturnHash}' !\n\e[0m"; exit 1; |
679 | 687 | ;; |
680 | 688 | esac |
681 | 689 |
|
|
965 | 973 | { read withdrawalsAmount; read withdrawalsKeyType; read withdrawalsHash; read withdrawalsNetwork; } <<< $( jq -r ".[${tmpCnt3}][1] // 0, (.[${tmpCnt3}][0].credential|keys[0]) // null, (.[${tmpCnt3}][0].credential|flatten[0]) // null, .[${tmpCnt3}][0].network // null" 2> /dev/null <<< ${withdrawalEntries}) |
966 | 974 | case "${withdrawalsNetwork,,}${withdrawalsKeyType,,}" in |
967 | 975 |
|
968 | | - *"scripthash") echo -e "\e[0mWithdrawal to\e[32m ScriptHash \e[0m► \e[94m${withdrawalsHash}\e[0m" |
969 | | - ;; |
| 976 | + "mainnetkeyhash") withdrawalsAddr=$(${bech32_bin} "stake" <<< "e1${withdrawalsHash}" 2> /dev/null); |
| 977 | + if [[ $? -ne 0 ]]; then echo -e "\n\e[35mERROR - Could not get Withdrawals Stake-Address from KeyHash '${withdrawalsHash}' !\n\e[0m"; exit 1; fi |
| 978 | + echo -e "\e[0mWithdrawal to\e[32m Stake-Addr \e[0m► \e[94m${withdrawalsAddr}\e[0m" |
| 979 | + ;; |
970 | 980 |
|
971 | | - "mainnet"*) withdrawalsAddr=$(${bech32_bin} "stake" <<< "e1${withdrawalsHash}" 2> /dev/null); |
972 | | - if [[ $? -ne 0 ]]; then echo -e "\n\e[35mERROR - Could not get Withdrawals Stake-Address from KeyHash '${withdrawalsHash}' !\n\e[0m"; exit 1; fi |
973 | | - echo -e "\e[0mWithdrawal to\e[32m StakeAddr \e[0m► \e[94m${withdrawalsAddr}\e[0m" |
974 | | - ;; |
| 981 | + "testnetkeyhash") withdrawalsAddr=$(${bech32_bin} "stake_test" <<< "e0${withdrawalsHash}" 2> /dev/null); |
| 982 | + if [[ $? -ne 0 ]]; then echo -e "\n\e[35mERROR - Could not get Withdrawals Stake-Address from KeyHash '${withdrawalsHash}' !\n\e[0m"; exit 1; fi |
| 983 | + echo -e "\e[0mWithdrawal to\e[32m Stake-Addr \e[0m► \e[94m${withdrawalsAddr}\e[0m" |
| 984 | + ;; |
975 | 985 |
|
976 | | - "testnet"*) withdrawalsAddr=$(${bech32_bin} "stake_test" <<< "e0${withdrawalsHash}" 2> /dev/null); |
977 | | - if [[ $? -ne 0 ]]; then echo -e "\n\e[35mERROR - Could not get Withdrawals Stake-Address from KeyHash '${withdrawalsHash}' !\n\e[0m"; exit 1; fi |
978 | | - echo -e "\e[0mWithdrawal to\e[32m StakeAddr \e[0m► \e[94m${withdrawalsAddr}\e[0m" |
979 | | - ;; |
| 986 | + "mainnetscripthash") withdrawalsAddr=$(${bech32_bin} "stake" <<< "f1${withdrawalsHash}" 2> /dev/null); |
| 987 | + if [[ $? -ne 0 ]]; then echo -e "\n\e[35mERROR - Could not get Withdrawals Script-Address from ScriptHash '${withdrawalsHash}' !\n\e[0m"; exit 1; fi |
| 988 | + echo -e "\e[0mWithdrawal to\e[32m ScriptAddr \e[0m► \e[94m${withdrawalsAddr} \e[90m(${withdrawalsHash})\e[0m" |
| 989 | + ;; |
980 | 990 |
|
981 | | - "") echo -e "\e[0mWithdrawal \e[32mdirectly\e[0m to the \e[94mDeposit-Return-Address\n\e[0m" |
982 | | - withdrawalsAddr="${actionDepositAddr}" |
983 | | - ;; |
| 991 | + "testnetscripthash") withdrawalsAddr=$(${bech32_bin} "stake_test" <<< "f0${withdrawalsHash}" 2> /dev/null); |
| 992 | + if [[ $? -ne 0 ]]; then echo -e "\n\e[35mERROR - Could not get Withdrawals Script-Address from ScriptHash '${withdrawalsHash}' !\n\e[0m"; exit 1; fi |
| 993 | + echo -e "\e[0mWithdrawal to\e[32m ScriptAddr \e[0m► \e[94m${withdrawalsAddr} \e[90m(${withdrawalsHash})\e[0m" |
| 994 | + ;; |
984 | 995 |
|
985 | | - *) echo -e "\n\e[35mERROR - Unknown network type ${withdrawalsNetwork} for the Withdrawal KeyHash !\n\e[0m"; exit 1; |
986 | | - ;; |
987 | | - esac |
988 | | - echo -e "\e[0mWithdrawal the\e[32m Amount \e[0m► \e[94m$(convertToADA ${withdrawalsAmount}) ADA / ${withdrawalsAmount} lovelaces\e[0m" |
989 | | - echo -e "\e[0m" |
990 | | - done |
| 996 | + "") echo -e "\e[0mWithdrawal \e[32mdirectly\e[0m to the \e[94mDeposit-Return-Address\n\e[0m" |
| 997 | + withdrawalsAddr="${actionDepositAddr}" |
| 998 | + ;; |
991 | 999 |
|
992 | | - #Show an alert if there is a special proof for the withdrawal address and it does not match up with the one in the action |
993 | | - if [[ "${proofWithdrawalAddr}" != "-" ]]; then |
994 | | - if [[ "${proofWithdrawalAddr}" == "${withdrawalsAddr}" ]]; then |
995 | | - echo -e "\e[0m${iconYes} The Withdrawal StakeAddr in the govAction is the same as in the metadata proof!\e[0m\n"; |
996 | | - else |
997 | | - echo -e "\e[0m${iconNo} The Withdrawal StakeAddr in the govAction is not the same as in the metadata proof!\e[0m\n"; |
| 1000 | + *) echo -e "\n\e[35mERROR - Unknown network type '${withdrawalsNetwork}' for the Withdrawal KeyHash '${withdrawalsHash}' !\n\e[0m"; exit 1; |
| 1001 | + ;; |
| 1002 | + |
| 1003 | + esac |
| 1004 | + echo -e "\e[0mWithdrawal of the\e[32m Amount \e[0m► \e[94m$(convertToADA ${withdrawalsAmount}) ADA / ${withdrawalsAmount} lovelaces\e[0m\n" |
| 1005 | + |
| 1006 | + #Show an alert if there is a special proof for the withdrawal address and it does not match up with the one in the action |
| 1007 | + if [[ "${proofWithdrawalAddr}" != "-" ]]; then |
| 1008 | + if [[ "${proofWithdrawalAddr}" == *"${withdrawalsAddr}"* ]]; then |
| 1009 | + echo -e "\e[0m${iconYes} The Withdrawal StakeAddr in the govAction is contained in the metadata proof!\e[0m\n"; |
| 1010 | + else |
| 1011 | + echo -e "\e[0m${iconNo} The Withdrawal StakeAddr in the govAction is not contained in the metadata proof!\e[0m\n"; |
| 1012 | + fi |
998 | 1013 | fi |
999 | | - fi |
| 1014 | + |
| 1015 | + done |
1000 | 1016 |
|
1001 | 1017 | #Calculate acceptance: Get the right threshold, make it a nice percentage number, check if threshold is reached |
1002 | 1018 | { read dRepPowerThreshold; } <<< $(jq -r '.dRepVotingThresholds.treasuryWithdrawal // 0' <<< "${protocolParametersJSON}" 2> /dev/null) |
|
0 commit comments