Skip to content
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

Resume transfer erc20 to near #188

Merged
merged 9 commits into from
Jul 28, 2020
Merged

Resume transfer erc20 to near #188

merged 9 commits into from
Jul 28, 2020

Conversation

ailisp
Copy link
Contributor

@ailisp ailisp commented Jul 16, 2020

Works locally:

➜  environment git:(resume-transfer) ✗ node index.js transfer-eth-erc20-to-near --amount 1000 \
--eth-sender-sk 0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501200 \
--near-receiver-account eth2nearprover --near-master-account nearfuntoken \
2>&1 | tee -a /tmp/eth2neartransfer.out
Approving token transfer.
Approved token transfer.
Transferring tokens from the ERC20 account to the token locker account.
Success tranfer to locker
Transferring 1000 tokens from 0x7cC4B1851c35959D34e635A470F6b5C43bA3C9c9 ERC20. From 0xDf08F82De32B8d460adbE8D72043E3a7e25A3B39 sender to eth2nearprover recipient
Eth2NearClient is currently at block 152. Waiting for block 154 to be confirmed. Sleeping for 10 sec.
Eth2NearClient is currently at block 154. Waiting for block 154 to be confirmed. Sleeping for 10 sec.
Eth2NearClient is currently at block 154. Waiting for block 154 to be confirmed. Sleeping for 10 sec.
^C
➜  environment git:(resume-transfer) ✗ node index.js transfer-eth-erc20-to-near --amount 1000 \
--eth-sender-sk 0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501200 \
--near-receiver-account eth2nearprover --near-master-account nearfuntoken \
2>&1 | tee -a /tmp/eth2neartransfer.out
Transferring 1000 tokens from 0x7cC4B1851c35959D34e635A470F6b5C43bA3C9c9 ERC20. From 0xDf08F82De32B8d460adbE8D72043E3a7e25A3B39 sender to eth2nearprover recipient
Eth2NearClient is currently at block 156. Waiting for block 154 to be confirmed. Sleeping for 10 sec.
Eth2NearClient is currently at block 156. Waiting for block 154 to be confirmed. Sleeping for 10 sec.
Eth2NearClient is currently at block 157. Waiting for block 154 to be confirmed. Sleeping for 10 sec.
Eth2NearClient is currently at block 158. Waiting for block 154 to be confirmed. Sleeping for 10 sec.
Eth2NearClient is currently at block 159. Waiting for block 154 to be confirmed. Sleeping for 10 sec.
Eth2NearClient is currently at block 160. Waiting for block 154 to be confirmed. Sleeping for 10 sec.
Eth2NearClient is currently at block 161. Waiting for block 154 to be confirmed. Sleeping for 10 sec.
Eth2NearClient is currently at block 161. Waiting for block 154 to be confirmed. Sleeping for 10 sec.
Eth2NearClient is currently at block 162. Waiting for block 154 to be confirmed. Sleeping for 10 sec.
Eth2NearClient is currently at block 163. Waiting for block 154 to be confirmed. Sleeping for 10 sec.
Balance of eth2nearprover before the transfer is 2000
TxHash 4KVuyz91eUxWCULzZX4VtDZvGLYLXnEpjG5TpKwjG5oQ
[
  'token: 7cc4b1851c35959d34e635a470f6b5c43ba3c9c9; sender: df08f82de32b8d460adbe8d72043e3a7e25a3b39; amount: 1000; recipient: eth2nearprover',
  'Refunding 42800000000000000000000 tokens for storage'
]
Transferred
Balance of eth2nearprover after the transfer is 3000

@ailisp ailisp marked this pull request as ready for review July 17, 2020 00:49
@ailisp ailisp changed the title Resume transfer Resume transfer erc20 to near Jul 17, 2020
Copy link
Contributor

@MaksymZavershynskyi MaksymZavershynskyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Sorry for the delay.


if (!logFound) {
console.log(`ERROR log not found for event ${lockedEvent}`);
if (transferLog.finished === undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice pattern.

transferLog = TransferETHERC20ToNear.loadTransferLog();
}
if (transferLog.finished === 'approve') {
await TransferETHERC20ToNear.lock({ ethTokenLockerContract, amount, nearReceiverAccount, ethSenderAccount });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we are passing args as an object?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Major benefit is no worry about sequence of arguments so it's less error prune when there're many args.

@ailisp ailisp merged commit 58def81 into master Jul 28, 2020
@ailisp ailisp deleted the resume-transfer branch July 28, 2020 22:53
@ailisp
Copy link
Contributor Author

ailisp commented Jul 28, 2020

Merge because fail is transfer from erc20 to near, irrevelant to this PR and fixed in #227

karim-en pushed a commit that referenced this pull request Dec 20, 2021
* resume transfer eth to near

* remove timeout for near prover verify dumped proof test

Co-authored-by: Maksym Zavershynskyi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants