Update faucet

This commit is contained in:
nolash 2021-04-30 21:17:13 +02:00
parent 8db76dc0a8
commit b7115d2136
Signed by untrusted user who does not match committer: lash
GPG Key ID: 21D2E7BB88C2A746
7 changed files with 23 additions and 28 deletions

View File

@ -3,7 +3,7 @@ import logging
# external imports # external imports
import celery import celery
from erc20_single_shot_faucet import SingleShotFaucet as Faucet from erc20_faucet import Faucet
from hexathon import ( from hexathon import (
strip_0x, strip_0x,
) )
@ -21,7 +21,7 @@ from chainlib.eth.tx import (
from chainlib.chain import ChainSpec from chainlib.chain import ChainSpec
from chainlib.error import JSONRPCException from chainlib.error import JSONRPCException
from eth_accounts_index import AccountRegistry from eth_accounts_index import AccountRegistry
from sarafu_faucet import MinterFaucet as Faucet from sarafu_faucet import MinterFaucet
from chainqueue.db.models.tx import TxCache from chainqueue.db.models.tx import TxCache
# local import # local import
@ -185,7 +185,7 @@ def gift(self, account_address, chain_spec_dict):
# Generate and sign transaction # Generate and sign transaction
rpc_signer = RPCConnection.connect(chain_spec, 'signer') rpc_signer = RPCConnection.connect(chain_spec, 'signer')
nonce_oracle = CustodialTaskNonceOracle(account_address, self.request.root_id, session=session) #, default_nonce) nonce_oracle = CustodialTaskNonceOracle(account_address, self.request.root_id, session=session) #, default_nonce)
gas_oracle = self.create_gas_oracle(rpc, Faucet.gas) gas_oracle = self.create_gas_oracle(rpc, MinterFaucet.gas)
faucet = Faucet(chain_spec, signer=rpc_signer, nonce_oracle=nonce_oracle, gas_oracle=gas_oracle) faucet = Faucet(chain_spec, signer=rpc_signer, nonce_oracle=nonce_oracle, gas_oracle=gas_oracle)
(tx_hash_hex, tx_signed_raw_hex) = faucet.give_to(faucet_address, account_address, account_address, tx_format=TxFormat.RLP_SIGNED) (tx_hash_hex, tx_signed_raw_hex) = faucet.give_to(faucet_address, account_address, account_address, tx_format=TxFormat.RLP_SIGNED)
rpc_signer.disconnect() rpc_signer.disconnect()

View File

@ -13,9 +13,7 @@ from hexathon import (
strip_0x, strip_0x,
add_0x, add_0x,
) )
# TODO: use sarafu_Faucet for both when inheritance has been implemented from erc20_faucet import Faucet
from erc20_single_shot_faucet import SingleShotFaucet
from sarafu_faucet import MinterFaucet as Faucet
# local imports # local imports
from .base import SyncFilter from .base import SyncFilter
@ -71,14 +69,13 @@ class CallbackFilter(SyncFilter):
#transfer_data['token_address'] = tx.inputs[0] #transfer_data['token_address'] = tx.inputs[0]
faucet_contract = tx.inputs[0] faucet_contract = tx.inputs[0]
c = SingleShotFaucet(self.chain_spec) o = Faucet.token(faucet_contract, sender_address=self.caller_address)
o = c.token(faucet_contract, sender_address=self.caller_address)
r = conn.do(o) r = conn.do(o)
transfer_data['token_address'] = add_0x(c.parse_token(r)) transfer_data['token_address'] = add_0x(c.parse_token(r))
o = c.amount(faucet_contract, sender_address=self.caller_address) o = c.token_amount(faucet_contract, sender_address=self.caller_address)
r = conn.do(o) r = conn.do(o)
transfer_data['value'] = c.parse_amount(r) transfer_data['value'] = c.parse_token_amount(r)
return ('tokengift', transfer_data) return ('tokengift', transfer_data)

View File

