Added changes to wrong branch
This commit is contained in:
parent
d35e144723
commit
1c022e9853
@ -10,6 +10,9 @@ from chainlib.eth.tx import (
|
|||||||
TxFormat,
|
TxFormat,
|
||||||
unpack,
|
unpack,
|
||||||
)
|
)
|
||||||
|
from chainlib.eth.contract import (
|
||||||
|
ABIContractEncoder,
|
||||||
|
)
|
||||||
from cic_eth_registry import CICRegistry
|
from cic_eth_registry import CICRegistry
|
||||||
from cic_eth_registry.erc20 import ERC20Token
|
from cic_eth_registry.erc20 import ERC20Token
|
||||||
from hexathon import (
|
from hexathon import (
|
||||||
@ -155,7 +158,7 @@ def transfer_from(self, tokens, holder_address, receiver_address, value, chain_s
|
|||||||
|
|
||||||
session = self.create_session()
|
session = self.create_session()
|
||||||
nonce_oracle = CustodialTaskNonceOracle(holder_address, self.request.root_id, session=session)
|
nonce_oracle = CustodialTaskNonceOracle(holder_address, self.request.root_id, session=session)
|
||||||
gas_oracle = self.create_gas_oracle(rpc, MaxGasOracle.gas)
|
gas_oracle = self.create_gas_oracle(rpc, t['address'], MaxGasOracle.gas)
|
||||||
c = ERC20(chain_spec, signer=rpc_signer, gas_oracle=gas_oracle, nonce_oracle=nonce_oracle)
|
c = ERC20(chain_spec, signer=rpc_signer, gas_oracle=gas_oracle, nonce_oracle=nonce_oracle)
|
||||||
try:
|
try:
|
||||||
(tx_hash_hex, tx_signed_raw_hex) = c.transfer_from(t['address'], spender_address, holder_address, receiver_address, value, tx_format=TxFormat.RLP_SIGNED)
|
(tx_hash_hex, tx_signed_raw_hex) = c.transfer_from(t['address'], spender_address, holder_address, receiver_address, value, tx_format=TxFormat.RLP_SIGNED)
|
||||||
@ -226,6 +229,11 @@ def transfer(self, tokens, holder_address, receiver_address, value, chain_spec_d
|
|||||||
|
|
||||||
session = self.create_session()
|
session = self.create_session()
|
||||||
nonce_oracle = CustodialTaskNonceOracle(holder_address, self.request.root_id, session=session)
|
nonce_oracle = CustodialTaskNonceOracle(holder_address, self.request.root_id, session=session)
|
||||||
|
|
||||||
|
enc = ABIContractEncoder()
|
||||||
|
enc.method('transferFrom')
|
||||||
|
method = enc.get()
|
||||||
|
|
||||||
gas_oracle = self.create_gas_oracle(rpc, MaxGasOracle.gas)
|
gas_oracle = self.create_gas_oracle(rpc, MaxGasOracle.gas)
|
||||||
c = ERC20(chain_spec, signer=rpc_signer, gas_oracle=gas_oracle, nonce_oracle=nonce_oracle)
|
c = ERC20(chain_spec, signer=rpc_signer, gas_oracle=gas_oracle, nonce_oracle=nonce_oracle)
|
||||||
try:
|
try:
|
||||||
|
@ -71,13 +71,6 @@ celery_app = celery.current_app
|
|||||||
logg = logging.getLogger()
|
logg = logging.getLogger()
|
||||||
|
|
||||||
|
|
||||||
MAXIMUM_FEE_UNITS = 8000000
|
|
||||||
|
|
||||||
class MaxGasOracle:
|
|
||||||
|
|
||||||
def gas(code=None):
|
|
||||||
return MAXIMUM_FEE_UNITS
|
|
||||||
|
|
||||||
|
|
||||||
@celery_app.task(base=CriticalSQLAlchemyTask)
|
@celery_app.task(base=CriticalSQLAlchemyTask)
|
||||||
def apply_gas_value_cache(address, method, value, tx_hash):
|
def apply_gas_value_cache(address, method, value, tx_hash):
|
||||||
@ -85,8 +78,8 @@ def apply_gas_value_cache(address, method, value, tx_hash):
|
|||||||
|
|
||||||
|
|
||||||
def apply_gas_value_cache_local(address, method, value, tx_hash, session=None):
|
def apply_gas_value_cache_local(address, method, value, tx_hash, session=None):
|
||||||
address = strip_0x(address)
|
address = tx_normalize.executable_address(address)
|
||||||
tx_hash = strip_0x(tx_hash)
|
tx_hash = tx_normalize.tx_hash(tx_hash)
|
||||||
value = int(value)
|
value = int(value)
|
||||||
|
|
||||||
session = SessionBase.bind_session(session)
|
session = SessionBase.bind_session(session)
|
||||||
|
@ -10,7 +10,6 @@ from chainlib.chain import ChainSpec
|
|||||||
from chainlib.connection import RPCConnection
|
from chainlib.connection import RPCConnection
|
||||||
from chainlib.eth.constant import ZERO_ADDRESS
|
from chainlib.eth.constant import ZERO_ADDRESS
|
||||||
from chainlib.eth.nonce import RPCNonceOracle
|
from chainlib.eth.nonce import RPCNonceOracle
|
||||||
from chainlib.eth.gas import RPCGasOracle
|
|
||||||
from cic_eth_registry import CICRegistry
|
from cic_eth_registry import CICRegistry
|
||||||
from cic_eth_registry.error import UnknownContractError
|
from cic_eth_registry.error import UnknownContractError
|
||||||
|
|
||||||
@ -30,7 +29,7 @@ class BaseTask(celery.Task):
|
|||||||
call_address = ZERO_ADDRESS
|
call_address = ZERO_ADDRESS
|
||||||
trusted_addresses = []
|
trusted_addresses = []
|
||||||
create_nonce_oracle = RPCNonceOracle
|
create_nonce_oracle = RPCNonceOracle
|
||||||
create_gas_oracle = RPCGasOracle
|
create_gas_oracle = CacheGasOracle
|
||||||
default_token_address = None
|
default_token_address = None
|
||||||
default_token_symbol = None
|
default_token_symbol = None
|
||||||
default_token_name = None
|
default_token_name = None
|
||||||
|
Loading…
Reference in New Issue
Block a user