Failure: invalid address or ENS name (argument="name", value=undefined, code=INVALID_ARGUMENT, version=contracts/5.5.0)
See original GitHub issueHello! It is my first time issuing anything on github 😃
Anyways, I had a problem using ethers with truffle and serverless (lambda).
`
const l1Provider = new providers.JsonRpcProvider(someTestNetRPC + infuraKey);
const l2Provider = new providers.JsonRpcProvider(someSideChainRPC + infuraKey);
console.log("Providers getting ready for deposit custom token...");
await l1Provider.ready;
console.log("Layer 1 provider has been readied...");
await l2Provider.ready;
console.log("Layer 2 provider has been readied...");
console.log("Providers have been established... Waiting for Bridge initiation");
var requestData = event.queryStringParameters;
var tokenAmount = requestData["tokenAmount"];
// var secretMnemonic = requestData["mnemonic"];
console.log("Token Amount: " + BigNumber.from(tokenAmount));
const l1Wallet = new Wallet(secretKey, l1Provider);
const l2Wallet = new Wallet(secretKey, l2Provider);
const bridge = await Bridge.init(l1Wallet, l2Wallet);
console.log("Bridge Has been initiated!");
console.log("Target Token Address: " + tokenAddress);
const approveTx = await bridge.approveToken(tokenAddress);
const approveRec = await approveTx.wait();
console.log("Transaction Hash: " + approveRec.transactionHash + '\nCompleted Approving Contract. You will be seeing the result very soon');
console.log("Type of data type Contract Address: " + typeof(tokenAddress));
const depositTx = await bridge.deposit(
tokenAddress,
BigNumber.from(tokenAmount),
// BigNumber.from(10000000000000),
// BigNumber.from(0),
// undefined,
// {gasLimit: 210000, gasPrice: utils.parseUnits("10", "gwei")}
);
` Above is my code, I hope this is eligible. As you can see I am trying to deposit erc 20 token to my side chain, and I have used the example code to make transition happen. However, from ethers part, I keep on getting invalid address or ENS name. I am pretty sure that it takes my token Address as an undefined variable, which I checked it goes in as string. Also, I keep my tokenAddress, infura keys , and secret keys in .env file. (I hope it does not matter).
I am really sorry if this is not ethers’ problem, but I wasn’t sure if it is ethers’ part or the bridge’s part. It will be really helpful if anyone has any opinion on this one. Cheers
Issue Analytics
- State:
- Created 2 years ago
- Comments:15 (6 by maintainers)
Top GitHub Comments
@ricmoo commented on January 9, 2022 6:29 PM:
Unfortunately that’s just a very inefficient workaround. The real problem is that the stack trace doesn’t give the necessary information about the source of the issue. It would be great to fix this instead, then I suspect many of these issues would never be reported because it would be super easy to debug them.
This is test code.
const { providers, Wallet, BigNumber, utils } = require(‘ethers’) const { Provider, TransactionRequest } = require(‘@ethersproject/providers’) const { Contract, ContractFactory, Overrides } = require(‘@ethersproject/contracts’) const { Bridge, networks } = require(‘arb-ts’)
const L1TokenABI = require(“…/artifacts/contracts/L1Token.sol/L1Token.json”) const L2TokenABI = require(“…/artifacts/contracts/L2Token.sol/L2Token.json”)
const main = async () => {
}
main() .then(() => process.exit(0)) .catch(error => { console.error(error) process.exit(1) })
And this is the result of console.
L1 balance: 3000000000000000000 L2 balance: 0 allowance: 3000000000000000000 deposit starts … Error: invalid address or ENS name (argument=“name”, value=undefined, code=INVALID_ARGUMENT, version=contracts/5.5.0) at Logger.makeError (E:\My Work\Emax, John Murrish\arbitrum-bridge\node_modules@ethersproject\logger\src.ts\index.ts:225:28) at Logger.throwError (E:\My Work\Emax, John Murrish\arbitrum-bridge\node_modules@ethersproject\logger\src.ts\index.ts:237:20) at Logger.throwArgumentError (E:\My Work\Emax, John Murrish\arbitrum-bridge\node_modules@ethersproject\logger\src.ts\index.ts:241:21) at E:\My Work\Emax, John Murrish\arbitrum-bridge\node_modules@ethersproject\contracts\src.ts\index.ts:120:16 at step (E:\My Work\Emax, John Murrish\arbitrum-bridge\node_modules@ethersproject\contracts\lib\index.js:48:23) at Object.next (E:\My Work\Emax, John Murrish\arbitrum-bridge\node_modules@ethersproject\contracts\lib\index.js:29:53) at fulfilled (E:\My Work\Emax, John Murrish\arbitrum-bridge\node_modules@ethersproject\contracts\lib\index.js:20:58) at processTicksAndRejections (node:internal/process/task_queues:96:5) { reason: ‘invalid address or ENS name’, code: ‘INVALID_ARGUMENT’, argument: ‘name’, value: undefined }