diff --git a/.husky/pre-commit b/.husky/pre-commit index 2312dc5..16ac135 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1 +1 @@ -npx lint-staged +npx lint-staged --allow-empty diff --git a/foundry.toml b/foundry.toml index e55c3bb..f09f07b 100644 --- a/foundry.toml +++ b/foundry.toml @@ -16,7 +16,7 @@ script = "src/script" # A list of paths to look for libraries in libs = ['lib', 'node_modules'] # Whether or not to enable `vm.ffi` -ffi = false +ffi = true # Enables or disables the optimizer optimizer = false # The number of optimizer runs @@ -29,6 +29,7 @@ bytecode_hash = "none" cbor_metadata = false # Contracts to track with --gas-report #gas_reports = [] +fs_permissions = [{ access = "read-write", path = "./"}] [fuzz] # Amount of runs per fuzz test diff --git a/package.json b/package.json index dfde893..b0fd05b 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "dependencies": { "ds-test": "github:dapphub/ds-test", "forge-std": "github:foundry-rs/forge-std#60acb7aaadcce2d68e52986a0a66fe79f07d138f", - "frax-standard-solidity": "github:FraxFinance/frax-standard-solidity", + "frax-standard-solidity": "github:FraxFinance/frax-standard-solidity#v1.1.3", "frax-tokens": "github:FraxFinance/frax-tokens", "solidity-bytes-utils": "github:GNSPS/solidity-bytes-utils" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 24e9aff..385604b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,8 +14,8 @@ importers: specifier: github:foundry-rs/forge-std#60acb7aaadcce2d68e52986a0a66fe79f07d138f version: https://codeload.github.com/foundry-rs/forge-std/tar.gz/60acb7aaadcce2d68e52986a0a66fe79f07d138f frax-standard-solidity: - specifier: github:FraxFinance/frax-standard-solidity - version: https://codeload.github.com/FraxFinance/frax-standard-solidity/tar.gz/edd667c2be4b455176a799cff9b932386393ef8d + specifier: github:FraxFinance/frax-standard-solidity#v1.1.3 + version: https://codeload.github.com/FraxFinance/frax-standard-solidity/tar.gz/5aab6135d727fd604f31f082fd061dd983b39b23 frax-tokens: specifier: github:FraxFinance/frax-tokens version: https://codeload.github.com/FraxFinance/frax-tokens/tar.gz/7f652a4cee786ac24feff242a05df88a981391e4(@openzeppelin/contracts-upgradeable@5.2.0(@openzeppelin/contracts@5.4.0))(hardhat-deploy@0.12.4) @@ -317,10 +317,6 @@ packages: resolution: { integrity: sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ== } - "@types/node@18.19.120": - resolution: - { integrity: sha512-WtCGHFXnVI8WHLxDAt5TbnCM4eSE+nI0QN2NJtwzcgMhht2eNz6V9evJrk+lwC8bCY8OWV5Ym8Jz7ZEyGnKnMA== } - "@types/node@24.10.1": resolution: { integrity: sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ== } @@ -786,13 +782,6 @@ packages: } version: 1.1.3 - frax-standard-solidity@https://codeload.github.com/FraxFinance/frax-standard-solidity/tar.gz/edd667c2be4b455176a799cff9b932386393ef8d: - resolution: - { - tarball: https://codeload.github.com/FraxFinance/frax-standard-solidity/tar.gz/edd667c2be4b455176a799cff9b932386393ef8d, - } - version: 1.1.0 - frax-tokens@https://codeload.github.com/FraxFinance/frax-tokens/tar.gz/7f652a4cee786ac24feff242a05df88a981391e4: resolution: { tarball: https://codeload.github.com/FraxFinance/frax-tokens/tar.gz/7f652a4cee786ac24feff242a05df88a981391e4 } @@ -1551,10 +1540,6 @@ packages: engines: { node: ">=14.17" } hasBin: true - undici-types@5.26.5: - resolution: - { integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== } - undici-types@7.16.0: resolution: { integrity: sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw== } @@ -1991,15 +1976,11 @@ snapshots: "@types/fs-extra@11.0.4": dependencies: "@types/jsonfile": 6.1.4 - "@types/node": 18.19.120 + "@types/node": 24.10.1 "@types/jsonfile@6.1.4": dependencies: - "@types/node": 18.19.120 - - "@types/node@18.19.120": - dependencies: - undici-types: 5.26.5 + "@types/node": 24.10.1 "@types/node@24.10.1": dependencies: @@ -2410,34 +2391,6 @@ snapshots: - debug - supports-color - frax-standard-solidity@https://codeload.github.com/FraxFinance/frax-standard-solidity/tar.gz/edd667c2be4b455176a799cff9b932386393ef8d: - dependencies: - "@openzeppelin/contracts": 5.4.0 - "@types/fs-extra": 11.0.4 - "@types/node": 18.19.120 - change-case: 4.1.2 - commander: 10.0.1 - date-fns: 2.30.0 - ds-test: https://codeload.github.com/dapphub/ds-test/tar.gz/e282159d5170298eb2455a6c05280ab5a73a4ef0 - forge-std: https://codeload.github.com/foundry-rs/forge-std/tar.gz/60acb7aaadcce2d68e52986a0a66fe79f07d138f - fs-extra: 11.3.0 - husky: 8.0.3 - lint-staged: 16.1.2 - prettier: 3.6.2 - prettier-plugin-solidity: 1.4.3(prettier@3.6.2) - solc: 0.8.30 - solhint: 3.6.2(typescript@5.8.3) - solhint-plugin-prettier: 0.1.0(prettier-plugin-solidity@1.4.3(prettier@3.6.2))(prettier@3.6.2) - solidity-bytes-utils: 0.8.4 - toml: 3.0.0 - ts-node: 10.9.2(@types/node@18.19.120)(typescript@5.8.3) - typescript: 5.8.3 - transitivePeerDependencies: - - "@swc/core" - - "@swc/wasm" - - debug - - supports-color - frax-tokens@https://codeload.github.com/FraxFinance/frax-tokens/tar.gz/7f652a4cee786ac24feff242a05df88a981391e4(@openzeppelin/contracts-upgradeable@5.2.0(@openzeppelin/contracts@5.4.0))(hardhat-deploy@0.12.4): dependencies: "@fraxfinance/layerzero-v2-upgradeable": https://codeload.github.com/fraxfinance/LayerZero-v2-upgradeable/tar.gz/be5ffcbd818e2e87dcd3fb30d913c1a32511489b @@ -3096,24 +3049,6 @@ snapshots: toml@3.0.0: {} - ts-node@10.9.2(@types/node@18.19.120)(typescript@5.8.3): - dependencies: - "@cspotcode/source-map-support": 0.8.1 - "@tsconfig/node10": 1.0.11 - "@tsconfig/node12": 1.0.11 - "@tsconfig/node14": 1.0.3 - "@tsconfig/node16": 1.0.4 - "@types/node": 18.19.120 - acorn: 8.15.0 - acorn-walk: 8.3.4 - arg: 4.1.3 - create-require: 1.1.1 - diff: 4.0.2 - make-error: 1.3.6 - typescript: 5.8.3 - v8-compile-cache-lib: 3.0.1 - yn: 3.1.1 - ts-node@10.9.2(@types/node@24.10.1)(typescript@5.8.3): dependencies: "@cspotcode/source-map-support": 0.8.1 @@ -3138,8 +3073,6 @@ snapshots: typescript@5.8.3: {} - undici-types@5.26.5: {} - undici-types@7.16.0: {} universalify@2.0.1: {} diff --git a/src/script/2025-11-25-Add-FrxUSD-Freezers/Base.s.sol b/src/script/2025-11-25-Add-FrxUSD-Freezers/Base.s.sol new file mode 100644 index 0000000..39b76b2 --- /dev/null +++ b/src/script/2025-11-25-Add-FrxUSD-Freezers/Base.s.sol @@ -0,0 +1,50 @@ +pragma solidity ^0.8.0; + +import { BaseScript } from "frax-std/BaseScript.sol"; +import { console } from "frax-std/FraxTest.sol"; +import { SafeTx, SafeTxHelper } from "frax-std/SafeTxHelper.sol"; + +interface ISafe { + function getOwners() external view returns (address[] memory); +} + +interface IFrxUSD { + function owner() external view returns (address); + function addFreezer(address freezer) external; +} + +// forge script src/script/2025-11-25-Add-FrxUSD-Freezers/Base.s.sol --rpc-url https://mainnet.base.org +contract AddFrxUsdFreezers is BaseScript { + address public frxUsd = 0xe5020A6d073a794B6E7f05678707dE47986Fb0b6; + + SafeTx[] internal txs; + + function run() public { + address msig = IFrxUSD(frxUsd).owner(); + address[] memory owners = ISafe(msig).getOwners(); + + for (uint256 i = 0; i < owners.length; i++) { + addFreezer(owners[i]); + } + + // dennis + addFreezer(0xC6EF452b0de9E95Ccb153c2A5A7a90154aab3419); + + // save to file + SafeTxHelper helper = new SafeTxHelper(); + helper.writeTxs( + txs, + string(abi.encodePacked(vm.projectRoot(), "/src/script/2025-11-25-Add-FrxUSD-Freezers/txs/Base.json")) + ); + } + + function addFreezer(address freezer) internal { + bytes memory data = abi.encodeCall(IFrxUSD.addFreezer, (freezer)); + + vm.prank(msig); + (bool success, ) = frxUsd.call(data); + require(success, "frxUSD: addFreezer failed"); + + txs.push(SafeTx({ name: "Add Freezer", to: frxUsd, value: 0, data: data })); + } +} diff --git a/src/script/2025-11-25-Add-FrxUSD-Freezers/Ethereum.s.sol b/src/script/2025-11-25-Add-FrxUSD-Freezers/Ethereum.s.sol new file mode 100644 index 0000000..6e09c89 --- /dev/null +++ b/src/script/2025-11-25-Add-FrxUSD-Freezers/Ethereum.s.sol @@ -0,0 +1,14 @@ +pragma solidity ^0.8.0; + +import { BaseScript } from "frax-std/BaseScript.sol"; +import { console } from "frax-std/FraxTest.sol"; +import { IFrxUSD } from "frax-tokens/contracts/ethereum/frxUSD/IFrxUSD.sol"; + +interface ISafe { + function getOwners() external view returns (address[] memory); +} + +contract AddFrxUsdFreezersEthereum is BaseScript { + address public msig = 0xB1748C79709f4Ba2Dd82834B8c82D4a505003f27; + address public frxUsd = 0xCAcd6fd266aF91b8AeD52aCCc382b4e165586E29; +} diff --git a/src/script/2025-11-25-Add-FrxUSD-Freezers/README.md b/src/script/2025-11-25-Add-FrxUSD-Freezers/README.md new file mode 100644 index 0000000..eb2e40b --- /dev/null +++ b/src/script/2025-11-25-Add-FrxUSD-Freezers/README.md @@ -0,0 +1,7 @@ +# 2025.11.25 Add frxUSD Freezers + +## Description +This directory adds the Freezer role to trusted addresses for frxUSD across multiple EVM chains. +The trusted addresses are the signers behind the multisig who has ownership over frxUSD on the respective chain, plus Dennis, for full timezone coverage. + +These scripts can be re-used in the future to add additional trusted addresses as a frxUSD Freezer. \ No newline at end of file diff --git a/src/script/2025-11-25-Add-FrxUSD-Freezers/txs/Base.json b/src/script/2025-11-25-Add-FrxUSD-Freezers/txs/Base.json new file mode 100644 index 0000000..205e783 --- /dev/null +++ b/src/script/2025-11-25-Add-FrxUSD-Freezers/txs/Base.json @@ -0,0 +1,53 @@ +{ + "chainId": 8453, + "createdAt": 1764110293000, + "meta": { + "description": "", + "name": "Transactions Batch" + }, + "transactions": [ + { + "data": "0x526606c900000000000000000000000013fe84d36d7a507bb4bdac6dcaf13a10961fc470", + "operation": 0, + "to": "0xe5020A6d073a794B6E7f05678707dE47986Fb0b6", + "value": "0" + }, + { + "data": "0x526606c900000000000000000000000017e06ce6914e3969f7bd37d8b2a563890ca1c96e", + "operation": 0, + "to": "0xe5020A6d073a794B6E7f05678707dE47986Fb0b6", + "value": "0" + }, + { + "data": "0x526606c90000000000000000000000008d8290d49e88d16d81c6adf6c8774ed88762274a", + "operation": 0, + "to": "0xe5020A6d073a794B6E7f05678707dE47986Fb0b6", + "value": "0" + }, + { + "data": "0x526606c9000000000000000000000000cbc616d595d38483e6adc45c7e426f44bf230928", + "operation": 0, + "to": "0xe5020A6d073a794B6E7f05678707dE47986Fb0b6", + "value": "0" + }, + { + "data": "0x526606c9000000000000000000000000381e2495e683868f693aa5b1414f712f21d34b40", + "operation": 0, + "to": "0xe5020A6d073a794B6E7f05678707dE47986Fb0b6", + "value": "0" + }, + { + "data": "0x526606c90000000000000000000000006e74053a3798e0fc9a9775f7995316b27f21c4d2", + "operation": 0, + "to": "0xe5020A6d073a794B6E7f05678707dE47986Fb0b6", + "value": "0" + }, + { + "data": "0x526606c9000000000000000000000000c6ef452b0de9e95ccb153c2a5a7a90154aab3419", + "operation": 0, + "to": "0xe5020A6d073a794B6E7f05678707dE47986Fb0b6", + "value": "0" + } + ], + "version": "1.0" +} diff --git a/src/test/Counter/TestIncrement.t.sol b/src/test/Counter/TestIncrement.t.sol deleted file mode 100644 index d5e2ae0..0000000 --- a/src/test/Counter/TestIncrement.t.sol +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.19; - -import "frax-std/FraxTest.sol"; -import "src/contracts/Counter.sol"; - -contract TestIncrement is FraxTest { - Counter public counter; - - function defaultSetup() public returns (uint256 _snapshotId) { - counter = new Counter(); - counter.setNumber(0); - _snapshotId = vm.snapshot(); - } - - function anotherSetup() public returns (uint256 _snapshotId) { - counter = new Counter(); - counter.setNumber(50); - _snapshotId = vm.snapshot(); - } - - function setUp() public { - uint256 _original = vm.snapshot(); - snapShotIds.push(defaultSetup()); - vm.revertTo(_original); - snapShotIds.push(anotherSetup()); - } - - function testIncrement() public useMultipleSetupFunctions { - counter.increment(); - assertEq(counter.number(), 51); - } -} diff --git a/src/test/Counter/TestSetNumber.t.sol b/src/test/Counter/TestSetNumber.t.sol deleted file mode 100644 index 2e5282c..0000000 --- a/src/test/Counter/TestSetNumber.t.sol +++ /dev/null @@ -1,30 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.19; - -import "frax-std/FraxTest.sol"; -import "src/contracts/Counter.sol"; - -contract TestIncrement is FraxTest { - Counter public counter; - - function setUp() public { - setupFunctions.push(defaultSetup); - setupFunctions.push(anotherSetup); - addSetupFunctions(setupFunctions); - } - - function defaultSetup() public { - counter = new Counter(); - counter.setNumber(0); - } - - function anotherSetup() public { - counter = new Counter(); - counter.setNumber(50); - } - - function testSetNumber(uint256 x) public useMultipleSetupFunctions { - counter.setNumber(x); - assertEq(counter.number(), x); - } -}