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

Update Bridge Config to accept non-evm-addresses, update Bridge for non-evm compatibility #81

Merged
merged 68 commits into from
Feb 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
24153ad
Redeem w/ bytes32 address
aureliusbtc Jan 29, 2022
7de5a9e
replace address tokenAddress w/ bytes32 tokenAddress
aureliusbtc Jan 30, 2022
44eff8b
redeem v2
trajan0x Jan 30, 2022
e8c6ebb
v#
trajan0x Jan 30, 2022
24e1ffd
bridge config v3
trajan0x Jan 30, 2022
d54a0fc
redeem v2 in harmony
trajan0x Jan 30, 2022
19320c6
v2 deploy
trajan0x Jan 30, 2022
ff74fa5
switcher
trajan0x Jan 30, 2022
73a981e
Revert "switcher"
trajan0x Jan 30, 2022
2b0ac2a
remove token ids
trajan0x Jan 30, 2022
e7df46a
toString
trajan0x Jan 30, 2022
3a0eed0
pool config
trajan0x Jan 31, 2022
bdbabaa
Update BridgeConfigV3.sol
trajan0x Jan 31, 2022
708a82f
skip wrapping
trajan0x Feb 1, 2022
ad1b139
version
trajan0x Feb 1, 2022
860a685
add concat
trajan0x Feb 1, 2022
568219d
config v3
trajan0x Feb 3, 2022
31dd125
bridge config v3
trajan0x Feb 4, 2022
5dfdae5
use token address
trajan0x Feb 10, 2022
eb34674
v3
trajan0x Feb 10, 2022
cd63f36
add new contracts
trajan0x Feb 10, 2022
bbeb3ca
bridge
trajan0x Feb 10, 2022
9ded58b
try to unnest
aureliusbtc Feb 10, 2022
c5fb61f
fully unnest
aureliusbtc Feb 10, 2022
b802152
recommit
trajan0x Feb 10, 2022
be77f70
contract
trajan0x Feb 10, 2022
158d84a
Deploy V2 Bridge Implementations
aureliusbtc Feb 17, 2022
2f5f0cb
deploy optimism
aureliusbtc Feb 17, 2022
5fd47e1
UST on all chains
aureliusbtc Feb 18, 2022
d605c79
merge master
trajan0x Feb 20, 2022
0abea01
lowercase calculate swap fee
trajan0x Feb 20, 2022
bc7ec69
add metis to hardhat config
aureliusbtc Feb 20, 2022
f494f7c
set up deployments/metis
aureliusbtc Feb 20, 2022
a9fa061
DevMultisig
aureliusbtc Feb 20, 2022
801e321
Basic Metis Deployments (Bridge + AMM)
aureliusbtc Feb 20, 2022
7fc8553
add metis chain_id
aureliusbtc Feb 20, 2022
8700956
Cronos deployment basic setup
aureliusbtc Feb 20, 2022
2c17d09
update RPC URL, cronos docs are wrong
aureliusbtc Feb 20, 2022
ab16b18
Set up multisig on Cronos
aureliusbtc Feb 20, 2022
d0e57c9
Basic Bridge + AMM Deployments
aureliusbtc Feb 20, 2022
03e154d
Merge branch 'non-evm-addresses' into feature/metis
aureliusbtc Feb 20, 2022
594eb58
Merge branch 'feature/metis' into feature/cronos
aureliusbtc Feb 20, 2022
78aa5d8
Merge pull request #85 from synapsecns/feature/cronos
aureliusbtc Feb 20, 2022
cdad645
fix typo
aureliusbtc Feb 20, 2022
5b84ec7
add gOHM on Cronos, Metis, Optimism
aureliusbtc Feb 20, 2022
5f416a3
Merge pull request #82 from synapsecns/feature/metis
aureliusbtc Feb 21, 2022
61dd033
false operand
trajan0x Feb 22, 2022
b75e5ce
toLowers() and remvoeTokenID()
aureliusbtc Feb 23, 2022
28f4cd4
zap deploys and latest bridgeconfigv3
aureliusbtc Feb 26, 2022
2feaf82
fix chain ids
trajan0x Feb 26, 2022
b0597ad
remove optional ETHPool dependency from L2BridgeZap
trajan0x Feb 26, 2022
eac9fc5
change filtering mechanism
trajan0x Feb 26, 2022
581ce7f
add bridgeconfigv3 test
trajan0x Feb 26, 2022
f89de60
lint
trajan0x Feb 26, 2022
bc27f2d
add cover to get token id/reverts
trajan0x Feb 26, 2022
ddcfc7b
fix revert check
trajan0x Feb 27, 2022
b38288b
fix test
trajan0x Feb 27, 2022
5e404c6
token id exists
trajan0x Feb 27, 2022
2714d9b
token id exists
trajan0x Feb 27, 2022
033a91b
add deterministic tests
trajan0x Feb 27, 2022
ec5dd2c
lint
trajan0x Feb 27, 2022
e29cf55
calculate swap fee
trajan0x Feb 27, 2022
6e51912
Delete most Metis deployments to reset multisig
aureliusbtc Feb 27, 2022
d5de273
Merge branch 'non-evm-addresses' of https://github.com/synapsecns/syn…
aureliusbtc Feb 27, 2022
9b36842
modified packagelog
aureliusbtc Feb 27, 2022
d6d23f7
update most metis addresses
aureliusbtc Feb 27, 2022
f4905f3
Remove deprecated bridgeconfigs
aureliusbtc Feb 27, 2022
8799424
Remove deprecated deploy files
aureliusbtc Feb 27, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
524 changes: 524 additions & 0 deletions contracts/bridge/BridgeConfigV3.sol

