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. 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..2f7f0503bd --- /dev/null +++ b/contracts/deploy/mainnet/143_ousd_upgrade_EIP7702.js @@ -0,0 +1,34 @@ +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], + }, + ], + }; + } +);