diff --git a/script/DeployYumeRelayGate.s.sol b/script/DeployYumeRelayGate.s.sol new file mode 100644 index 0000000..eb12a23 --- /dev/null +++ b/script/DeployYumeRelayGate.s.sol @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +pragma solidity 0.8.14; + +import "forge-std/Script.sol"; +import { DeploySetting } from "./libraries/DeploySetting.sol"; +import { LibDeploy } from "./libraries/LibDeploy.sol"; + +contract DeployCyberRelayGate is Script, DeploySetting { + function run() external { + _setDeployParams(); + vm.startBroadcast(); + + if ( + block.chainid == DeploySetting.OP_SEPOLIA || + block.chainid == DeploySetting.CYBER_TESTNET + ) { + LibDeploy.deployYumeRelayGate( + vm, + deployParams.deployerContract, + deployParams.protocolOwner + ); + } else if ( + block.chainid == DeploySetting.CYBER || + block.chainid == DeploySetting.ARBITRUM || + block.chainid == DeploySetting.OPTIMISM || + block.chainid == DeploySetting.BLAST || + block.chainid == DeploySetting.BASE || + block.chainid == DeploySetting.ETH + ) { + LibDeploy.deployYumeRelayGate( + vm, + deployParams.deployerContract, + deployParams.protocolOwner + ); + } + + vm.stopBroadcast(); + } +} diff --git a/script/DeployYumeRelayHook.s.sol b/script/DeployYumeRelayHook.s.sol new file mode 100644 index 0000000..8f551fc --- /dev/null +++ b/script/DeployYumeRelayHook.s.sol @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +pragma solidity 0.8.14; + +import "forge-std/Script.sol"; +import { DeploySetting } from "./libraries/DeploySetting.sol"; +import { LibDeploy } from "./libraries/LibDeploy.sol"; + +contract DeployNFTRelayHook is Script, DeploySetting { + function run() external { + _setDeployParams(); + vm.startBroadcast(); + + if (block.chainid == DeploySetting.OP_SEPOLIA || + block.chainid == DeploySetting.CYBER_TESTNET + ) { + LibDeploy.deployYumeRelayHook( + vm, + deployParams.deployerContract, + deployParams.protocolOwner + ); + } else if( + block.chainid == DeploySetting.CYBER || + block.chainid == DeploySetting.ARBITRUM || + block.chainid == DeploySetting.OPTIMISM || + block.chainid == DeploySetting.BLAST || + block.chainid == DeploySetting.BASE || + block.chainid == DeploySetting.ETH + ) { + LibDeploy.deployYumeRelayHook( + vm, + deployParams.deployerContract, + deployParams.protocolOwner + ); + } + + vm.stopBroadcast(); + } +} \ No newline at end of file diff --git a/script/libraries/LibDeploy.sol b/script/libraries/LibDeploy.sol index f034f58..ad820b8 100644 --- a/script/libraries/LibDeploy.sol +++ b/script/libraries/LibDeploy.sol @@ -55,6 +55,8 @@ import { CyberMintNFTRelayHook } from "../../src/periphery/CyberMintNFTRelayHook import { CyberNFT } from "../../src/periphery/CyberNFT.sol"; import { CyberIDPermissionedRelayHook } from "../../src/periphery/CyberIDPermissionedRelayHook.sol"; import { AggregatorV3Interface } from "../../src/interfaces/AggregatorV3Interface.sol"; +import {YumeRelayGate} from "../../src/periphery/YumeRelayGate.sol"; +import {YumeMintNFTRelayHook} from "../../src/periphery/YumeMintNFTRelayHook.sol"; library LibDeploy { // create2 deploy all contract with this protocol salt @@ -825,6 +827,33 @@ library LibDeploy { _write(vm, "CyberRelayGate(Proxy)", cyberRelayGateProxy); } + function deployYumeRelayGate(Vm vm, address _dc, address owner) internal { + Create2Deployer dc = Create2Deployer(_dc); + + address yumeRelayGateImpl = dc.deploy( + type(YumeRelayGate).creationCode, + SALT + ); + + _write(vm, "YumeRelayGate(Impl)", yumeRelayGateImpl); + + address yumeRelayGateProxy = dc.deploy( + abi.encodePacked( + type(ERC1967Proxy).creationCode, + abi.encode( + yumeRelayGateImpl, + abi.encodeWithSelector( + CyberRelayGate.initialize.selector, + owner + ) + ) + ), + SALT + ); + + _write(vm, "YumeRelayGate(Proxy)", yumeRelayGateProxy); + } + function deployCyberNFT(Vm vm, address _dc, address owner) internal { Create2Deployer dc = Create2Deployer(_dc); address cyberNFTImpl = dc.deploy(type(CyberNFT).creationCode, SALT); @@ -932,6 +961,23 @@ library LibDeploy { hook.configMintFee(nft, 1, erc20FeeToken, true, recipient, 4 ether); } + function deployYumeRelayHook( + Vm vm, + address _dc, + address owner + ) internal { + Create2Deployer dc = Create2Deployer(_dc); + address yumeRelayHook = dc.deploy( + abi.encodePacked( + type(YumeMintNFTRelayHook).creationCode, + abi.encode(owner) + ), + SALT + ); + + _write(vm, "YumeMintNFTRelayHook", yumeRelayHook); + } + function deployCyberProjectNFTV2( Vm vm, address _dc, diff --git a/src/periphery/YumeMintNFTRelayHook.sol b/src/periphery/YumeMintNFTRelayHook.sol index 63ebad9..f334c05 100644 --- a/src/periphery/YumeMintNFTRelayHook.sol +++ b/src/periphery/YumeMintNFTRelayHook.sol @@ -27,7 +27,7 @@ contract YumeMintNFTRelayHook is IYumeRelayGateHook, Ownable { struct MintFeeConfig { bool enabled; address recipient; - uint fee; + uint256 fee; } struct BatchConfigMintFeeParams {