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

Deploy Testnet Contracts #1312

Closed
wants to merge 12 commits into from
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@
[submodule "services/cctp-relayer/external/synapse-contracts"]
path = services/cctp-relayer/external/synapse-contracts
url = https://github.com/synapsecns/synapse-contracts
[submodule "packages/contracts-core/lib/solmate"]
path = packages/contracts-core/lib/solmate
url = https://github.com/rari-capital/solmate
2 changes: 1 addition & 1 deletion ethergo/internal/test-data
Submodule test-data updated 492 files
36 changes: 36 additions & 0 deletions packages/contracts-core/contracts/create3/CREATE3Factory.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.13;

Check warning

Code scanning / Slither

Incorrect versions of Solidity Warning

Pragma version^0.8.13 allows old versions

import { CREATE3 } from "solmate/utils/CREATE3.sol";

import { ICREATE3Factory } from "./ICREATE3Factory.sol";

/// @title Factory for deploying contracts to deterministic addresses via CREATE3
/// @author zefram.eth
/// @notice Enables deploying contracts using CREATE3. Each deployer (msg.sender) has
/// its own namespace for deployed addresses.
contract CREATE3Factory is ICREATE3Factory {
/// @inheritdoc ICREATE3Factory
function deploy(bytes32 salt, bytes memory creationCode)
external
payable
override
returns (address deployed)
{
// hash salt with the deployer address to give each deployer its own namespace
salt = keccak256(abi.encodePacked(msg.sender, salt));
return CREATE3.deploy(salt, creationCode, msg.value);
}

/// @inheritdoc ICREATE3Factory
function getDeployed(address deployer, bytes32 salt)
external
view
override
returns (address deployed)
{
// hash salt with the deployer address to give each deployer its own namespace
salt = keccak256(abi.encodePacked(deployer, salt));
return CREATE3.getDeployed(salt);
}
}
28 changes: 28 additions & 0 deletions packages/contracts-core/contracts/create3/ICREATE3Factory.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// SPDX-License-Identifier: AGPL-3.0
pragma solidity >=0.6.0;

Check warning

Code scanning / Slither

Incorrect versions of Solidity Warning

Pragma version>=0.6.0 allows old versions

/// @title Factory for deploying contracts to deterministic addresses via CREATE3
/// @author zefram.eth
/// @notice Enables deploying contracts using CREATE3. Each deployer (msg.sender) has
/// its own namespace for deployed addresses.
interface ICREATE3Factory {
/// @notice Deploys a contract using CREATE3
/// @dev The provided salt is hashed together with msg.sender to generate the final salt
/// @param salt The deployer-specific salt for determining the deployed contract's address
/// @param creationCode The creation code of the contract to deploy
/// @return deployed The address of the deployed contract
function deploy(bytes32 salt, bytes memory creationCode)
external
payable
returns (address deployed);

/// @notice Predicts the address of a deployed contract
/// @dev The provided salt is hashed together with the deployer address to generate the final salt
/// @param deployer The deployer account that will call deploy()
/// @param salt The deployer-specific salt for determining the deployed contract's address
/// @return deployed The address of the contract that will be deployed
function getDeployed(address deployer, bytes32 salt)
external
view
returns (address deployed);
}
4 changes: 2 additions & 2 deletions packages/contracts-core/contracts/libs/Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ uint32 constant BONDING_OPTIMISTIC_PERIOD = 1 days;
/// @dev Amount of time without fresh data from Notaries before contract owner can resolve stuck disputes manually
uint256 constant FRESH_DATA_TIMEOUT = 4 hours;
/// @dev Maximum bytes per message = 2 KiB (somewhat arbitrarily set to begin)
uint256 constant MAX_CONTENT_BYTES = 2 * 2 ** 10;
uint256 constant MAX_CONTENT_BYTES = 2 * 2**10;
/// @dev Domain of the Synapse Chain
// TODO: replace the placeholder with actual value (for MVP this is Optimism chainId)
uint32 constant SYNAPSE_DOMAIN = 10;
uint32 constant SYNAPSE_DOMAIN = 444;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"address": "0x3bA9E3Fa083133222026614C8023810c2e15aA22",
"args": "0x3078",
"abi": []
}
Loading
Loading