hop-protocol / hop

🐰 Hop Protocol Monorepo
https://hop.exchange/
MIT License
2.85k stars 190 forks source link

Consider upgrading `ethersv5` #555

Open shanefontaine opened 9 months ago

shanefontaine commented 9 months ago

Consider pros and cons between:

If outcome is ethersv6 or viem, upgrade repo to use native BitInt.

Reference Converstaion

Some unorganized notes about an attempted ethersv5 -> ethersv6 migration:

- When converting BN to BigInt, consider searching for these in the repo: - `.type` (for checking bn) - `.hex` (for checking bn) - `_isBigNumber` oldbn - `bignum` - `BN` - Math methods - `BigInt\((.*?)\)\.` for all typecasted `bigitnts` that are then added - `.floor` - `.add` - Watch out for `.add()` - `.sub` - `.mul` - `.div` - `.gt(e)` - `.lt(e)` - `.pow` - `.eq` - etc. - SDK methods need to be wrapped… - `: BigNumber` - `ish` ? - Can we do *everything* with bigint? how should we think about it? - Would require `BigInt(Math.xxx())` and other primitives - Maybe that is where `ish` comes in? - Migrate the DB values from bn to bigint - Remove - All `'ethers/lib/utils'` are top level - `providers.Provider` - All `@ethersproject` should be gone - Remove these from package.json - All `utils as ethersUtils` should be gone - Explicit changes - `StaticJsonRpcProvider` → `JsonRpcProvider` (V6 does this by default: [src](https://github.com/ethers-io/ethers.js/blob/3a1d175c208fa3ee6aa4c42c7b3bdbbefaf3e65e/docs.wrm/migrating.wrm#L228-L229)) - `extends Signer` → `extends AbstractSigner` (`Signer` is now an interface and `AbstractSigner` replaced the class)
jxom commented 9 months ago

Happy to assist if the decision is Viem. :)