datahaven/contracts/test/mocks/AllocationManagerMock.sol
Steve Degosserie 387c056912
fix: Resolve Foundry build errors and apply code formatting (#241)
## Summary

Fixes the CI build failure in the `task-ts-build` workflow caused by
Foundry v1.4.2's Solar linter not being able to resolve Snowbridge's
context-specific import remappings.

## Problem

The Snowbridge submodule uses context-specific remappings (prefixed with
`:`) for its dependencies:
- `lib/snowbridge/contracts/:openzeppelin/` → OpenZeppelin contracts
- `lib/snowbridge/contracts/:prb/math/` → PRB Math library

Foundry v1.4.2's Solar linter doesn't understand these context-specific
remappings and fails with errors like:
```
error: file openzeppelin/utils/cryptography/MerkleProof.sol not found
error: file prb/math/src/UD60x18.sol not found
```

## Solution

Added global remappings that the linter can understand:
```toml
"openzeppelin/=lib/snowbridge/contracts/lib/openzeppelin-contracts/contracts/",
"prb/math/=lib/snowbridge/contracts/lib/prb-math/",
```

### Why This Works
- The linter can now resolve `openzeppelin/` and `prb/math/` imports
globally
- These global remappings take **lower precedence** than
context-specific ones during compilation
- The compiler still uses the context-specific remappings (with `:`)
when compiling Snowbridge contracts
- The linter uses the global remappings when checking all files

## Changes

### Commit 1: Add global remappings
- `contracts/foundry.toml`: Added 2 global remapping entries

### Commit 2: Apply forge fmt
- Applied automatic formatting via `forge fmt` to ensure code style
consistency
- Multi-line formatting for long import statements and function
signatures
- No functional changes - purely formatting updates

## Testing

 Local build succeeds with `forge build`
 No Snowbridge import resolution errors
 `forge fmt --check` passes with no formatting issues
 Only linting notes/warnings remain (not errors)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-20 11:20:59 +03:00

190 lines
5.6 KiB
Solidity

// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.27;
import {
IAllocationManager,
OperatorSet
} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol";
import {IAVSRegistrar} from "eigenlayer-contracts/src/contracts/interfaces/IAVSRegistrar.sol";
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
import {IPauserRegistry} from "eigenlayer-contracts/src/contracts/interfaces/IPauserRegistry.sol";
contract AllocationManagerIntermediate is IAllocationManager {
function initialize(
address initialOwner,
uint256 initialPausedStatus
) external virtual {}
function slashOperator(
address avs,
SlashingParams calldata params
) external virtual {}
function modifyAllocations(
address operator,
AllocateParams[] calldata params
) external virtual {}
function clearDeallocationQueue(
address operator,
IStrategy[] calldata strategies,
uint16[] calldata numToClear
) external virtual {}
function registerForOperatorSets(
address operator,
RegisterParams calldata params
) external virtual {}
function deregisterFromOperatorSets(
DeregisterParams calldata params
) external virtual {}
function setAllocationDelay(
address operator,
uint32 delay
) external virtual {}
function setAVSRegistrar(
address avs,
IAVSRegistrar registrar
) external virtual {}
function updateAVSMetadataURI(
address avs,
string calldata metadataURI
) external virtual {}
function createOperatorSets(
address avs,
CreateSetParams[] calldata params
) external virtual {}
function addStrategiesToOperatorSet(
address avs,
uint32 operatorSetId,
IStrategy[] calldata strategies
) external virtual {}
function removeStrategiesFromOperatorSet(
address avs,
uint32 operatorSetId,
IStrategy[] calldata strategies
) external virtual {}
function getOperatorSetCount(
address avs
) external view virtual returns (uint256) {}
function getAllocatedSets(
address operator
) external view virtual returns (OperatorSet[] memory) {}
function getAllocatedStrategies(
address operator,
OperatorSet memory operatorSet
) external view virtual returns (IStrategy[] memory) {}
function getAllocation(
address operator,
OperatorSet memory operatorSet,
IStrategy strategy
) external view virtual returns (Allocation memory) {}
function getAllocations(
address[] memory operators,
OperatorSet memory operatorSet,
IStrategy strategy
) external view virtual returns (Allocation[] memory) {}
function getStrategyAllocations(
address operator,
IStrategy strategy
) external view virtual returns (OperatorSet[] memory, Allocation[] memory) {}
function getAllocatableMagnitude(
address operator,
IStrategy strategy
) external view virtual returns (uint64) {}
function getMaxMagnitude(
address operator,
IStrategy strategy
) external view virtual returns (uint64) {}
function getMaxMagnitudes(
address operator,
IStrategy[] calldata strategies
) external view virtual returns (uint64[] memory) {}
function getMaxMagnitudes(
address[] calldata operators,
IStrategy strategy
) external view virtual returns (uint64[] memory) {}
function getMaxMagnitudesAtBlock(
address operator,
IStrategy[] calldata strategies,
uint32 blockNumber
) external view virtual returns (uint64[] memory) {}
function getAllocationDelay(
address operator
) external view virtual returns (bool isSet, uint32 delay) {}
function getRegisteredSets(
address operator
) external view virtual returns (OperatorSet[] memory operatorSets) {}
function isOperatorSet(
OperatorSet memory operatorSet
) external view virtual returns (bool) {}
function getMembers(
OperatorSet memory operatorSet
) external view virtual returns (address[] memory operators) {}
function getMemberCount(
OperatorSet memory operatorSet
) external view virtual returns (uint256) {}
function getAVSRegistrar(
address avs
) external view virtual returns (IAVSRegistrar) {}
function getStrategiesInOperatorSet(
OperatorSet memory operatorSet
) external view virtual returns (IStrategy[] memory strategies) {}
function getMinimumSlashableStake(
OperatorSet memory operatorSet,
address[] memory operators,
IStrategy[] memory strategies,
uint32 futureBlock
) external view virtual returns (uint256[][] memory slashableStake) {}
function isMemberOfOperatorSet(
address operator,
OperatorSet memory operatorSet
) external view virtual returns (bool) {}
function version() external view override returns (string memory) {}
function getEncumberedMagnitude(
address operator,
IStrategy strategy
) external view override returns (uint64) {}
function getAllocatedStake(
OperatorSet memory operatorSet,
address[] memory operators,
IStrategy[] memory strategies
) external view override returns (uint256[][] memory slashableStake) {}
function isOperatorSlashable(
address operator,
OperatorSet memory operatorSet
) external view override returns (bool) {}
}
contract AllocationManagerMock is AllocationManagerIntermediate {}