Skip to content

Commit

Permalink
optimize script codes
Browse files Browse the repository at this point in the history
  • Loading branch information
xuesong.zhang committed Dec 24, 2024
1 parent 3f3a42a commit 93fa04c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 28 deletions.
2 changes: 1 addition & 1 deletion hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ module.exports = {
},
},
eth: {
url: ALCHEMY_KEY == '' ? "https://eth.llamarpc.com" : `https://eth-mainnet.g.alchemy.com/v2/${ALCHEMY_KEY}`,
url: ALCHEMY_KEY == '' ? "https://rpc.ankr.com/eth" : `https://eth-mainnet.g.alchemy.com/v2/${ALCHEMY_KEY}`,
accounts: [`${PRIVATE_KEY}`],
settings: {
optimizer: {
Expand Down
50 changes: 24 additions & 26 deletions scripts/18_change_owner.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,42 @@ const { upgrades } = require('hardhat');
async function main() {
console.log("##CHANGE OWNER BEGIN");

const newOwner = "0xE1C7Db7575BABF0d3369835678ec9b7F15c0886B"; //资管账号
//const oldAdmin = "0xc82Ea2afE1Fd1D61C4A12f5CeB3D7000f564F5C6"; //旧admin
const newAdmin = "0x06C95a3934d94d5ae5bf54731bD2840ceFee6F87"; //新admin
const newLogicContract = "0xb5eA4cD719D4C73e062D6195b17f703792543904"; //flare new logic
const newOwner = "0xE1C7Db7575BABF0d3369835678ec9b7F15c0886B"; // 资管账号
const newAdmin = "0x06C95a3934d94d5ae5bf54731bD2840ceFee6F87"; // 新admin
const newLogicContract = "0x1BDB7aB4C359769fDFE83d8813d61942f9DE8f01"; // flare new logic

// ProxyAdmin
//ETHW: 0x91597356448f771363Ae3C3d7B87C8D6f2f63B25
//Fantom: 0x5703B683c7F928b721CA95Da988d73a3299d4757
//Cronos: 0x5703B683c7F928b721CA95Da988d73a3299d4757
//Flare: 0x2c34A2Fb1d0b4f55de51E1d0bDEfaDDce6b7cDD6
// ETHW: 0x91597356448f771363Ae3C3d7B87C8D6f2f63B25
// Fantom: 0x5703B683c7F928b721CA95Da988d73a3299d4757
// Cronos: 0x5703B683c7F928b721CA95Da988d73a3299d4757
// Flare: 0x2c34A2Fb1d0b4f55de51E1d0bDEfaDDce6b7cDD6

const dexRouter = await ethers.getContractAt(
"DexRouter",
deployed.base.dexRouter
newLogicContract
);
console.log("dexRouter:", deployed.base.dexRouter);
// console.log("dexRouter:", deployed.base.dexRouter);
console.log("dexRouter.owner:", await dexRouter.owner());
console.log("dexRouter.tmpAdmin:", await dexRouter.tmpAdmin());
console.log("dexRouter.admin:", await dexRouter.admin());
console.log("\n");
// console.log("\n");

const instance = await upgrades.admin.getInstance();
const proxyAdminAddress = await instance.getProxyAdmin(deployed.base.dexRouter);
console.log("proxyAdmin:", proxyAdminAddress);
// const instance = await upgrades.admin.getInstance();
// const proxyAdminAddress = await instance.getProxyAdmin(deployed.base.dexRouter);
// console.log("proxyAdmin:", proxyAdminAddress);

proxyAdmin = await ethers.getContractAt(
"ProxyAdmin",
proxyAdminAddress
);

console.log("proxyAdmin.owner:", await proxyAdmin.owner());
console.log("proxyAdmin.logicContract:", await proxyAdmin.getProxyImplementation(deployed.base.dexRouter));
console.log("owner nonce:", await ethers.provider.getTransactionCount(newAdmin));
// proxyAdmin = await ethers.getContractAt(
// "ProxyAdmin",
// proxyAdminAddress
// );

// console.log("proxyAdmin.owner:", await proxyAdmin.owner());
// console.log("proxyAdmin.logicContract:", await proxyAdmin.getProxyImplementation(deployed.base.dexRouter));
// console.log("owner nonce:", await ethers.provider.getTransactionCount(newAdmin));

//转移owner
//await dexRouter.transferOwnership(newAdmin);
//await proxyAdmin.transferOwnership(newAdmin);
// 转移 owner
await dexRouter.setProtocolAdmin(newOwner);
await dexRouter.transferOwnership(newOwner);
// await proxyAdmin.transferOwnership(newAdmin);

//升级逻辑合约
//await proxyAdmin.upgrade(deployed.base.dexRouter, newLogicContract);
Expand Down
1 change: 0 additions & 1 deletion scripts/deploy_dex_imp.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const { ethers, upgrades } = require("hardhat");
const deployed = require('./deployed');
const { dexRouter } = require("./deployed/eth/base");

async function main() {
console.log(deployed.base);
Expand Down

0 comments on commit 93fa04c

Please sign in to comment.