Large diffs are not rendered by default.

46 changes: 36 additions & 10 deletions contracts/bridge/HarmonySynapseBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ contract HarmonySynapseBridge is
bytes32 indexed kappa
);

// v2 events
event TokenRedeemV2(
bytes32 indexed to,
uint256 chainId,
IERC20 token,
uint256 amount
);

// VIEW FUNCTIONS ***/
function getFeeBalance(address tokenAddress)
external
Expand All @@ -170,7 +178,7 @@ contract HarmonySynapseBridge is
* * @param token ERC20 token in which fees acccumulated to transfer
* * @param to Address to send the fees to
*/
function withdrawFees(IERC20 token, address to) external whenNotPaused() {
function withdrawFees(IERC20 token, address to) external whenNotPaused {
require(hasRole(GOVERNANCE_ROLE, msg.sender), "Not governance");
require(to != address(0), "Address is 0x000");
if (fees[address(token)] != 0) {
Expand Down Expand Up @@ -202,7 +210,7 @@ contract HarmonySynapseBridge is
uint256 chainId,
IERC20 token,
uint256 amount
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
emit TokenDeposit(to, chainId, token, amount);
token.safeTransferFrom(msg.sender, address(this), amount);
}
Expand All @@ -219,7 +227,7 @@ contract HarmonySynapseBridge is
uint256 chainId,
ERC20Burnable token,
uint256 amount
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
emit TokenRedeem(to, chainId, token, amount);
token.burnFrom(msg.sender, amount);
}
Expand All @@ -238,7 +246,7 @@ contract HarmonySynapseBridge is
uint256 amount,
uint256 fee,
bytes32 kappa
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
require(
hasRole(NODEGROUP_ROLE, msg.sender),
"Caller is not a node group"
Expand Down Expand Up @@ -273,7 +281,7 @@ contract HarmonySynapseBridge is
uint256 amount,
uint256 fee,
bytes32 kappa
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
require(
hasRole(NODEGROUP_ROLE, msg.sender),
"Caller is not a node group"
Expand Down Expand Up @@ -340,7 +348,7 @@ contract HarmonySynapseBridge is
uint8 tokenIndexTo,
uint256 minDy,
uint256 deadline
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
emit TokenDepositAndSwap(
to,
chainId,
Expand Down Expand Up @@ -374,7 +382,7 @@ contract HarmonySynapseBridge is
uint8 tokenIndexTo,
uint256 minDy,
uint256 deadline
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
emit TokenRedeemAndSwap(
to,
chainId,
Expand Down Expand Up @@ -406,7 +414,7 @@ contract HarmonySynapseBridge is
uint8 swapTokenIndex,
uint256 swapMinAmount,
uint256 swapDeadline
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
emit TokenRedeemAndRemove(
to,
chainId,
Expand Down Expand Up @@ -444,7 +452,7 @@ contract HarmonySynapseBridge is
uint256 minDy,
uint256 deadline,
bytes32 kappa
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
require(
hasRole(NODEGROUP_ROLE, msg.sender),
"Caller is not a node group"
Expand Down Expand Up @@ -568,7 +576,7 @@ contract HarmonySynapseBridge is
uint256 swapMinAmount,
uint256 swapDeadline,
bytes32 kappa
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
require(
hasRole(NODEGROUP_ROLE, msg.sender),
"Caller is not a node group"
Expand Down Expand Up @@ -636,4 +644,22 @@ contract HarmonySynapseBridge is
);
}
}

// BRIDGE FUNCTIONS TO HANDLE DIFF ADDRESSES
/**
* @notice Relays to nodes that (typically) a wrapped synAsset ERC20 token has been burned and the underlying needs to be redeeemed on the native chain
* @param to address on other chain to redeem underlying assets to
* @param chainId which underlying chain to bridge assets onto
* @param token ERC20 compatible token to deposit into the bridge
* @param amount Amount in native token decimals to transfer cross-chain pre-fees
**/
function redeemV2(
bytes32 to,
uint256 chainId,
ERC20Burnable token,
uint256 amount
) external nonReentrant whenNotPaused {
emit TokenRedeemV2(to, chainId, token, amount);
token.burnFrom(msg.sender, amount);
}
}
46 changes: 36 additions & 10 deletions contracts/bridge/MoonriverSynapseBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ contract MRSynapseBridge is
bytes32 indexed kappa
);

// v2 events
event TokenRedeemV2(
bytes32 indexed to,
uint256 chainId,
IERC20 token,
uint256 amount
);

// VIEW FUNCTIONS ***/
function getFeeBalance(address tokenAddress)
external
Expand All @@ -170,7 +178,7 @@ contract MRSynapseBridge is
* * @param token ERC20 token in which fees acccumulated to transfer
* * @param to Address to send the fees to
*/
function withdrawFees(IERC20 token, address to) external whenNotPaused() {
function withdrawFees(IERC20 token, address to) external whenNotPaused {
require(hasRole(GOVERNANCE_ROLE, msg.sender), "Not governance");
require(to != address(0), "Address is 0x000");
if (fees[address(token)] != 0) {
Expand Down Expand Up @@ -202,7 +210,7 @@ contract MRSynapseBridge is
uint256 chainId,
IERC20 token,
uint256 amount
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
emit TokenDeposit(to, chainId, token, amount);
token.safeTransferFrom(msg.sender, address(this), amount);
}
Expand All @@ -219,7 +227,7 @@ contract MRSynapseBridge is
uint256 chainId,
ERC20Burnable token,
uint256 amount
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
emit TokenRedeem(to, chainId, token, amount);
token.burnFrom(msg.sender, amount);
}
Expand All @@ -238,7 +246,7 @@ contract MRSynapseBridge is
uint256 amount,
uint256 fee,
bytes32 kappa
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
require(
hasRole(NODEGROUP_ROLE, msg.sender),
"Caller is not a node group"
Expand Down Expand Up @@ -273,7 +281,7 @@ contract MRSynapseBridge is
uint256 amount,
uint256 fee,
bytes32 kappa
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
require(
hasRole(NODEGROUP_ROLE, msg.sender),
"Caller is not a node group"
Expand Down Expand Up @@ -329,7 +337,7 @@ contract MRSynapseBridge is
uint8 tokenIndexTo,
uint256 minDy,
uint256 deadline
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
emit TokenDepositAndSwap(
to,
chainId,
Expand Down Expand Up @@ -363,7 +371,7 @@ contract MRSynapseBridge is
uint8 tokenIndexTo,
uint256 minDy,
uint256 deadline
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
emit TokenRedeemAndSwap(
to,
chainId,
Expand Down Expand Up @@ -395,7 +403,7 @@ contract MRSynapseBridge is
uint8 swapTokenIndex,
uint256 swapMinAmount,
uint256 swapDeadline
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
emit TokenRedeemAndRemove(
to,
chainId,
Expand Down Expand Up @@ -433,7 +441,7 @@ contract MRSynapseBridge is
uint256 minDy,
uint256 deadline,
bytes32 kappa
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
require(
hasRole(NODEGROUP_ROLE, msg.sender),
"Caller is not a node group"
Expand Down Expand Up @@ -557,7 +565,7 @@ contract MRSynapseBridge is
uint256 swapMinAmount,
uint256 swapDeadline,
bytes32 kappa
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
require(
hasRole(NODEGROUP_ROLE, msg.sender),
"Caller is not a node group"
Expand Down Expand Up @@ -625,4 +633,22 @@ contract MRSynapseBridge is
);
}
}

// BRIDGE FUNCTIONS TO HANDLE DIFF ADDRESSES
/**
* @notice Relays to nodes that (typically) a wrapped synAsset ERC20 token has been burned and the underlying needs to be redeeemed on the native chain
* @param to address on other chain to redeem underlying assets to
* @param chainId which underlying chain to bridge assets onto
* @param token ERC20 compatible token to deposit into the bridge
* @param amount Amount in native token decimals to transfer cross-chain pre-fees
**/
function redeemV2(
bytes32 to,
uint256 chainId,
ERC20Burnable token,
uint256 amount
) external nonReentrant whenNotPaused {
emit TokenRedeemV2(to, chainId, token, amount);
token.burnFrom(msg.sender, amount);
}
}
46 changes: 36 additions & 10 deletions contracts/bridge/SynapseBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ contract SynapseBridge is
bytes32 indexed kappa
);

// v2 events
event TokenRedeemV2(
bytes32 indexed to,
uint256 chainId,
IERC20 token,
uint256 amount
);

// VIEW FUNCTIONS ***/
function getFeeBalance(address tokenAddress)
external
Expand All @@ -163,7 +171,7 @@ contract SynapseBridge is
* * @param token ERC20 token in which fees acccumulated to transfer
* * @param to Address to send the fees to
*/
function withdrawFees(IERC20 token, address to) external whenNotPaused() {
function withdrawFees(IERC20 token, address to) external whenNotPaused {
require(hasRole(GOVERNANCE_ROLE, msg.sender), "Not governance");
require(to != address(0), "Address is 0x000");
if (fees[address(token)] != 0) {
Expand Down Expand Up @@ -195,7 +203,7 @@ contract SynapseBridge is
uint256 chainId,
IERC20 token,
uint256 amount
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
emit TokenDeposit(to, chainId, token, amount);
token.safeTransferFrom(msg.sender, address(this), amount);
}
Expand All @@ -212,7 +220,7 @@ contract SynapseBridge is
uint256 chainId,
ERC20Burnable token,
uint256 amount
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
emit TokenRedeem(to, chainId, token, amount);
token.burnFrom(msg.sender, amount);
}
Expand All @@ -231,7 +239,7 @@ contract SynapseBridge is
uint256 amount,
uint256 fee,
bytes32 kappa
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
require(
hasRole(NODEGROUP_ROLE, msg.sender),
"Caller is not a node group"
Expand Down Expand Up @@ -266,7 +274,7 @@ contract SynapseBridge is
uint256 amount,
uint256 fee,
bytes32 kappa
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
require(
hasRole(NODEGROUP_ROLE, msg.sender),
"Caller is not a node group"
Expand Down Expand Up @@ -303,7 +311,7 @@ contract SynapseBridge is
uint8 tokenIndexTo,
uint256 minDy,
uint256 deadline
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
emit TokenDepositAndSwap(
to,
chainId,
Expand Down Expand Up @@ -337,7 +345,7 @@ contract SynapseBridge is
uint8 tokenIndexTo,
uint256 minDy,
uint256 deadline
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
emit TokenRedeemAndSwap(
to,
chainId,
Expand Down Expand Up @@ -369,7 +377,7 @@ contract SynapseBridge is
uint8 swapTokenIndex,
uint256 swapMinAmount,
uint256 swapDeadline
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
emit TokenRedeemAndRemove(
to,
chainId,
Expand Down Expand Up @@ -407,7 +415,7 @@ contract SynapseBridge is
uint256 minDy,
uint256 deadline,
bytes32 kappa
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
require(
hasRole(NODEGROUP_ROLE, msg.sender),
"Caller is not a node group"
Expand Down Expand Up @@ -531,7 +539,7 @@ contract SynapseBridge is
uint256 swapMinAmount,
uint256 swapDeadline,
bytes32 kappa
) external nonReentrant() whenNotPaused() {
) external nonReentrant whenNotPaused {
require(
hasRole(NODEGROUP_ROLE, msg.sender),
"Caller is not a node group"
Expand Down Expand Up @@ -599,4 +607,22 @@ contract SynapseBridge is
);
}
}

// BRIDGE FUNCTIONS TO HANDLE DIFF ADDRESSES
/**
* @notice Relays to nodes that (typically) a wrapped synAsset ERC20 token has been burned and the underlying needs to be redeeemed on the native chain
* @param to address on other chain to redeem underlying assets to
* @param chainId which underlying chain to bridge assets onto
* @param token ERC20 compatible token to deposit into the bridge
* @param amount Amount in native token decimals to transfer cross-chain pre-fees
**/
function redeemV2(
bytes32 to,
uint256 chainId,
ERC20Burnable token,
uint256 amount
) external nonReentrant whenNotPaused {
emit TokenRedeemV2(to, chainId, token, amount);
token.burnFrom(msg.sender, amount);
}
}
9 changes: 9 additions & 0 deletions contracts/bridge/interfaces/ISynapseBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ interface ISynapseBridge {
uint256 amount
) external;


function redeemv2(
bytes32 to,
uint256 chainId,
IERC20 token,
uint256 amount
) external;


function redeemAndSwap(
address to,
uint256 chainId,
Expand Down
Loading