Skip to content

Commit

Permalink
update xbr abi (#1238)
Browse files Browse the repository at this point in the history
* update xbr abi
* bump version
  • Loading branch information
oberstet committed Aug 28, 2019
1 parent e0c3ec5 commit cd1597f
Show file tree
Hide file tree
Showing 19 changed files with 53,143 additions and 52,592 deletions.
2 changes: 1 addition & 1 deletion autobahn/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
#
###############################################################################

__version__ = u'19.8.1'
__version__ = u'19.9.1'
2 changes: 1 addition & 1 deletion autobahn/xbr/_buyer.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from autobahn.twisted.util import sleep
from autobahn.wamp.exception import ApplicationError
from autobahn.wamp.protocol import ApplicationSession
from cfxdb import unpack_uint256
from ._util import unpack_uint256

import web3
import eth_keys
Expand Down
2 changes: 1 addition & 1 deletion autobahn/xbr/_seller.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
from autobahn.wamp.exception import ApplicationError, TransportLost
from autobahn.wamp.protocol import ApplicationSession
from autobahn.twisted.util import sleep
from cfxdb import unpack_uint256
from ._util import unpack_uint256

from autobahn import xbr

Expand Down
45 changes: 43 additions & 2 deletions autobahn/xbr/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,57 @@
from binascii import a2b_hex

import click
import web3
from autobahn.xbr import XBR_DEBUG_NETWORK_ADDR

import eth_keys
from py_eth_sig_utils import signing

from cfxdb import unpack_uint256, unpack_uint128

_EIP712_SIG_LEN = 32 + 32 + 1


def unpack_uint128(data):
assert data is None or type(data) == bytes, 'data must by bytes, was {}'.format(type(data))
if data and type(data) == bytes:
assert len(data) == 16, 'data must be bytes[16], but was bytes[{}]'.format(len(data))

if data:
return web3.Web3.toInt(data)
else:
return 0


def pack_uint128(value):
assert value is None or (type(value) == int and value >= 0 and value < 2**128)

if value:
data = web3.Web3.toBytes(value)
return b'\x00' * (16 - len(data)) + data
else:
return b'\x00' * 16


def unpack_uint256(data):
assert data is None or type(data) == bytes, 'data must by bytes, was {}'.format(type(data))
if data and type(data) == bytes:
assert len(data) == 32, 'data must be bytes[32], but was bytes[{}]'.format(len(data))

if data:
return web3.Web3.toInt(data)
else:
return 0


def pack_uint256(value):
assert value is None or (type(value) == int and value >= 0 and value < 2**256), 'value must be uint256, but was {}'.format(value)

if value:
data = web3.Web3.toBytes(value)
return b'\x00' * (32 - len(data)) + data
else:
return b'\x00' * 32


def hl(text, bold=True, color='yellow'):
if not isinstance(text, str):
text = '{}'.format(text)
Expand Down
836 changes: 418 additions & 418 deletions autobahn/xbr/contracts/ECDSA.json

Large diffs are not rendered by default.

4,000 changes: 2,000 additions & 2,000 deletions autobahn/xbr/contracts/ERC20.json

Large diffs are not rendered by default.

0 comments on commit cd1597f

Please sign in to comment.