Skip to content

Commit

Permalink
Merge pull request #431 from keillera/ALIS-5803
Browse files Browse the repository at this point in the history
ALIS-5803: Fix bug that all types to unknown.
  • Loading branch information
hayago authored Nov 19, 2020
2 parents 2b8fcb1 + 7a0baaf commit 61b4bab
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '2.1'

services:
localstack:
image: localstack/localstack
image: localstack/localstack:0.11.4
ports:
- "4567-4583:4567-4583"
- "${PORT_WEB_UI-8080}:${PORT_WEB_UI-8080}"
Expand All @@ -19,4 +19,4 @@ services:
- DOCKER_HOST=unix:///var/run/docker.sock
volumes:
- "${TMPDIR:-/tmp/localstack}:/tmp/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
- "/var/run/docker.sock:/var/run/docker.sock"
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,22 @@ def add_type(self, from_eoa, to_eoa, eoa):
alis_bridge_contract_address = os.environ['PRIVATE_CHAIN_BRIDGE_ADDRESS']
# ssm上のBURN_ADDRESSは0xを省略しているため
burn_address = '0x' + os.environ['BURN_ADDRESS']
# eoa を比較用に小文字に変換
lower_eoa = eoa.lower()

if from_eoa == eoa and to_eoa == alis_bridge_contract_address:
if from_eoa == lower_eoa and to_eoa == alis_bridge_contract_address:
return 'withdraw'
elif from_eoa == eoa and to_eoa == burn_address:
elif from_eoa == lower_eoa and to_eoa == burn_address:
return 'pool'
elif from_eoa == eoa and to_eoa != '0x0000000000000000000000000000000000000000':
elif from_eoa == lower_eoa and to_eoa != '0x0000000000000000000000000000000000000000':
return 'give'
elif from_eoa == eoa and to_eoa == '0x0000000000000000000000000000000000000000':
elif from_eoa == lower_eoa and to_eoa == '0x0000000000000000000000000000000000000000':
return 'burn'
elif from_eoa == alis_bridge_contract_address and to_eoa == eoa:
elif from_eoa == alis_bridge_contract_address and to_eoa == lower_eoa:
return 'deposit'
elif from_eoa == '---' and to_eoa == eoa:
elif from_eoa == '---' and to_eoa == lower_eoa:
return 'get by like'
elif from_eoa != alis_bridge_contract_address and to_eoa == eoa:
elif from_eoa != alis_bridge_contract_address and to_eoa == lower_eoa:
return 'get from user'
else:
return 'unknown'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def test_add_type_ok(self):
'authorizer': {
'claims': {
'cognito:username': 'user_01',
'custom:private_eth_address': '0x1111111111111111111111111111111111111111',
'custom:private_eth_address': '0x1111111111111111111111111111111111111abc',
'cognito-identity': 'ap-northeast-1:hogehoge',
'phone_number_verified': 'true',
'email_verified': 'true'
Expand All @@ -233,7 +233,7 @@ def test_add_type_ok(self):
burn_address = os.environ['BURN_ADDRESS']

response = MeWalletTokenAllhistoriesCreate(
event, {}, self.dynamodb).add_type(user_eoa, alis_bridge_contract_address, user_eoa)
event, {}, self.dynamodb).add_type(user_eoa, alis_bridge_contract_address, user_eoa.upper())
self.assertEqual(response, 'withdraw')
response = MeWalletTokenAllhistoriesCreate(
event, {}, self.dynamodb).add_type(user_eoa, '0x' + burn_address, user_eoa)
Expand Down

0 comments on commit 61b4bab

Please sign in to comment.