Skip to content
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

⚡️ Zap #38

Merged
merged 89 commits into from
Jan 18, 2024
Merged

⚡️ Zap #38

merged 89 commits into from
Jan 18, 2024

Conversation

JaredBorders
Copy link
Contributor

@JaredBorders JaredBorders commented Jan 4, 2024

Add Zap library and implement hooks

Description

  1. Integrate "Zap" functionality so that the SMv3 Engine can exchange $USDC <-> $sUSD seamlessly
  2. Test new integration
  3. Migrate the test fork to Base and use Synthetix v3 Andromeda
  4. Update all ref to tokens in docs to follow "$TOKEN" standard
  5. Clean up deploy/upgrade scripts
  6. Update HH test

Related issue(s)

Closes #37

Motivation and Context

SNX v3 Andromeda supports $USDC collateral wrapping

@JaredBorders JaredBorders self-assigned this Jan 4, 2024
@JaredBorders JaredBorders added enhancement New feature or request smart-contracts labels Jan 4, 2024
@JaredBorders JaredBorders changed the title Zap ⚡️ Zap Jan 4, 2024
@JaredBorders
Copy link
Contributor Author

@JaredBorders JaredBorders marked this pull request as ready for review January 12, 2024 23:29
@@ -168,7 +180,7 @@ contract Engine is
uint128 _accountId,
uint256 _wordPos,
uint256 _mask
) external override {
) external payable override {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: I presume we have made this and other functions payable so they can be used in MulticallablePayable alongside a call to fulfillOracleQuery? The only issue I could see related to this is a future dev thinking - oh there are loads of payable functions, I can add one. But that is not a real security issue now. Can you think of any other issues that could arise from having these functions payable?

Copy link
Contributor Author

@JaredBorders JaredBorders Jan 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about this quite a bit, and since msg.value is never used within any of these functions, there is no protocol risk I am aware of by making them payable. (users can send funds to the contract accidentally but tbf that could also be done before via self-destruct).

As a side note, I have read/heard that the payable function modifier might be removed in future solidity versions, and every function will be payable. So that makes me feel better about it.

src/Engine.sol Outdated Show resolved Hide resolved
@tommyrharper
Copy link
Contributor

Nice work! All looks good to me. Just a couple of comments, nothing significant. Probably my main question is around the payable functions.

@JaredBorders JaredBorders merged commit b479bc5 into main Jan 18, 2024
4 checks passed
@JaredBorders JaredBorders deleted the zap branch January 18, 2024 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request smart-contracts
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

⚡️ Zap Integration
2 participants