-
Notifications
You must be signed in to change notification settings - Fork 13
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
1 parent
91fbd82
commit 00ddc1e
Showing
15 changed files
with
3,177 additions
and
10 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,102 @@ | ||
{ | ||
"_format": "hh-sol-artifact-1", | ||
"contractName": "IHopBridge", | ||
"sourceName": "src/bridges/interfaces/IHopBridge.sol", | ||
"abi": [ | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "uint256", | ||
"name": "chainId", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "address", | ||
"name": "recipient", | ||
"type": "address" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "amount", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "amountOutMin", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "deadline", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "address", | ||
"name": "relayer", | ||
"type": "address" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "relayerFee", | ||
"type": "uint256" | ||
} | ||
], | ||
"name": "sendToL2", | ||
"outputs": [], | ||
"stateMutability": "payable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "uint256", | ||
"name": "chainId", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "address", | ||
"name": "recipient", | ||
"type": "address" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "amount", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "bonderFee", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "amountOutMin", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "deadline", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "destinationAmountOutMin", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "destinationDeadline", | ||
"type": "uint256" | ||
} | ||
], | ||
"name": "swapAndSend", | ||
"outputs": [], | ||
"stateMutability": "payable", | ||
"type": "function" | ||
} | ||
], | ||
"bytecode": "0x", | ||
"deployedBytecode": "0x", | ||
"linkReferences": {}, | ||
"deployedLinkReferences": {} | ||
} |
This file was deleted.
Oops, something went wrong.
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,26 @@ | ||
import { NetworkNames } from "../extensions/constants"; | ||
|
||
const L1 = [ | ||
NetworkNames.Rinkeby, | ||
NetworkNames.Goerli, | ||
NetworkNames.Kovan, | ||
] | ||
|
||
const L2 = [ | ||
NetworkNames.Xdai, | ||
NetworkNames.Optimism, | ||
NetworkNames.Arbitrum, | ||
NetworkNames.Matic, | ||
NetworkNames.Mumbai, | ||
] | ||
|
||
export const HopConfig = Object.values(NetworkNames).reduce((obj, name) => { | ||
if (L1.some(n => n === name)) { | ||
obj[name] = 1; | ||
} else if (L2.some(n => n === name)) { | ||
obj[name] = 2; | ||
} | ||
return obj; | ||
}, {}); | ||
|
||
HopConfig['hardhat'] = 1; // for testing purposes |
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,47 @@ | ||
import { DeployFunction } from 'hardhat-deploy/types'; | ||
import { HardhatRuntimeEnvironment } from 'hardhat/types'; | ||
import { addOrReplaceFacets } from '../utils/diamond'; | ||
import { HopConfig } from '../config/hop'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const { | ||
deployments: { deploy }, | ||
getNamedAccounts, | ||
ethers, | ||
network | ||
} = hre; | ||
const { from } = await getNamedAccounts(); | ||
|
||
if (!HopConfig[network.name]) { | ||
throw new Error("No config for this network available: " + network.name); | ||
} | ||
|
||
await deploy('HopFacet', { | ||
from, | ||
log: true, | ||
}); | ||
|
||
const diamond = await ethers.getContract('Diamond'); | ||
const hopFacet = await ethers.getContract("HopFacet"); | ||
|
||
const ABI = ['function initHop(uint256)']; | ||
const iface = new hre.ethers.utils.Interface(ABI) | ||
|
||
console.log('HopConfig', HopConfig[network.name]); | ||
|
||
const initData = iface.encodeFunctionData('initHop', [ | ||
HopConfig[network.name] | ||
]); | ||
|
||
await addOrReplaceFacets( | ||
[hopFacet], | ||
diamond.address, | ||
hopFacet.address, | ||
initData | ||
); | ||
} | ||
|
||
func.tags = ['bridges', 'hop']; | ||
func.dependencies = ['init-facets']; | ||
|
||
export default func; |
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
Oops, something went wrong.