@ -10,7 +10,7 @@ version = (
0, 0,
11, 11,
0, 0,
'beta.11', 'beta.12',
) )
version_object = semver.VersionInfo( version_object = semver.VersionInfo(

View File

@ -29,7 +29,7 @@ RUN /usr/local/bin/python -m pip install --upgrade pip
# python merge_requirements.py | tee merged_requirements.txt # python merge_requirements.py | tee merged_requirements.txt
#RUN cd cic-base && \ #RUN cd cic-base && \
# pip install $pip_extra_index_url_flag -r ./merged_requirements.txt # pip install $pip_extra_index_url_flag -r ./merged_requirements.txt
RUN pip install $pip_extra_index_url_flag cic-base[full_graph]==0.1.2a77 RUN pip install $pip_extra_index_url_flag cic-base[full_graph]==0.1.2b6
COPY cic-eth/scripts/ scripts/ COPY cic-eth/scripts/ scripts/
COPY cic-eth/setup.cfg cic-eth/setup.py ./ COPY cic-eth/setup.cfg cic-eth/setup.py ./

View File

@ -1,25 +1,24 @@
cic-base==0.1.2b5 cic-base==0.1.2b6
celery==4.4.7 celery==4.4.7
crypto-dev-signer~=0.4.14b3 crypto-dev-signer~=0.4.14b3
confini~=0.3.6rc3 confini~=0.3.6rc3
cic-eth-registry~=0.5.4a16 cic-eth-registry~=0.5.5a1
#cic-bancor~=0.0.6
redis==3.5.3 redis==3.5.3
alembic==1.4.2 alembic==1.4.2
websockets==8.1 websockets==8.1
requests~=2.24.0 requests~=2.24.0
eth_accounts_index~=0.0.11a9 eth_accounts_index~=0.0.11a10
erc20-transfer-authorization~=0.3.1a5 erc20-transfer-authorization~=0.3.1a5
uWSGI==2.0.19.1 uWSGI==2.0.19.1
semver==2.13.0 semver==2.13.0
websocket-client==0.57.0 websocket-client==0.57.0
moolb~=0.1.1b2 moolb~=0.1.1b2
eth-address-index~=0.1.1a9 eth-address-index~=0.1.1a10
chainlib~=0.0.2a20 chainlib~=0.0.2b1
hexathon~=0.0.1a7 hexathon~=0.0.1a7
chainsyncer[sql]~=0.0.2a2 chainsyncer[sql]~=0.0.2a2
chainqueue~=0.0.2a2 chainqueue~=0.0.2a2
pysha3==1.0.2 pysha3==1.0.2
coincurve==15.0.0 coincurve==15.0.0
sarafu-faucet==0.0.2a28 sarafu-faucet==0.0.3a1
potaahto~=0.0.1a1 potaahto~=0.0.1a1

View File

@ -51,15 +51,14 @@ RUN useradd --create-home grassroots
WORKDIR /home/grassroots WORKDIR /home/grassroots
USER grassroots USER grassroots
ARG pip_index_url=https://pypi.org/simple
ARG pip_extra_index_url=https://pip.grassrootseconomics.net:8433 ARG pip_extra_index_url=https://pip.grassrootseconomics.net:8433
ARG cic_base_version=0.1.2a79 ARG cic_base_version=0.1.2b6
ARG cic_eth_version=0.11.0b8+build.c2286e5c ARG cic_eth_version=0.11.0b12
ARG sarafu_faucet_version=0.0.2a28 ARG sarafu_faucet_version=0.0.3a1
ARG sarafu_token_version=0.0.1a6 ARG sarafu_token_version=0.0.1a6
ARG cic_contracts_version=0.0.2a2 RUN pip install --user --index-url $pip_index_url --extra-index-url $pip_extra_index_url cic-base[full_graph]==$cic_base_version \
RUN pip install --user --index-url https://pypi.org/simple --extra-index-url $pip_extra_index_url cic-base[full_graph]==$cic_base_version \
cic-eth==$cic_eth_version \ cic-eth==$cic_eth_version \
cic-contracts==$cic_contracts_version \
sarafu-faucet==$sarafu_faucet_version \ sarafu-faucet==$sarafu_faucet_version \
sarafu-token==$sarafu_token_version sarafu-token==$sarafu_token_version

View File

@ -1,5 +1,5 @@
cic-base[full_graph]==0.1.2b2 cic-base[full_graph]==0.1.2b6
sarafu-faucet==0.0.2a28 sarafu-faucet==0.0.3a1
cic-eth==0.11.0b10 cic-eth==0.11.0b12
cic-types==0.1.0a10 cic-types==0.1.0a10
crypto-dev-signer==0.4.14b3 crypto-dev-signer==0.4.14b3