Skip to content

Commit

Permalink
Merge pull request #9 from near/revert-8-deposit
Browse files Browse the repository at this point in the history
Revert "mint -> deposit"
  • Loading branch information
Kouprin committed Sep 10, 2020
2 parents f86bf1e + e0b7f53 commit d1e877c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
1 change: 1 addition & 0 deletions init/eth-contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class InitEthLocker {
const success = await ethContractInitializer.execute(
contractName,
[
RainbowConfig.getParam('eth-erc20-address'),
Buffer.from(RainbowConfig.getParam('near-fun-token-account'), 'utf8'),
RainbowConfig.getParam('eth-prover-address'),
],
Expand Down
2 changes: 1 addition & 1 deletion near-mintable-token/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class NearMintableToken extends BorshContract {
viewMethods: [],
changeMethods: [
{
methodName: 'deposit',
methodName: 'mint',
inputFieldType: 'Proof',
outputFieldType: null,
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rainbow-bridge-lib",
"version": "1.0.3",
"version": "1.0.2",
"description": "lib lib",
"author": "Near Inc.",
"repository": {
Expand Down
16 changes: 6 additions & 10 deletions transfer-eth-erc20/to-near.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,7 @@ class TransferETHERC20ToNear {
const transaction = await robustWeb3.callContract(
ethTokenLockerContract,
'lockToken',
[
RainbowConfig.getParam('eth-erc20-address'),
Number(amount),
nearReceiverAccount,
],
[Number(amount), nearReceiverAccount],
{
from: ethSenderAccount,
gas: 5000000,
Expand Down Expand Up @@ -183,7 +179,7 @@ class TransferETHERC20ToNear {
})
}

static async deposit({
static async mint({
proof_locker,
nearTokenContract,
nearTokenContractBorsh,
Expand All @@ -198,17 +194,17 @@ class TransferETHERC20ToNear {
)
// @ts-ignore
try {
await nearTokenContractBorsh.deposit(
await nearTokenContractBorsh.mint(
proof_locker,
new BN('300000000000000'),
// We need to attach tokens because minting (deposit) increases the contract state, by <600 bytes, which
// We need to attach tokens because minting increases the contract state, by <600 bytes, which
// requires an additional 0.06 NEAR to be deposited to the account for state staking.
// Note technically 0.0537 NEAR should be enough, but we round it up to stay on the safe side.
new BN('100000000000000000000').mul(new BN('600'))
)
console.log('Transferred')
} catch (e) {
console.log('Deposit failed with error:')
console.log('Mint failed with error:')
console.log(e)
TransferETHERC20ToNear.showRetryAndExit()
}
Expand Down Expand Up @@ -368,7 +364,7 @@ class TransferETHERC20ToNear {
transferLog = TransferETHERC20ToNear.loadTransferLog()
}
if (transferLog.finished === 'block-safe') {
await TransferETHERC20ToNear.deposit({
await TransferETHERC20ToNear.mint({
nearTokenContract,
nearTokenContractBorsh,
...transferLog,
Expand Down

0 comments on commit d1e877c

Please sign in to comment.