-
Notifications
You must be signed in to change notification settings - Fork 191
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
chore: post contracts package cleanup #7687
Conversation
ef49250
to
7ca6b24
Compare
@@ -1,4 +1,4 @@ | |||
export const IUniswapV2Pair = [ | |||
export const UNISWAP_V2_PAIR_ABI = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep the original naming here so that we don't lose the I
prefix? Or at least add it back as Interface
somewhere in the name of this ABI 🙏🏽
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c30ad7c ✅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain your reasoning here @gomesalexandre? the abi is for the contract which may or may not implement interfaces, but doesn't seem relevant for abi naming and feels like it should match the contract name realistically anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty much that i.e the fact that this is taken from IUniswapV2Pair.sol
! https://github.com/Uniswap/v2-core/blob/master/contracts/interfaces/IUniswapV2Pair.sol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I am saying the abi is for https://github.com/Uniswap/v2-core/blob/master/contracts/UniswapV2Pair.sol which is the actual contract. UNISWAP_V2_PAIR_ABI
is actually more accurate imo. Not a huge deal, but saw it added to the bep20 abi as well and just don't think we should have it in general.
packages/swapper/src/swappers/ThorchainSwapper/evm/utils/getThorTxData.ts
Show resolved
Hide resolved
packages/swapper/src/swappers/ThorchainSwapper/evm/utils/getThorTxData.ts
Outdated
Show resolved
Hide resolved
packages/swapper/src/swappers/ThorchainSwapper/evm/utils/getThorTxData.ts
Outdated
Show resolved
Hide resolved
@@ -15,7 +15,7 @@ import { ethers } from 'ethers' | |||
import { toLower } from 'lodash' | |||
import { getAddress } from 'viem' | |||
import { bn, bnOrZero } from 'lib/bignumber/bignumber' | |||
import { MAX_ALLOWANCE } from 'lib/investor/constants' | |||
import { MAX_ALLOWANCE } from 'lib/investor/constants/allowance' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { MAX_ALLOWANCE } from 'lib/investor/constants/allowance' | |
import { maxUint256 } from 'viem' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:crazyeyes2:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still applicable to use viem here and then delete lib/investor/constants
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Baller PR ser - a few comments for additional cleanup/revamped naming, but conceptually super happy with this guy! Will runtime paranoia test once review comments are tackled 🙏🏽
7561a7f
to
43acead
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sanity runtime test looks sane to me minus one possible regression, tested the below.
Note, no Jam since my 10mn jam got rugged with "Processing"
- Token Arb bridge (both directions) 🚫
- ETH Arb bridge (both directions)
- Native EVM token sends
- Token sends
- ERC20 approval (CoW)
- ERC20 swap (CoW)
- USDT approval reset
- Native asset swap (Li.fi)
- ERC20 THOR Swap
- Native asset THOR swap
- ETH Arb bridge (both directions)
- Savers native asset deposit/withdraw
- Savers token deposit/withdraw
- RFOX e2e
As part of the sanity test here, noticed one smolish issue WRT sends styling for long token symbols we will want to tackle in a separate PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Retested focusing on Arbitrum Bridge, confirmed the previous behaviour re: unable to get Arb Bridge quotes for tokens was an intermittent issue.
Unrelated to this diff, found out that we poll for SAFE Txs when we know the current address isn't a sc address, but this will be fixed in #7525
- ETH Arb Bridge (both directions) ✅
https://jam.dev/c/8354955a-51f2-4797-82ac-d0b4b28dbd47
- Token Arb Bridge (both directions) ✅
https://jam.dev/c/dfba760d-1d1d-4d7c-8105-130fe640442d
- Claims List
- Claim
const router = getAddress(inboundAddress.router as string) | ||
const vault = getAddress(inboundAddress.address as string) | ||
|
||
if (!router) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non blocking suggestion - this changes error behavior slightly. We can move below our if (!router)
check (probably change to if (!inboundAddress.router)
, then have our custom error message and no more need to cast
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer not to - this was added by gomes's review feedback and strictly isnt necessary but I'd prefer not to add more change because its really not related to the PR
packages/swapper/src/swappers/ThorchainSwapper/evm/utils/getThorTxData.ts
Show resolved
Hide resolved
packages/contracts/src/constants.ts
Outdated
export const UNISWAP_V2_ROUTER_02_CONTRACT_ADDRESS = | ||
'0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D' as const | ||
// Uniswap V2 | ||
export const UNISWAP_V2_ROUTER_02_MAINNET = '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D' as const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contract naming consistency suggestion - at least include CONTRACT
or CONTRACT_ADDRESS
(contract is fine imo, but see both in here), on all contract address constants.
also a question, is MAINNET
intended to suggest the address is the same across all evm networks? or is this talking about ethereum mainnet? non obvious and a bit confusing imo if we want to clean up that naming convention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also a question, is MAINNET intended to suggest the address is the same across all evm networks? or is this talking about ethereum mainnet? non obvious and a bit confusing imo if we want to clean up that naming convention.
Unsure as this is unrelated to this PR and is from existing implementation. I'm tempted to leave it as-is unless necessary to change in case it makes things confusing in wherever these are used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the address naming to be consistent throughout though :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also a question, is MAINNET intended to suggest the address is the same across all evm networks? or is this talking about ethereum mainnet? non obvious and a bit confusing imo if we want to clean up that naming convention.
Unsure as this is unrelated to this PR and is from existing implementation. I'm tempted to leave it as-is unless necessary to change in case it makes things confusing in wherever these are used
For posterity, while the name is unchanged from the existing implementation, the difference was the constants were defined inline within unchained-client/src/evm/ethereum
in at least some cases in which MAINNET
made sense in this context as being directly related to eth mainnet (also considering there was ropsten constants). In the global contracts package, this context is lost and mainnet become vague considering all of our chains are mainnet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Diff looks good expect for the loss of typing for the ABIs.
packages/swapper/src/swappers/ThorchainSwapper/evm/utils/getThorTxData.ts
Outdated
Show resolved
Hide resolved
packages/swapper/src/swappers/ThorchainSwapper/evm/utils/getThorTxData.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solid PR man. Code looking solid, leaning on the runtime tests from gomes and soon to be from ops to get this in.
Description
Consolidates contract addresses and ABIs into the contacts package.
Issue (if applicable)
closes #7681
Risk
High risk as this affects orchestration of user funds.
Affects all EVM + THORChain protocols across all features aside from sending and receiving.
Testing
Engineering
Operations
Screenshots (if applicable)
THORChain hardfork in progress at the time of opening, will need testing once hardfork is completed and chain is back online.
Lost all screenshots of testing, but tx history shows success for the following: