by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Neil Duffy
    @skiv71
    Question, not directly ethers related, but relevant... when making a non state change call, you can do revert, require, assert etc. but given the error message will never likely bubble up and be easily obtainable, i.e. going through infura etc... is there infact any point doing it? or just producing an empty data set (in accordance with the fn return spec of course)
    I can see the errors in my local testing via ganache-cli, but never in the error rejected POST
    opinions on a postcard :smile:
    ccolorado
    @ccolorado
    Is there any example on how to sign EIP712 messages with ether Js? having troubles creating the messages hashes when combining types other than uint256
    Luis Schliesske
    @gitpusha
    Hi @ricmoo . I was wondering whether you ever played with Ganache's unlocked_accounts or -u option, to impersonate an account on a fork ?
    This is not well documented by Ganache
    But apparently you can unlock any account on a --fork by just providing the account address to ganache
    Luis Schliesske
    @gitpusha
    @ricmoo I experimented some more and connected an unlocked account Signer instance to a contract instance and tried to send a tx
      const executor = await new ethers.providers.JsonRpcProvider().getSigner(
        "0x4B7363b8a7DaB76ff73dFbA00801bdDcE699F3A2"
      );
    expect(
      await gelatoCore.connect(executor).unstakeExecutor()
    ).to.not.be.reverted;

    And indeed I get an error from ethers and ganche:
    https://gist.github.com/gitpusha/5824ee921baae2537215815f1f00e8a2

    Any ideas on how to correctly instantiate an unlocked ganache account on a ganache fork with ethers?

    In the error I get there is a " :"RuntimeError: VM Exception while processing transaction: invalid opcode\n "
    Luis Schliesske
    @gitpusha
    Update: I am able to unlockedWallet.sendTransaction ! So only the contract interactions fail with this invalid opcode error.
    Probably something to do with my ganche setup.
    You don't happen to know what could be going wrong here?
    The thing is, in the same script my contract interactions work fine. They only fail with invalid opcode when I connect the contract to the unlocked Signer account
    Luis Schliesske
    @gitpusha
    Update: I got it all to work except for the specific method unstakeExecutor where I get the invalid opcode error.
    Richard Moore
    @ricmoo
    I have never geard of that and never experimented with it. :p
    Ganache does lots of things a notmal client can’t. If aomeone wants to write a ganache specific Provider though, I’ll link to it from the docs. :)
    @ccolorado i havent added EIP-712 to ethers yet, but there is an implementation by metamask you can use in the meantime. You will need to use the signingKey signDigest directly for now, or the eth_signTypedData_v4 using the send method. It coming. :)
    @skiv71 if you make a call (or callStatic) to a method which uses the REVERT opcode (which is what require, etc. use) you should be able to get the revert reason in the error, which will be of type CALL_EXCEPTION. :)
    Luis Schliesske
    @gitpusha

    I have never geard of that and never experimented with it. :p

    kk ^^ yeah it's really sparsely documented. Even though it is such a powerful feature!! Forking mainnet into a local running ganache instance and then being able to impersonate any account! I just tried it and (when it does work) it is pure magic for testing!

    buidlerevm will soon have a --fork and --unlock feature too apparently! psyched!
    Luis Schliesske
    @gitpusha
    Hi @ricmoo . It's the first time I am dealing with Maker stuff like dsr . So it's using 10**27 (RAY) precision for the dsr. When I wanna do some calcs like addition on the dsr big number I get an overflow error thrown:
    image.png
    Does ethers BigNumber not deal well with 10**27 precision numbers?
    ccolorado
    @ccolorado
    @ricmoo thanks. Will keep an eye for it
    Luis Schliesske
    @gitpusha

    image.png

    @ricmoo so apparently this error was caused because I tried to deploy a contract with a 10**27 value as a constructor param

    I passed this value as a Number
    The overflow issue disappeared after I passed the constructor param as a BigNumber
    Is this intended behavior?
    ccolorado
    @ccolorado

    I am trying to set a websocket to a kaleido, but I keep getting either
    TypeError: ethers.providers.WebsocketProvider is not a constructor or
    TypeError: ethers.providers.WebsocketProvider is not a function

    However when I print ethers.providers I do see the WebSocketProvider: { [Function: WebSocketProvider] defaultUrl: [Function] }

    Is there a difference in how to connect using the WebSocketProvider ? (using "ethers": "^5.0.9")
    Roger Haenni
    @rhaenni
    does ethers.js have the equivalent of web3.utils.toChecksumAddress(address) ?
    i'm trying ethers.utils.getAddress() but it just throws an error if address is invalid (eg wrong checksum case), tyring to convert a lowercase address string into the valid checksumAddress
    Christoph
    @chrisdotn
    Hi, when I setup a listener for events with either <CONTRACT>.on((EVENT_NAME, (attribute)) or <CONTRACT>.on(EVENT_NAME, (attribute)), it seems to always fetch the last event from previous blocks. (How) Can I set it up to start with the current block?
    Caleb Ditchfield
    @ditchfieldcaleb
    Hi, I'm have a lot of difficulty using anything but the defaultProvider (which returns a quorum error when calling anything regardless)
    I'm trying to use my local geth IPC node, and have created an IPCProvider via:
    const ethersProvider = new ethers.providers.IpcProvider('/home/caleb/geth.ipc')
    However, whenever I call anything, I get a "invalid signer or provider" error
    (node:5105) UnhandledPromiseRejectionWarning: Error: invalid signer or provider (argument="signerOrProvider", value={"ready":{},"_lastBlockNumber":-2,"_balances":{},"_events":[],"_pollingInterval":4000,"_emitted":{"block":-2},"_fastQueryDate":1599407480614,"connection":{"url":"ipc:///home/caleb/geth.ipc"},"path":"/home/caleb/geth.ipc","_network":{"name":"homestead","chainId":1,"ensAddress":"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},"_fastBlockNumber":10808912,"_fastBlockNumberPromise":{}}, code=INVALID_ARGUMENT, version=contracts/5.0.3)
        at Logger.makeError (/home/caleb/defitimes/node_modules/@ethersproject/logger/lib/index.js:179:21)
        at Logger.throwError (/home/caleb/defitimes/node_modules/@ethersproject/logger/lib/index.js:188:20)
        at Logger.throwArgumentError (/home/caleb/defitimes/node_modules/@ethersproject/logger/lib/index.js:191:21)
        at new Contract (/home/caleb/defitimes/node_modules/@ethersproject/contracts/lib/index.js:569:20)
        at Function.fetchPairData (/home/caleb/defitimes/node_modules/@uniswap/sdk/dist/sdk.cjs.development.js:1558:30)
        at attemptToFrontRunTransaction (/home/caleb/defitimes/scanner.js:68:33)
        at processTicksAndRejections (internal/process/task_queues.js:93:5)
        at async main (/home/caleb/defitimes/scanner.js:306:24)
    Caleb Ditchfield
    @ditchfieldcaleb
    Nvm, it's got to be checksummed. Gah!
    Nvm that didn't fix the issue.
    Richard Moore
    @ricmoo

    Hi @ricmoo . It's the first time I am dealing with Maker stuff like dsr . So it's using 10**27 (RAY) precision for the dsr. When I wanna do some calcs like addition on the dsr big number I get an overflow error thrown:

    BigNumber should be able to handle arbitrary precision. But you cannot pass a number type in over Number.MAX_SAFE_INTEGER, which is 9007199254740991. You will have to pass in a string representation. If you let that number hit the JavaScript number in any way, shape or form, rounding will occur.

    @gitpusha (I should've tagged you in the above message)
    You cannot use number for this. Here is amore complete reason why: https://docs.ethers.io/v5/api/utils/bignumber/#BigNumber--notes-safenumbers :)
    @ccolorado Looks like you have a type? Your error message is TypeError: ethers.providers.WebsocketProvider is not a constructor but the class is called ethers.providers.WebSocketProvider. Notice the S on Socket is capitalized. :)
    Richard Moore
    @ricmoo
    @ditchfieldcaleb Can you provide more context? Like what your code is trying to do with that signer? Is it failing on the Contract constructor?
    Also, feel free to open an issue. I pay more attention to the GitHub issues. :)
    ccolorado
    @ccolorado
    @ricmoo thanks, checking that out
    Ali Azam
    @ali.azam_gitlab
    @ricmoo I am upgrading from ethersjs v4 to v5 and in v4 if a constructed a contract like new ethers.Contract(address, abi, wallet) and if the address is wrong, It used to return a Contract Not Deployed error, but with V5, It now seems to make a regular transaction and treat this as EOA, even when calling contract.someFunction, am I missing something here? thanks
    KennethNH
    @KennethNH
    @ditchfieldcaleb did you ever solve this?