@@ -60,6 +60,62 @@ const ALLOW_UNLIMITED_CONTRACT_SIZE =
6060const DEVNET_RPC_URL = process . env . DEVNET_RPC_URL ||
6161 "http://localhost:8545" ;
6262
63+ const DEFAULT_SOLIDITY_COMPILER = {
64+ version : "0.8.20" ,
65+ settings : {
66+ optimizer : {
67+ enabled : true ,
68+ runs : 200 , // Optimized for frequent function calls
69+ details : {
70+ yul : true ,
71+ yulDetails : {
72+ stackAllocation : true ,
73+ } ,
74+ } ,
75+ } ,
76+ viaIR : true , // Preserve IR-based code generation in every build profile.
77+ evmVersion : "paris" ,
78+ metadata : {
79+ bytecodeHash : "ipfs" ,
80+ useLiteralContent : true ,
81+ } ,
82+ } ,
83+ } ;
84+
85+ const SIZE_OPTIMIZED_SOLIDITY_COMPILER = {
86+ version : "0.8.20" ,
87+ settings : {
88+ optimizer : {
89+ enabled : true ,
90+ runs : 1 ,
91+ details : {
92+ yul : true ,
93+ yulDetails : {
94+ stackAllocation : true ,
95+ } ,
96+ } ,
97+ } ,
98+ viaIR : true ,
99+ evmVersion : "paris" ,
100+ metadata : {
101+ bytecodeHash : "none" ,
102+ useLiteralContent : false ,
103+ appendCBOR : false ,
104+ } ,
105+ } ,
106+ } ;
107+
108+ const SIZE_OPTIMIZED_SOLIDITY_OVERRIDES = {
109+ // Size-optimized override for the institutional bridge to stay under EIP-170
110+ // without altering runtime behavior or ABI.
111+ "contracts/InstitutionalStablecoinBridge.sol" : SIZE_OPTIMIZED_SOLIDITY_COMPILER ,
112+ // Size-optimized override for Cruzible to stay under EIP-170 without
113+ // changing runtime behavior or ABI. This contract concentrates multiple
114+ // staking and attestation flows, so we optimize deployment size rather
115+ // than risk a late-stage logic split.
116+ "contracts/vault/Cruzible.sol" : SIZE_OPTIMIZED_SOLIDITY_COMPILER ,
117+ } ;
118+
63119// ============================================================================
64120// Hardhat Configuration
65121// ============================================================================
@@ -79,79 +135,14 @@ const config = defineConfig({
79135 "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol" ,
80136 "@openzeppelin/contracts/governance/TimelockController.sol" ,
81137 ] ,
82- compilers : [
83- {
84- version : "0.8.20" ,
85- settings : {
86- optimizer : {
87- enabled : true ,
88- runs : 200 , // Optimized for frequent function calls
89- details : {
90- yul : true ,
91- yulDetails : {
92- stackAllocation : true ,
93- } ,
94- } ,
95- } ,
96- viaIR : true , // Enable IR-based code generation for better optimization
97- evmVersion : "paris" , // Latest stable EVM version
98- metadata : {
99- bytecodeHash : "ipfs" , // Use IPFS for metadata hash
100- useLiteralContent : true ,
101- } ,
102- } ,
103- } ,
104- ] ,
105- overrides : {
106- // Size-optimized override for the institutional bridge to stay under EIP-170
107- // without altering runtime behavior or ABI.
108- "contracts/InstitutionalStablecoinBridge.sol" : {
109- version : "0.8.20" ,
110- settings : {
111- optimizer : {
112- enabled : true ,
113- runs : 1 ,
114- details : {
115- yul : true ,
116- yulDetails : {
117- stackAllocation : true ,
118- } ,
119- } ,
120- } ,
121- viaIR : true ,
122- evmVersion : "paris" ,
123- metadata : {
124- bytecodeHash : "none" ,
125- useLiteralContent : false ,
126- appendCBOR : false ,
127- } ,
128- } ,
138+ profiles : {
139+ default : {
140+ compilers : [ DEFAULT_SOLIDITY_COMPILER ] ,
141+ overrides : SIZE_OPTIMIZED_SOLIDITY_OVERRIDES ,
129142 } ,
130- // Size-optimized override for Cruzible to stay under EIP-170 without
131- // changing runtime behavior or ABI. This contract concentrates multiple
132- // staking and attestation flows, so we optimize deployment size rather
133- // than risk a late-stage logic split.
134- "contracts/vault/Cruzible.sol" : {
135- version : "0.8.20" ,
136- settings : {
137- optimizer : {
138- enabled : true ,
139- runs : 1 ,
140- details : {
141- yul : true ,
142- yulDetails : {
143- stackAllocation : true ,
144- } ,
145- } ,
146- } ,
147- viaIR : true ,
148- evmVersion : "paris" ,
149- metadata : {
150- bytecodeHash : "none" ,
151- useLiteralContent : false ,
152- appendCBOR : false ,
153- } ,
154- } ,
143+ production : {
144+ compilers : [ DEFAULT_SOLIDITY_COMPILER ] ,
145+ overrides : SIZE_OPTIMIZED_SOLIDITY_OVERRIDES ,
155146 } ,
156147 } ,
157148 } ,
0 commit comments