Skip to content
Merged
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
28 changes: 20 additions & 8 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,25 @@ ffi = true
ast = true
build_info = true
extra_output = ["storageLayout"]

# RPC Configuration
[rpc_endpoints]
pushchain = "https://evm.rpc-testnet-donut-node1.push.org/"
pushlocalnet = "http://127.0.0.1:8545"
sepolia = "https://sepolia.infura.io/v3/${INFURA_PROJECT_ID}"
mainnet = "https://mainnet.infura.io/v3/${INFURA_PROJECT_ID}"

# Private Keys
[profile.env]
PRIVATE = "${PRIVATE_KEY}"

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
[fmt]
bracket_spacing = true
int_types = "long"
line_length = 120
multiline_func_header = "all"
number_underscore = "thousands"
quote_style = "double"
tab_width = 4
wrap_comments = true
bracket_spacing = true
int_types = "long"
line_length = 120
multiline_func_header = "all"
number_underscore = "thousands"
quote_style = "double"
tab_width = 4
wrap_comments = true
6 changes: 5 additions & 1 deletion hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = {
},

pushchain: {
url: "https://evm.pn1.dev.push.org",
url: "https://evm.rpc-testnet-donut-node1.push.org/",
accounts: [process.env.PRIVATE]
,
},
Expand All @@ -47,6 +47,10 @@ module.exports = {
url: `https://sepolia.infura.io/v3/${process.env.INFURA_PROJECT_ID}`,
accounts: [process.env.PRIVATE]

},
mainnet: {
url: `https://mainnet.infura.io/v3/${process.env.INFURA_PROJECT_ID}`,
accounts: [process.env.PRIVATE]
}
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ async function main() {
main().catch((err) => {
console.error("Error in deploy script:", err);
process.exit(1);
});
});
25 changes: 0 additions & 25 deletions script/legacyDeployment/DeployLocker.js

This file was deleted.

4 changes: 2 additions & 2 deletions script/testUtils/getPoof.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const whitelist = require("../../output/claims.json");
const whitelist = require("../../output/migration-list.json");
const { getProof } = require("../utils/merkle");

const user = whitelist[0];
const proof = getProof(user.address, user.amount, whitelist);
const proof = getProof(user.address, user.amount, user.epoch, whitelist);
console.log("Merkle Proof for user:", user.address);
console.log(proof);
6 changes: 3 additions & 3 deletions script/testUtils/proofArray.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const whitelist = require("../../output/claims.json");
const whitelist = require("../../output/migration-list.json");
const { getProof, verify } = require("../utils/merkle");

for (const user of whitelist) {
const proof = getProof(user.address, user.amount, whitelist);
const valid = verify(user.address, user.amount, whitelist);
const proof = getProof(user.address, user.amount, user.epoch, whitelist);
const valid = verify(user.address, user.amount, user.epoch, whitelist);

console.log("User:", user.address);
console.log("Proof:", proof);
Expand Down
4 changes: 2 additions & 2 deletions script/testUtils/verify.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const whitelist = require("../../output/claims.json");
const whitelist = require("../../output/migration-list.json");
const { verify } = require("../utils/merkle");

const user = whitelist[0];
const isValid = verify(user.address, user.amount, whitelist);
const isValid = verify(user.address, user.amount, user.epoch, whitelist);
console.log("Proof valid?", isValid);
50 changes: 50 additions & 0 deletions script/upgrade/UpgradeLocker.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.8.29;

import "forge-std/Script.sol";
import "../../src/MigrationLocker.sol";
import { ITransparentUpgradeableProxy } from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";

/**
* @title UpgradeLocker
* @dev Upgrade script for MigrationLocker contract
* This script handles:
* 1. Deployment of the new implementation contract
* 2. Upgrading the proxy to point to the new implementation
*/
contract UpgradeLockerScript is Script {
// Storage slot for ProxyAdmin in TransparentUpgradeableProxy
bytes32 constant PROXY_ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

function run() external {
// Get private key from environment
uint256 deployerPrivateKey = vm.envUint("DEPLOYER_OWNER");
address deployerAddress = vm.addr(deployerPrivateKey);

// Get proxy address from environment
address proxyAddress = 0xEf9898A2476bd7b3801e9D257d4c39279eF1583c;

vm.startBroadcast(deployerPrivateKey);

console.log("Upgrading contracts with address:", deployerAddress);
console.log("Current proxy address:", proxyAddress);

// Deploy new implementation
MigrationLocker newImplementation = new MigrationLocker();
console.log("New MigrationLocker implementation deployed at:", address(newImplementation));

// Get the proxy admin contract from storage slot
address proxyAdminAddress = address(uint160(uint256(vm.load(proxyAddress, PROXY_ADMIN_SLOT))));
ProxyAdmin proxyAdmin = ProxyAdmin(proxyAdminAddress);
console.log("ProxyAdmin address:", proxyAdminAddress);

// Upgrade the proxy to point to the new implementation
proxyAdmin.upgradeAndCall(
ITransparentUpgradeableProxy(payable(proxyAddress)), address(newImplementation), bytes("")
);
console.log("Proxy upgraded to new implementation");

vm.stopBroadcast();
}
}
50 changes: 50 additions & 0 deletions script/upgrade/UpgradeRelease.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.8.29;

import "forge-std/Script.sol";
import "../../src/MigrationRelease.sol";
import { ITransparentUpgradeableProxy } from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";

/**
* @title UpgradeRelease
* @dev Upgrade script for MigrationRelease contract
* This script handles:
* 1. Deployment of the new implementation contract
* 2. Upgrading the proxy to point to the new implementation
*/
contract UpgradeReleaseScript is Script {
// Storage slot for ProxyAdmin in TransparentUpgradeableProxy
bytes32 constant PROXY_ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

function run() external {
// Get private key from environment
uint256 deployerPrivateKey = vm.envUint("DEPLOYER_OWNER");
address deployerAddress = vm.addr(deployerPrivateKey);

// Get proxy address from environment
address proxyAddress = 0x95CFE535e2Eea0EB1620fa1d10549b67e284Ba52;

vm.startBroadcast(deployerPrivateKey);

console.log("Upgrading contracts with address:", deployerAddress);
console.log("Current proxy address:", proxyAddress);

// Deploy new implementation
MigrationRelease newImplementation = new MigrationRelease();
console.log("New MigrationRelease implementation deployed at:", address(newImplementation));

// Get the proxy admin contract from storage slot
address proxyAdminAddress = address(uint160(uint256(vm.load(proxyAddress, PROXY_ADMIN_SLOT))));
ProxyAdmin proxyAdmin = ProxyAdmin(proxyAdminAddress);
console.log("ProxyAdmin address:", proxyAdminAddress);

// Upgrade the proxy to point to the new implementation
proxyAdmin.upgradeAndCall(
ITransparentUpgradeableProxy(payable(proxyAddress)), address(newImplementation), bytes("")
);
console.log("Proxy upgraded to new implementation");

vm.stopBroadcast();
}
}