-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from OffchainLabs/fix-verification
fix: blockscout verification
- Loading branch information
Showing
11 changed files
with
542 additions
and
69 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
pragma solidity ^0.8.0; | ||
|
||
library CreationCodeHelper { | ||
/** | ||
* @notice Generate a creation code that results with a contract with `code` as deployed code. | ||
* Generated creation code shall match the one generated by Solidity compiler with an empty constructor. | ||
* @dev Prepended constructor bytecode consists of: | ||
* - 608060405234801561001057600080fd5b50 - store free memory pointer, then check no callvalue is provided | ||
* - 61xxxx - push 2 bytes of `code` length | ||
* - 806100206000396000f3fe - copy deployed code to memory and return the location of it | ||
* @param runtimeCode Deployed bytecode to which constructor bytecode will be prepended | ||
* @return Creation code of a new contract | ||
*/ | ||
function getCreationCodeFor(bytes memory runtimeCode) internal pure returns (bytes memory) { | ||
return abi.encodePacked( | ||
hex"608060405234801561001057600080fd5b50", | ||
hex"61", | ||
uint16(runtimeCode.length), | ||
hex"806100206000396000f3fe", | ||
runtimeCode | ||
); | ||
} | ||
} |
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,13 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
pragma solidity ^0.8.0; | ||
|
||
import {CreationCodeHelper} from "../libraries/CreationCodeHelper.sol"; | ||
|
||
contract CreationCodeTest { | ||
/** | ||
* @dev Wrapper function around CreationCodeHelper.getCreationCodeFor used for testing convenience. | ||
*/ | ||
function creationCodeFor(bytes memory code) external pure returns (bytes memory) { | ||
return CreationCodeHelper.getCreationCodeFor(code); | ||
} | ||
} |
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,33 @@ | ||
import { JsonRpcProvider } from '@ethersproject/providers' | ||
import { L2AtomicTokenBridgeFactory__factory } from '../build/types' | ||
import dotenv from 'dotenv' | ||
import { Wallet } from 'ethers' | ||
|
||
dotenv.config() | ||
|
||
async function main() { | ||
const deployRpc = process.env['BASECHAIN_RPC'] as string | ||
if (deployRpc == undefined) { | ||
throw new Error("Env var 'BASECHAIN_RPC' not set") | ||
} | ||
const rpc = new JsonRpcProvider(deployRpc) | ||
|
||
const deployKey = process.env['BASECHAIN_DEPLOYER_KEY'] as string | ||
if (deployKey == undefined) { | ||
throw new Error("Env var 'BASECHAIN_DEPLOYER_KEY' not set") | ||
} | ||
const deployer = new Wallet(deployKey).connect(rpc) | ||
|
||
console.log( | ||
'Deploying L2AtomicTokenBridgeFactory to chain', | ||
await deployer.getChainId() | ||
) | ||
const l2TokenBridgeFactory = await new L2AtomicTokenBridgeFactory__factory( | ||
deployer | ||
).deploy() | ||
await l2TokenBridgeFactory.deployed() | ||
|
||
console.log('l2TokenBridgeFactory:', l2TokenBridgeFactory.address) | ||
} | ||
|
||
main().then(() => console.log('Done.')) |
Oops, something went wrong.