-
Notifications
You must be signed in to change notification settings - Fork 380
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
Avalanche root gauge factory v2 #2540
Conversation
pkg/liquidity-mining/contracts/gauges/avalanche/AvalancheRootGauge.sol
Outdated
Show resolved
Hide resolved
if (_lzBALProxy.useCustomAdapterParams()) { | ||
uint256 minDstGas = _lzBALProxy.minDstGasLookup(_AVALANCHE_LZ_CHAIN_ID, _SEND_PACKET_TYPE); | ||
return abi.encodePacked(_ADAPTER_PARAMS_VERSION, minDstGas); | ||
} else { | ||
return bytes(""); | ||
} |
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.
It wasn't trivial to get this right, but this should:
- not revert downstream after the bal proxy takes over the execution
- not require any additional config. Also, by performing the same operations that the proxy will perform when it's called, we should hit the same storage slots and perform warm reads which are cheaper.
The only way to actually test this properly is in the fork test. I've added some tests at the end that bridge BAL tokens many times using different amounts for both configurations in balancer/balancer-deployments#76.
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.
Looks exhausting - but good for this stage. Developing these is tough without complete docs; the many links and references will help. (And a good side effect of having that markdown check is we'll know if the docs change!)
pkg/liquidity-mining/contracts/gauges/avalanche/AvalancheRootGauge.sol
Outdated
Show resolved
Hide resolved
pkg/liquidity-mining/contracts/gauges/avalanche/AvalancheRootGauge.sol
Outdated
Show resolved
Hide resolved
pkg/liquidity-mining/contracts/gauges/avalanche/AvalancheRootGaugeLib.sol
Show resolved
Hide resolved
return amount - dust; | ||
} | ||
|
||
function bytes32Recipient(address recipient) internal pure returns (bytes32) { |
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.
Could also comment here why we need to cast it: some networks have different address sizes?
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.
Added a short description.
This is what the proxy accepts anyway, as it can be seen in the gauge code. It's just separated so that it can be tested easily (testing with the factory and the proxy outside a fork test is a nightmare).
Co-authored-by: EndymionJkb <[email protected]>
Description
Introduces new root gauge that can bridge tokens using the new LZ contract as described in #2531.
Type of change
Checklist:
master
, or there's a description of how to mergeIssue Resolution
Closes #2531.