mirror of
https://github.com/lens-protocol/core.git
synced 2026-01-08 21:58:06 -05:00
misc: scripts for setMigrationAdmins whitelisting
This commit is contained in:
8
script/callSetMigrationAdmins.sh
Normal file
8
script/callSetMigrationAdmins.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
# Read $CALLDATA from calldata.txt
|
||||
CALLDATA=$(cat calldata.txt)
|
||||
|
||||
LENSHUB="0x7582177F9E536aB0b6c721e11f383C326F2Ad1D5"
|
||||
GOVERNANCE="0x56ebd55b2DD089D91D14Ec131Ad41e8474684822"
|
||||
GOVOWNER="0x532BbA5445e306cB83cF26Ef89842d4701330A45"
|
||||
|
||||
cast send --rpc-url mumbai --unlocked --from $GOVOWNER $GOVERNANCE "executeAsGovernance(address,bytes)" $LENSHUB $CALLDATA
|
||||
1
script/calldata.txt
Normal file
1
script/calldata.txt
Normal file
File diff suppressed because one or more lines are too long
1001
script/migrationAdmins.csv
Normal file
1001
script/migrationAdmins.csv
Normal file
File diff suppressed because it is too large
Load Diff
53
script/prepareMigrationAdminsCalldata.js
Normal file
53
script/prepareMigrationAdminsCalldata.js
Normal file
@@ -0,0 +1,53 @@
|
||||
// Read migrationAdmins.csv
|
||||
// In the format of:
|
||||
// index,address
|
||||
// 0,0x1234...
|
||||
// 1,0x5678...
|
||||
// ...
|
||||
|
||||
const fs = require('fs');
|
||||
const file = 'migrationAdmins.csv';
|
||||
|
||||
const migrationAdmins = [];
|
||||
|
||||
// Read file line by line and save to the array
|
||||
// Skip the first line
|
||||
fs.readFileSync(file, 'utf-8')
|
||||
.split(/\r?\n/)
|
||||
.slice(1)
|
||||
.forEach(function (line) {
|
||||
// If line is empty, skip
|
||||
if (!line) return;
|
||||
const [index, address] = line.split(',');
|
||||
migrationAdmins.push(address);
|
||||
});
|
||||
|
||||
// Function setMigrationAdmins(address[] memory migrationAdmins, bool whitelisted)
|
||||
// Construct the calldata using migrationAdmins and bool true, using ethers
|
||||
const ethers = require('ethers');
|
||||
|
||||
const abi = [
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
internalType: 'address[]',
|
||||
name: 'migrationAdmins',
|
||||
type: 'address[]',
|
||||
},
|
||||
{
|
||||
internalType: 'bool',
|
||||
name: 'whitelisted',
|
||||
type: 'bool',
|
||||
},
|
||||
],
|
||||
name: 'setMigrationAdmins',
|
||||
outputs: [],
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function',
|
||||
},
|
||||
];
|
||||
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const data = iface.encodeFunctionData('setMigrationAdmins', [migrationAdmins, true]);
|
||||
|
||||
console.log(data);
|
||||
9
script/verifyMigrationAdmin.sh
Normal file
9
script/verifyMigrationAdmin.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
ADMIN_TO_VERIFY=$1
|
||||
LENSHUB="0x7582177F9E536aB0b6c721e11f383C326F2Ad1D5"
|
||||
STORAGE_SLOT=29
|
||||
|
||||
SLOT=$(cast abi-encode "a(address,uint256)" $ADMIN_TO_VERIFY $STORAGE_SLOT)
|
||||
|
||||
KECCAK_HASH=$(cast keccak $SLOT)
|
||||
|
||||
cast storage --rpc-url mumbai $LENSHUB $KECCAK_HASH
|
||||
Reference in New Issue
Block a user