Skip to content

Commit 983eb41

Browse files
committed
add the ability to call rebase on a gnosis safe module
1 parent 60de856 commit 983eb41

2 files changed

Lines changed: 45 additions & 1 deletion

File tree

contracts/migrations/seed_schedules.sql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,8 @@ INSERT INTO schedules (product, name, command, cron_expr, timezone, enabled, not
3535
('origin-dollar', 'claim_ssv_rewards', 'cd /app && pnpm hardhat claimSSVRewards --network mainnet', '45 0 1 * *', 'UTC', false, NULL),
3636
('origin-dollar', 'otoken_ousd_oeth_rebase', 'cd /app && pnpm hardhat otokenOusdOethRebase --network mainnet', '45 11,23 * * *', 'UTC', false, NULL),
3737
('origin-dollar', 'ogn_claimAndForwardRewards', 'cd /app && pnpm hardhat ognClaimAndForwardRewards --network mainnet', '50 0 * * 2', 'UTC', false, NULL),
38-
('origin-dollar', 'otoken_oethb_harvest', 'cd /app && pnpm hardhat otokenOethbHarvest --network base', '55 11 * * *', 'UTC', false, NULL)
38+
('origin-dollar', 'otoken_oethb_harvest', 'cd /app && pnpm hardhat otokenOethbHarvest --network base', '55 11 * * *', 'UTC', false, NULL),
39+
('origin-dollar', 'module_rebase_mainnet', 'cd /app && pnpm hardhat permissionedRebase --network mainnet', '15 10,22 * * *', 'UTC', true, NULL),
40+
('origin-dollar', 'module_rebase_base', 'cd /app && pnpm hardhat permissionedRebase --network base', '15 10,22 * * *', 'UTC', true, NULL),
41+
('origin-dollar', 'module_rebase_sonic', 'cd /app && pnpm hardhat permissionedRebase --network sonic', '15 10,22 * * *', 'UTC', true, NULL)
3942
ON CONFLICT DO NOTHING;
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { ethers as ethersLib } from "ethers";
2+
import { action } from "../lib/action";
3+
import { logTxDetails } from "../../utils/txLogger";
4+
5+
// PermissionedRebase Safe module addresses, keyed by chain id. The contract
6+
// source lives in a PR not yet merged into this branch — until that lands and
7+
// the module gets a Hardhat deployment artifact, addresses are pinned here.
8+
const MODULES_BY_CHAIN_ID: Record<number, string> = {
9+
1: "0xB3bCfA33C54fa4D18146196eDfB404BD036a52a6", // Ethereum
10+
8453: "0xf633980A61E9F90a41d030676059Dc201D9d4A37", // Base
11+
146: "0x77121911A387c9e4Eae46345E0f831A6da8a1364", // Sonic
12+
};
13+
14+
const PERMISSIONED_REBASE_ABI = ["function permissionedRebase() external"];
15+
16+
action({
17+
name: "permissionedRebase",
18+
description:
19+
"Call permissionedRebase() on the PermissionedRebase Safe module on the current chain (Ethereum / Base / Sonic). The module unpauses, rebases, and re-pauses every vault it manages atomically.",
20+
chains: [1, 8453, 146],
21+
run: async ({ signer, chainId, networkName, log }) => {
22+
const moduleAddress = MODULES_BY_CHAIN_ID[chainId];
23+
if (!moduleAddress) {
24+
throw new Error(
25+
`No PermissionedRebase module address configured for ${networkName} (${chainId})`
26+
);
27+
}
28+
29+
log.info(
30+
`Calling permissionedRebase on ${networkName} module at ${moduleAddress}`
31+
);
32+
33+
const module = new ethersLib.Contract(
34+
moduleAddress,
35+
PERMISSIONED_REBASE_ABI,
36+
signer
37+
);
38+
const tx = await module.permissionedRebase();
39+
await logTxDetails(tx, "permissionedRebase");
40+
},
41+
});

0 commit comments

Comments
 (0)