-
Notifications
You must be signed in to change notification settings - Fork 104
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
Contracts V2 #1300
Open
vgeddes
wants to merge
23
commits into
v2
Choose a base branch
from
vincent/v2
base: v2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Contracts V2 #1300
Changes from 20 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
e0b2371
v2 initial commit
vgeddes a7ad609
latest changes
vgeddes 1be9e5c
Flesh out dispatch logic for inbound messages
vgeddes e7fecaf
Add reward address
vgeddes 08715b0
make code compile
vgeddes 111f738
Split initializer impl into a library to reduce contract size
vgeddes b0867e8
Major refactor
vgeddes ee37e3c
Update tests
vgeddes 6829f38
add scripts back
vgeddes 8c878ce
Update scripts
vgeddes 0b25864
Merge branch 'v2' into vincent/v2
vgeddes c35743d
Finish outbound messaging
vgeddes 149c3e4
Implement token registration for V2
vgeddes 02ac263
Make functions payable
vgeddes c7332c3
improve docs
vgeddes c0bab8a
comments
vgeddes eae219e
review feedback
vgeddes 318b7dc
cleanups
vgeddes e73125d
Add initial tests for V2
vgeddes fa9b8a7
Make `rewardAddress` an indexed event parameter
vgeddes 00016a7
Clean up interfaces
vgeddes 5817542
Make WETH address configurable
vgeddes 4c3b2af
Autowrap ether
vgeddes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ coverage/ | |
out/ | ||
cache/ | ||
broadcast/ | ||
types/ | ||
/types/ | ||
tsconfig.tsbuildinfo | ||
lcov.info | ||
tenderly.yaml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,12 @@ | |
// SPDX-FileCopyrightText: 2023 Snowfork <[email protected]> | ||
pragma solidity 0.8.25; | ||
|
||
import {AgentExecuteCommand, ParaID} from "./Types.sol"; | ||
import {ParaID} from "./Types.sol"; | ||
import {SubstrateTypes} from "./SubstrateTypes.sol"; | ||
|
||
import {IERC20} from "./interfaces/IERC20.sol"; | ||
import {SafeTokenTransfer, SafeNativeTransfer} from "./utils/SafeTransfer.sol"; | ||
import {Call} from "./utils/Call.sol"; | ||
import {Gateway} from "./Gateway.sol"; | ||
|
||
/// @title Code which will run within an `Agent` using `delegatecall`. | ||
|
@@ -27,6 +28,15 @@ contract AgentExecutor { | |
_transferToken(token, recipient, amount); | ||
} | ||
|
||
function callContract(address target, bytes memory data) external { | ||
bool success = Call.safeCall(target, data); | ||
if (!success) { | ||
revert(); | ||
} | ||
} | ||
|
||
function deposit() external payable {} | ||
|
||
/// @dev Transfer ERC20 to `recipient`. Only callable via `execute`. | ||
function _transferToken(address token, address recipient, uint128 amount) internal { | ||
IERC20(token).safeTransfer(recipient, amount); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-FileCopyrightText: 2023 Snowfork <[email protected]> | ||
pragma solidity 0.8.25; | ||
|
||
import {ParaID, ChannelID} from "./v1/Types.sol"; | ||
|
||
library Constants { | ||
ParaID constant ASSET_HUB_PARA_ID = ParaID.wrap(1000); | ||
bytes32 constant ASSET_HUB_AGENT_ID = | ||
0x81c5ab2571199e3188135178f3c2c8e2d268be1313d029b30f534fa579b69b79; | ||
alistair-singh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
ParaID constant BRIDGE_HUB_PARA_ID = ParaID.wrap(1002); | ||
Comment on lines
+8
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! Seems like these para IDs are the same on all the environments now anyway. |
||
bytes32 constant BRIDGE_HUB_AGENT_ID = | ||
0x03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c111314; | ||
|
||
// ChannelIDs | ||
ChannelID internal constant PRIMARY_GOVERNANCE_CHANNEL_ID = | ||
ChannelID.wrap(bytes32(uint256(1))); | ||
ChannelID internal constant SECONDARY_GOVERNANCE_CHANNEL_ID = | ||
ChannelID.wrap(bytes32(uint256(2))); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Probably don't need this anymore, since we have already dropped the operator on mainnet?