generated from BreadchainCoop/solidity-foundry-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 2
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 #5 from BreadchainCoop/bagel-refactor
Bagel refactor
- Loading branch information
Showing
24 changed files
with
1,198 additions
and
1,109 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,42 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.23; | ||
pragma solidity 0.8.28; | ||
|
||
import {IERC20} from '@openzeppelin/token/ERC20/IERC20.sol'; | ||
import {Greeter, IGreeter} from 'contracts/Greeter.sol'; | ||
import {ProxyAdmin} from '@openzeppelin/proxy/transparent/ProxyAdmin.sol'; | ||
import {TransparentUpgradeableProxy} from '@openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol'; | ||
import {Script} from 'forge-std/Script.sol'; | ||
// solhint-disable-next-line | ||
import 'script/Registry.sol'; | ||
|
||
import {SavingCircles} from '../src/contracts/SavingCircles.sol'; | ||
|
||
/** | ||
* @title Common Contract | ||
* @author Breadchain | ||
* @notice This contract is used to deploy the Greeter contract | ||
* @notice This contract is used to deploy an upgradeable Saving Circles contract | ||
* @dev This contract is intended for use in Scripts and Integration Tests | ||
*/ | ||
contract Common is Script { | ||
struct DeploymentParams { | ||
string greeting; | ||
IERC20 token; | ||
} | ||
|
||
IGreeter public greeter; | ||
function setUp() public virtual {} | ||
|
||
/// @notice Deployment parameters for each chain | ||
mapping(uint256 _chainId => DeploymentParams _params) internal _deploymentParams; | ||
|
||
function setUp() public virtual { | ||
// Optimism | ||
_deploymentParams[10] = DeploymentParams('Hello, Optimism!', IERC20(OPTIMISM_DAI)); | ||
function _deploySavingCircles() internal returns (SavingCircles) { | ||
return new SavingCircles(); | ||
} | ||
|
||
// Gnosis | ||
_deploymentParams[100] = DeploymentParams('Hello, Gnosis!', IERC20(GNOSIS_BREAD)); | ||
function _deployProxyAdmin(address _admin) internal returns (ProxyAdmin) { | ||
return new ProxyAdmin(_admin); | ||
} | ||
|
||
function _deployContracts() internal { | ||
DeploymentParams memory _params = _deploymentParams[block.chainid]; | ||
function _deployTransparentProxy( | ||
address _implementation, | ||
address _proxyAdmin, | ||
bytes memory _initData | ||
) internal returns (TransparentUpgradeableProxy) { | ||
return new TransparentUpgradeableProxy(_implementation, _proxyAdmin, _initData); | ||
} | ||
|
||
greeter = new Greeter(_params.greeting, _params.token); | ||
function _deployContracts(address _admin) internal returns (TransparentUpgradeableProxy) { | ||
return _deployTransparentProxy( | ||
address(_deploySavingCircles()), | ||
address(_deployProxyAdmin(_admin)), | ||
abi.encodeWithSelector(SavingCircles.initialize.selector, _admin) | ||
); | ||
} | ||
} |
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 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
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.