-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
90 additions
and
49 deletions.
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
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
import "../router/relay/GelatoRelayRouter.sol"; | ||
import "./MultichainHandler.sol"; | ||
|
||
contract MultichainRouter is GelatoRelayRouter { | ||
MultichainHandler multichainHandler; | ||
|
||
constructor( | ||
Router _router, | ||
DataStore _dataStore, | ||
EventEmitter _eventEmitter, | ||
Oracle _oracle, | ||
IOrderHandler _orderHandler, | ||
OrderVault _orderVault, | ||
MultichainHandler _multichainHandler | ||
) GelatoRelayRouter(_router, _dataStore, _eventEmitter, _oracle, _orderHandler, _orderVault) { | ||
multichainHandler = _multichainHandler; | ||
} | ||
|
||
function _sendTokens(address account, address token, address receiver, uint256 amount) internal override { // TODO: override BaseGelatoRelayRouter._sendTokens? | ||
uint256 sourceChainId; // TODO | ||
AccountUtils.validateReceiver(receiver); | ||
multichainHandler.pluginTransfer(account, token, receiver, amount, sourceChainId); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,8 +0,0 @@ | ||
import { hashData, getAddressFromHash } from "./hash"; | ||
|
||
export const GMX_MULTICHAIN = "GMX Multichain"; | ||
|
||
export function getVirtualAccount(account: string, sourceChainId: number): string { | ||
const hash = hashData(["string", "address", "uint256"], [GMX_MULTICHAIN, account, sourceChainId]); | ||
return getAddressFromHash(hash); | ||
} | ||