Skip to content
Snippets Groups Projects
Commit 01841260 authored by Robert Martin-Lègene's avatar Robert Martin-Lègene
Browse files

Renaming Gas Well to Distillery

parent 0d0e988e
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
if [ -z "${BFAHOME}" ]; then echo "\$BFAHOME not set. Did you source bfa/bin/env ?" >&2; exit 1; fi
source ${BFAHOME}/bin/libbfa.sh || exit 1
# get number of accounts
# get limit of every account
# allow scroll up/down to select an account
# press enter to edit an account's limit
# press ins to add an account
# press del to delete an account (set limit = 0)
# press Q to quit.
js=$( mktemp )
out=$( mktemp )
cleanup $js $out
yes | head -1000
function admin
{
while :
do
(
echo var contract = $( contract GasWell )
echo "var pos = contract.numberOfBeneficiaries.call();"
echo "while (pos-- > 0) { var r=contract.atPosition(pos); console.log(r[0]+':'+r[1]);}"
) > $js
cat $js
geth_attach < $js > $out
cat $out
readarray -t < $out
# Delete last entry, because that's the "return value from our call to geth".
unset MAPFILE[$(( ${#MAPFILE[*]} - 1 ))]
if [ ${#MAPFILE[*]} -gt 0 ]
then
printf "%5s %-42s %10s\n" Index "Account address" Value
echo ''
for key in ${!MAPFILE[*]}
do
val=${MAPFILE[$key]}
printf "%5d %-42s %10s\n" $key ${val%:*} ${val#*:}
done
echo
echo '["+"=New entry, Q=quit, index number]'
read -p "Change which one of these: "
else
echo "No accounts found."
REPLY="+"
fi
if [ "${REPLY^^}" = "Q" -o -z "${REPLY}" ]
then
return
elif [ "${REPLY}" = "+" ]
then
read -p "Enter new account address: " acct
if [ ${#acct} -eq 40 -a "${acct:0:2}" != "0x" ]
then
acct="0x${acct}"
fi
amount=0
elif [ "${REPLY}" != '+' ]; REPLY=$( echo ${REPLY} | sed 's/[^0-9]//' ); [ -n "${REPLY}" ]
then
if [ ${#MAPFILE[*]} -gt "${REPLY}" ]
then
amount=${MAPFILE[${REPLY}]}
acct=${amount%:*}
amount=${amount#*:}
fi
else
return
fi
echo '["DEL"=delete]'
read -i "${amount}" -p "Set value for account ${acct}: " amount
if [ "${amount^^:0:3}" = "DEL" ]
then
amount=0
fi
contractSendTx GasWell setEtherAllowance \"$acct\" ${amount} | geth_attach
done
}
admin
#void setEtherAllowance( address, uint256 )
#uint256 numberOfBeneficiaries( )
#void distribute( )
#uint256 getEtherAllowance( address )
File moved
// vim:filetype=javascript
pragma solidity ^0.4.24;
contract GasWell {
contract Distillery {
address owner;
struct Allowances {
address beneficiary;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment