Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions foundry-upgrades.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"build-info-directory": "out/build-info-full"
}
3 changes: 3 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ solc_version = "0.8.26"
#sepolia = "${SEPOLIA_RPC_URL}"
#local = "${LOCAL_RPC_URL}"
#polygon = "${POLYGON_RPC_URL}"



52 changes: 39 additions & 13 deletions script/DeployerStakingManger.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@ pragma solidity ^0.8.13;
import "forge-std/Script.sol";

import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
import { StakingManager } from "../src/contracts/core/StakingManager.sol";
import { IFishcakeEventManager } from "../src/contracts/interfaces/IFishcakeEventManager.sol";
import { INftManager } from "../src/contracts/interfaces/INftManager.sol";

import {StakingManager} from "../src/contracts/core/StakingManager.sol";
import {IFishcakeEventManager} from "../src/contracts/interfaces/IFishcakeEventManager.sol";
import {INftManager} from "../src/contracts/interfaces/INftManager.sol";

contract DeployerStakingMangerScript is Script {
IFishcakeEventManager public constant PROXY_FISH_CAKE_EVENT_MANAGER =
IFishcakeEventManager(
address(0x2CAf752814f244b3778e30c27051cc6B45CB1fc9)
);
INftManager public constant PROXY_NFT_MANAGER =
INftManager(address(0x2F2Cb24BaB1b6E2353EF6246a2Ea4ce50487008B));

IFishcakeEventManager public constant PROXY_FISH_CAKE_EVENT_MANAGER = IFishcakeEventManager(address(0x2CAf752814f244b3778e30c27051cc6B45CB1fc9));
INftManager public constant PROXY_NFT_MANAGER = INftManager(address(0x2F2Cb24BaB1b6E2353EF6246a2Ea4ce50487008B));

address public constant fccAddress =
address(0x84eBc138F4Ab844A3050a6059763D269dC9951c6);

function run() public {
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
Expand All @@ -24,14 +28,36 @@ contract DeployerStakingMangerScript is Script {

StakingManager stakingManagerImplementation = new StakingManager();

console.log("StakingManager address:", address(stakingManagerImplementation));

bytes memory data = abi.encodeCall(stakingManagerImplementation.initialize, (deployerAddress, PROXY_FISH_CAKE_EVENT_MANAGER, PROXY_NFT_MANAGER));

ERC1967Proxy proxyStakingManager = new ERC1967Proxy(address(stakingManagerImplementation), data);
console.log(
"=========== StakingManager Logic address: =============",
address(stakingManagerImplementation)
);

bytes memory data = abi.encodeCall(
stakingManagerImplementation.initialize,
(
deployerAddress, // 升级权限和逻辑权限都在deployerAddress
fccAddress,
PROXY_FISH_CAKE_EVENT_MANAGER,
PROXY_NFT_MANAGER
)
);

ERC1967Proxy proxyStakingManager = new ERC1967Proxy(
address(stakingManagerImplementation),
data
);

vm.stopBroadcast();

console.log("UUPS Proxy Address:", address(proxyStakingManager));
console.log(
"========UUPS Proxy StakingManager Address: =========",
address(proxyStakingManager)
);

console.log(
"========StakingManager Owner: =========",
StakingManager(payable(address(proxyStakingManager))).owner()
);
}
}
63 changes: 53 additions & 10 deletions script/UpgradeDirectSalePoolV1.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,75 @@
pragma solidity ^0.8.13;

import "@openzeppelin-foundry-upgrades/Upgrades.sol";
import "forge-std/Script.sol";
import { DirectSalePoolV1 } from "../src/contracts/core/sale/DirectSalePoolV1.sol";
import "forge-std/Script.sol";
import {DirectSalePoolV1} from "../src/contracts/core/sale/DirectSalePoolV1.sol";

contract UpgradeDirectSalePoolV1Script is Script {
address public constant PROXY_DIRECT_SALE_POOL = address(0xF71C97C9C6B2133A0Cb5c3ED4CC6eFe5e1BC534C);
address public constant INITIAL_OWNER =
0x7a129d41bb517aD9A6FA49afFAa92eBeea2DFe07;
address public constant FCC_ADDRESS =
0x84eBc138F4Ab844A3050a6059763D269dC9951c6;
address public constant USDT_ADDRESS =
0xc2132D05D31c914a87C6611C10748AEb04B58e8F;
address public constant REDEMPT_POOL =
0x036423643CEB603B7aff40A05627F09C04b9897E;

address public constant PROXY_DIRECT_SALE_POOL =
address(0xF71C97C9C6B2133A0Cb5c3ED4CC6eFe5e1BC534C);

function run() public {
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
address deployerAddress = vm.addr(deployerPrivateKey);
console.log("deploy deployerAddress:", address(deployerAddress));

console.log("address(this):", address(this));
// console.log("address(this):", address(this));

vm.startBroadcast(deployerPrivateKey);
DirectSalePoolV1 newImplementation = new DirectSalePoolV1();
console.log("New DirectSalePoolV1 implementation deployed at:", address(newImplementation));
console.log(
"New DirectSalePoolV1 implementation deployed at:",
address(newImplementation)
);

console.log(
"DirectSalePool Proxy Admin:",
Upgrades.getAdminAddress(PROXY_DIRECT_SALE_POOL)
);
console.log(
"DirectSalePool upgraded before:",
Upgrades.getImplementationAddress(PROXY_DIRECT_SALE_POOL)
);

console.log("DirectSalePool Proxy Admin:", Upgrades.getAdminAddress(PROXY_DIRECT_SALE_POOL));
console.log("DirectSalePool upgraded before:", Upgrades.getImplementationAddress(PROXY_DIRECT_SALE_POOL));
// // 加入初始化 data
// bytes memory data = abi.encodeCall(
// DirectSalePoolV1.initialize,
// (INITIAL_OWNER, FCC_ADDRESS, REDEMPT_POOL, USDT_ADDRESS)
// ); // 升级权限在 deployerAddress,逻辑权限在 INITIAL_OWNER

Upgrades.upgradeProxy(PROXY_DIRECT_SALE_POOL, "DirectSalePoolV1.sol:DirectSalePoolV1", "", deployerAddress);
Upgrades.upgradeProxy(
PROXY_DIRECT_SALE_POOL,
"DirectSalePoolV1.sol:DirectSalePoolV1",
"",
deployerAddress
);
console.log("DirectSalePoolV1 proxy upgraded successfully");
vm.stopBroadcast();

console.log(
"=========DirectSalePool upgraded logic address after: ===========",
Upgrades.getImplementationAddress(PROXY_DIRECT_SALE_POOL)
);
console.log(
"DirectSalePool Proxy Admin:",
Upgrades.getAdminAddress(PROXY_DIRECT_SALE_POOL)
);

DirectSalePoolV1 directSalePoolV1 = DirectSalePoolV1(
payable(PROXY_DIRECT_SALE_POOL)
);

console.log("========Proxy:==========", PROXY_DIRECT_SALE_POOL);

console.log("DirectSalePool upgraded after:", Upgrades.getImplementationAddress(PROXY_DIRECT_SALE_POOL));
console.log("DirectSalePool Proxy Admin:", Upgrades.getAdminAddress(PROXY_DIRECT_SALE_POOL));
console.log("========Owner:==========", directSalePoolV1.owner());
}
}
66 changes: 56 additions & 10 deletions script/UpgradeFishcakeEventManagerV2.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,77 @@
pragma solidity ^0.8.13;

import "@openzeppelin-foundry-upgrades/Upgrades.sol";
import "forge-std/Script.sol";
import "forge-std/Script.sol";
import {FishcakeEventManagerV2} from "../src/contracts/core/FishcakeEventManagerV2.sol";

contract FishcakeEventManagerV2Script is Script {
address public constant PROXY_FISH_CAKE_EVENT_MANAGER = address(0x2CAf752814f244b3778e30c27051cc6B45CB1fc9);
address public constant PROXY_FISH_CAKE_EVENT_MANAGER =
address(0x2CAf752814f244b3778e30c27051cc6B45CB1fc9);

address public constant INITIAL_OWNER =
0x7a129d41bb517aD9A6FA49afFAa92eBeea2DFe07;
address public constant FCC_ADDRESS =
0x84eBc138F4Ab844A3050a6059763D269dC9951c6;
address public constant USDT_ADDRESS =
0xc2132D05D31c914a87C6611C10748AEb04B58e8F;
address public constant NFT_MANAGER =
0x2F2Cb24BaB1b6E2353EF6246a2Ea4ce50487008B;

function run() public {
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
address deployerAddress = vm.addr(deployerPrivateKey);
console.log("deploy deployerAddress:", address(deployerAddress));

console.log("address(this):", address(this));
// console.log("address(this):", address(this));

vm.startBroadcast(deployerPrivateKey);
FishcakeEventManagerV2 newImplementation = new FishcakeEventManagerV2();
console.log("New FishcakeEventManagerV2 implementation deployed at:", address(newImplementation));
console.log(
"New FishcakeEventManagerV2 implementation deployed at:",
address(newImplementation)
);

console.log(
"Proxy Admin:",
Upgrades.getAdminAddress(PROXY_FISH_CAKE_EVENT_MANAGER)
);
console.log(
"upgraded before:",
Upgrades.getImplementationAddress(PROXY_FISH_CAKE_EVENT_MANAGER)
);

console.log("Proxy Admin:", Upgrades.getAdminAddress(PROXY_FISH_CAKE_EVENT_MANAGER));
console.log("upgraded before:", Upgrades.getImplementationAddress(PROXY_FISH_CAKE_EVENT_MANAGER));
// // 加入初始化 data
// bytes memory data = abi.encodeCall(
// FishcakeEventManagerV2.initialize,
// (INITIAL_OWNER, FCC_ADDRESS, USDT_ADDRESS, NFT_MANAGER)
// ); // 升级权限在 deployerAddress,逻辑权限在 INITIAL_OWNER

Upgrades.upgradeProxy(PROXY_FISH_CAKE_EVENT_MANAGER, "FishcakeEventManagerV2.sol:FishcakeEventManagerV2", "", deployerAddress);
Upgrades.upgradeProxy(
PROXY_FISH_CAKE_EVENT_MANAGER,
"FishcakeEventManagerV2.sol:FishcakeEventManagerV2",
"",
deployerAddress
);
console.log("FishcakeEventManagerV2 proxy upgraded successfully");
console.log("=======================================================================");
console.log(
"======================================================================="
);
vm.stopBroadcast();
console.log("upgraded after:", Upgrades.getImplementationAddress(PROXY_FISH_CAKE_EVENT_MANAGER));
console.log("Proxy Admin:", Upgrades.getAdminAddress(PROXY_FISH_CAKE_EVENT_MANAGER));
console.log(
"==========upgraded logic address after: ============",
Upgrades.getImplementationAddress(PROXY_FISH_CAKE_EVENT_MANAGER)
);
console.log(
"Proxy Admin:",
Upgrades.getAdminAddress(PROXY_FISH_CAKE_EVENT_MANAGER)
);

FishcakeEventManagerV2 fishcakeEventManagerV2 = FishcakeEventManagerV2(
payable(PROXY_FISH_CAKE_EVENT_MANAGER)
);

console.log("========Proxy:==========", PROXY_FISH_CAKE_EVENT_MANAGER);

console.log("========Owner:==========", fishcakeEventManagerV2.owner());
}
}
76 changes: 76 additions & 0 deletions script/UpgradeInvestSalePoolV1.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "@openzeppelin-foundry-upgrades/Upgrades.sol";
import "forge-std/Script.sol";
import {InvestorSalePool} from "../src/contracts/core/sale/InvestorSalePool.sol";

contract UpgradeInvestorSalePoolScript is Script {
address public constant INITIAL_OWNER =
0x7a129d41bb517aD9A6FA49afFAa92eBeea2DFe07;
address public constant FCC_ADDRESS =
0x84eBc138F4Ab844A3050a6059763D269dC9951c6;
address public constant USDT_ADDRESS =
0xc2132D05D31c914a87C6611C10748AEb04B58e8F;
address public constant REDEMPT_POOL =
0x036423643CEB603B7aff40A05627F09C04b9897E;

address public constant PROXY_INVESTOR_SALE_POOL =
address(0x9dA9d48c3b1CB9B8c4AE3c195a6Bee5BAaa5314A);

function run() public {
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
address deployerAddress = vm.addr(deployerPrivateKey);
console.log("deploy deployerAddress:", address(deployerAddress));

// console.log("address(this):", address(this));

vm.startBroadcast(deployerPrivateKey);
InvestorSalePool newImplementation = new InvestorSalePool();
console.log(
"New InvestorSalePool implementation deployed at:",
address(newImplementation)
);

console.log(
"DirectSalePool Proxy Admin:",
Upgrades.getAdminAddress(PROXY_INVESTOR_SALE_POOL)
);
console.log(
"DirectSalePool upgraded before:",
Upgrades.getImplementationAddress(PROXY_INVESTOR_SALE_POOL)
);

// // 加入初始化 data
// bytes memory data = abi.encodeCall(
// InvestorSalePool.initialize,
// (INITIAL_OWNER, FCC_ADDRESS, REDEMPT_POOL, USDT_ADDRESS)
// ); // 升级权限在 deployerAddress,逻辑权限在 INITIAL_OWNER

Upgrades.upgradeProxy(
PROXY_INVESTOR_SALE_POOL,
"InvestorSalePool.sol:InvestorSalePool",
"",
deployerAddress
);
console.log("InvestorSalePool proxy upgraded successfully");
vm.stopBroadcast();

console.log(
"======= InvestorSalePool logic address upgraded after:==========",
Upgrades.getImplementationAddress(PROXY_INVESTOR_SALE_POOL)
);
console.log(
"InvestorSalePool Proxy Admin:",
Upgrades.getAdminAddress(PROXY_INVESTOR_SALE_POOL)
);

InvestorSalePool investorSalePool = InvestorSalePool(
payable(PROXY_INVESTOR_SALE_POOL)
);

console.log("========Proxy:==========", PROXY_INVESTOR_SALE_POOL);

console.log("========Owner:==========", investorSalePool.owner());
}
}
Loading