New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation of ERC20 funding transaction #476

Closed
D4nte opened this Issue Nov 23, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@D4nte
Copy link
Member

D4nte commented Nov 23, 2018

To validate ERC20 funding transaction, we must verify that the contract call emitted a Transfer event on the token contract.

DoD:
Update the LQS query to include filtering on Transfer() event emitted by the token contract.

Child of #399.
Needs #412 (tracks adding of log parameter to LQS)

@thomaseizinger

This comment has been minimized.

Copy link
Member

thomaseizinger commented Nov 23, 2018

I think we don't need the is_successful parameter. The log will not be emitted if it is not successfully executed.

@D4nte D4nte added the icebox label Nov 25, 2018

@bonomat bonomat added groomed and removed icebox labels Dec 12, 2018

@D4nte D4nte added groomed and removed groomed labels Dec 12, 2018

@D4nte D4nte added sprint-backlog and removed groomed labels Jan 8, 2019

@D4nte D4nte added this to the Sprint 5 📜🔓 milestone Jan 9, 2019

@bonomat

This comment has been minimized.

Copy link
Member

bonomat commented Jan 16, 2019

Implementation hint:

  • retrieve the transaction receipt for each transaction
  • iterate over all logs
  • check if address field is the erc20 token contract
  • verify the topics and data field

example logs from redeeming HTLC and transferring the tokens. the second log entry is the ERC20 token transfer

[ { address: '0xe46FB33e4DB653De84cB0E0E8b810A6c4cD39d59',
    blockHash:
     '0x2822c1a8fcbdd4e1421fa8007216750903dcbd01ab1dde613775ec53805f3b9d',
    blockNumber: 6,
    data: '0x',
    logIndex: 0,
    removed: false,
    topics:
     [ '0xb8cac300e37f03ad332e581dea21b2f0b84eaaadc184a295fef71e81f44a7413' ],
    transactionHash:
     '0xdfd278be493c83828b8845fe292b0736e7e11d8fc2194563472ccd42d56deac4',
    transactionIndex: 0,
    transactionLogIndex: '0x0',
    type: 'mined',
    id: 'log_f28bd087' },
  { address: '0xb4c79daB8f259C7Aee6E5b2Aa729821864227e84',
    blockHash:
     '0x2822c1a8fcbdd4e1421fa8007216750903dcbd01ab1dde613775ec53805f3b9d',
    blockNumber: 6,
    data:
     '0x0000000000000000000000000000000000000000000000000000000000000190',
    logIndex: 1,
    removed: false,
    topics:
     [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
       '0x000000000000000000000000e46fb33e4db653de84cb0e0e8b810a6c4cd39d59',
       '0x000000000000000000000000d51ecee7414c4445534f74208538683702cbb3e4' ],
    transactionHash:
     '0xdfd278be493c83828b8845fe292b0736e7e11d8fc2194563472ccd42d56deac4',
    transactionIndex: 0,
    transactionLogIndex: '0x1',
    type: 'mined',
    id: 'log_24e7a7b0' } ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment