Skip to content

Commit

Permalink
Upgrade.s.sol: seperate update logic script
Browse files Browse the repository at this point in the history
  • Loading branch information
vivinvinh212 committed Feb 4, 2025
1 parent c01311d commit 24f5b79
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 48 deletions.
48 changes: 0 additions & 48 deletions script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -101,51 +101,3 @@ contract DeployLLMOracleCoordinator is Script {
impl = Upgrades.getImplementationAddress(proxy);
}
}

contract UpgradeLLMOracleCoordinator is Script {
Helper public helper;

constructor() {
helper = new Helper();
}

function run() public returns (address impl) {
// todo: get proxy address
address proxy = 0xe3Ab5D57Feb189d7CD1685336FD638856391b9EB;

vm.startBroadcast();
impl = upgrade(proxy);
vm.stopBroadcast();

helper.writeProxyAddresses("LLMOracleCoordinator", proxy, impl);
}

function upgrade(address proxy) public returns (address impl) {
Upgrades.upgradeProxy(proxy, "LLMOracleCoordinatorV2.sol", "");
impl = Upgrades.getImplementationAddress(proxy);
}
}

contract UpgradeLLMOracleRegistry is Script {
Helper public helper;

constructor() {
helper = new Helper();
}

function run() public returns (address impl) {
// todo: get proxy address
address proxy = 0x568Cfb5363E70Cde784f8603E2748e614c3420a7;

vm.startBroadcast();
impl = upgrade(proxy);
vm.stopBroadcast();

helper.writeProxyAddresses("LLMOracleRegistry", proxy, impl);
}

function upgrade(address proxy) public returns (address impl) {
Upgrades.upgradeProxy(proxy, "LLMOracleRegistryV2.sol", "");
impl = Upgrades.getImplementationAddress(proxy);
}
}
54 changes: 54 additions & 0 deletions script/Upgrade.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.20;

import {Upgrades} from "@openzeppelin/foundry-upgrades/Upgrades.sol";
import {Script} from "forge-std/Script.sol";
import {Helper} from "./Helper.s.sol";

contract UpgradeLLMOracleCoordinator is Script {
Helper public helper;

constructor() {
helper = new Helper();
}

function run() public returns (address impl) {
// todo: get proxy address
address proxy = 0xe3Ab5D57Feb189d7CD1685336FD638856391b9EB;

vm.startBroadcast();
impl = upgrade(proxy);
vm.stopBroadcast();

helper.writeProxyAddresses("LLMOracleCoordinator", proxy, impl);
}

function upgrade(address proxy) public returns (address impl) {
Upgrades.upgradeProxy(proxy, "LLMOracleCoordinatorV2.sol", "");
impl = Upgrades.getImplementationAddress(proxy);
}
}

contract UpgradeLLMOracleRegistry is Script {
Helper public helper;

constructor() {
helper = new Helper();
}

function run() public returns (address impl) {
// todo: get proxy address
address proxy = 0x568Cfb5363E70Cde784f8603E2748e614c3420a7;

vm.startBroadcast();
impl = upgrade(proxy);
vm.stopBroadcast();

helper.writeProxyAddresses("LLMOracleRegistry", proxy, impl);
}

function upgrade(address proxy) public returns (address impl) {
Upgrades.upgradeProxy(proxy, "LLMOracleRegistryV2.sol", "");
impl = Upgrades.getImplementationAddress(proxy);
}
}

0 comments on commit 24f5b79

Please sign in to comment.