@@ -18,7 +18,7 @@ import {AmountCap, AmountCapLib} from "evk/EVault/shared/types/AmountCap.sol";
1818import {IEVC} from "ethereum-vault-connector/interfaces/IEthereumVaultConnector.sol " ;
1919import {IEVault, IGovernance} from "evk/EVault/IEVault.sol " ;
2020import {EulerRouter, Governable} from "euler-price-oracle/EulerRouter.sol " ;
21- import {SafeTransaction} from "./SafeUtils.s.sol " ;
21+ import {SafeTransaction, SafeUtil } from "./SafeUtils.s.sol " ;
2222import {BaseFactory} from "../../src/BaseFactory/BaseFactory.sol " ;
2323import {SnapshotRegistry} from "../../src/SnapshotRegistry/SnapshotRegistry.sol " ;
2424import {BasePerspective} from "../../src/Perspectives/implementation/BasePerspective.sol " ;
@@ -407,7 +407,7 @@ abstract contract ScriptUtils is
407407 TokenAddresses internal tokenAddresses;
408408 GovernorAddresses internal governorAddresses;
409409 EulerSwapAddresses internal eulerSwapAddresses;
410- uint256 internal safeNonce = getSafeNonce () ;
410+ uint256 internal safeNonce;
411411
412412 constructor () {
413413 multisigAddresses = deserializeMultisigAddresses (getAddressesJson ("MultisigAddresses.json " ));
@@ -419,6 +419,12 @@ abstract contract ScriptUtils is
419419 governorAddresses = deserializeGovernorAddresses (getAddressesJson ("GovernorAddresses.json " ));
420420 eulerSwapAddresses = deserializeEulerSwapAddresses (getAddressesJson ("EulerSwapAddresses.json " ));
421421 deserializeBridgeConfigCache (getBridgeConfigCacheJson ("BridgeConfigCache.json " ));
422+
423+ safeNonce = getSafeNonce ();
424+ if (safeNonce == 0 ) {
425+ SafeUtil util = new SafeUtil ();
426+ safeNonce = util.getNextNonce (getSafe ());
427+ }
422428 }
423429
424430 modifier broadcast () {
@@ -944,8 +950,6 @@ abstract contract BatchBuilder is ScriptUtils {
944950
945951 dumpBatch (safe);
946952
947- safeNonce = safeNonce == 0 ? transaction.getNextNonce (safe) : safeNonce;
948-
949953 if (timelock == address (0 ) || ! allowTimelock) {
950954 console.log ("Executing the batch via Safe (%s) using the EVC (%s)\n " , safe, coreAddresses.evc);
951955 transaction.create (true , safe, coreAddresses.evc, getBatchValue (), getBatchCalldata (), safeNonce++ );
0 commit comments