From bfea30c7d743caeaed75f374b0bd17719a975c58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Tue, 24 Jun 2025 12:32:51 +0200 Subject: [PATCH 1/3] feat: make OUSD EIP-7702 compatible. --- contracts/contracts/token/OUSD.sol | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contracts/contracts/token/OUSD.sol b/contracts/contracts/token/OUSD.sol index d24398dc4e..958c351740 100644 --- a/contracts/contracts/token/OUSD.sol +++ b/contracts/contracts/token/OUSD.sol @@ -465,7 +465,8 @@ contract OUSD is Governable { * @param _account Address of the account. */ function _autoMigrate(address _account) internal { - bool isContract = _account.code.length > 0; + bool isContract = _account.code.length > 0 && + bytes3(_account.code) != 0xef0100; // In previous code versions, contracts would not have had their // rebaseState[_account] set to RebaseOptions.NonRebasing when migrated // therefore we check the actual accounting used on the account instead. From adf67de7d5e2adc2a078ff24ba8b72c13dbec575 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Tue, 24 Jun 2025 14:09:11 +0200 Subject: [PATCH 2/3] feat: add deployment script. --- .../mainnet/143_ousd_upgrade_EIP7702.js | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 contracts/deploy/mainnet/143_ousd_upgrade_EIP7702.js diff --git a/contracts/deploy/mainnet/143_ousd_upgrade_EIP7702.js b/contracts/deploy/mainnet/143_ousd_upgrade_EIP7702.js new file mode 100644 index 0000000000..078e2dc31b --- /dev/null +++ b/contracts/deploy/mainnet/143_ousd_upgrade_EIP7702.js @@ -0,0 +1,35 @@ +const { deploymentWithGovernanceProposal } = require("../../utils/deploy"); + +module.exports = deploymentWithGovernanceProposal( + { + deployName: "143_ousd_upgrade_EIP7702", + forceDeploy: false, + //forceSkip: true, + reduceQueueTime: true, + deployerIsProposer: false, + proposalId: + "", + }, + async ({ deployWithConfirmation }) => { + // Deployer Actions + // ---------------- + + // 1. Deploy new OUSD implementation without storage slot checks + const dOUSD = await deployWithConfirmation("OUSD", [], "OUSD", true); + const cOUSDProxy = await ethers.getContract("OUSDProxy"); + + // Governance Actions + // ---------------- + return { + name: "Upgrade OUSD token contract", + actions: [ + // 1. Upgrade the OUSD proxy to the new implementation + { + contract: cOUSDProxy, + signature: "upgradeTo(address)", + args: [dOUSD.address], + }, + ], + }; + } +); From 6b8c58c3d2638dbf1254bf449f9928418cf7a80a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Tue, 24 Jun 2025 14:22:07 +0200 Subject: [PATCH 3/3] prettier --- contracts/deploy/mainnet/143_ousd_upgrade_EIP7702.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/contracts/deploy/mainnet/143_ousd_upgrade_EIP7702.js b/contracts/deploy/mainnet/143_ousd_upgrade_EIP7702.js index 078e2dc31b..2f7f0503bd 100644 --- a/contracts/deploy/mainnet/143_ousd_upgrade_EIP7702.js +++ b/contracts/deploy/mainnet/143_ousd_upgrade_EIP7702.js @@ -7,8 +7,7 @@ module.exports = deploymentWithGovernanceProposal( //forceSkip: true, reduceQueueTime: true, deployerIsProposer: false, - proposalId: - "", + proposalId: "", }, async ({ deployWithConfirmation }) => { // Deployer Actions