Skip to content

Commit

Permalink
test: coverage for SIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiTimesChi committed Dec 6, 2024
1 parent 4843d57 commit 4106cd5
Show file tree
Hide file tree
Showing 6 changed files with 552 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
pragma solidity ^0.8.17;

import {IDefaultPool} from "./IDefaultPool.sol";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
pragma solidity ^0.8.17;

interface IDefaultPool {
function swap(
Expand Down
3 changes: 3 additions & 0 deletions packages/contracts-rfq/test/harnesses/ZapDataV1Harness.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ pragma solidity 0.8.24;
import {ZapDataV1} from "../../contracts/libs/ZapDataV1.sol";

contract ZapDataV1Harness {
uint16 public constant VERSION = ZapDataV1.VERSION;
uint16 public constant AMOUNT_NOT_PRESENT = ZapDataV1.AMOUNT_NOT_PRESENT;

function validateV1(bytes calldata encodedZapData) public pure {
ZapDataV1.validateV1(encodedZapData);
}
Expand Down
55 changes: 55 additions & 0 deletions packages/contracts-rfq/test/mocks/DefaultPoolMock.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import {IDefaultPool} from "../../contracts/legacy/router/interfaces/IDefaultPool.sol";

// solhint-disable no-empty-blocks
contract DefaultPoolMock is IDefaultPool {
uint8 private constant TOKENS = 3;

/// @notice We include an empty "test" function so that this contract does not appear in the coverage report.
function testDefaultPoolMock() external {}

function swap(
uint8 tokenIndexFrom,
uint8 tokenIndexTo,
uint256 dx,
uint256 minDy,
uint256 deadline
)
external
returns (uint256 amountOut)
{}

function calculateSwap(
uint8 tokenIndexFrom,
uint8 tokenIndexTo,
uint256 dx
)
external
view
returns (uint256 amountOut)
{}

function swapStorage()
external
view
returns (
uint256 initialA,
uint256 futureA,
uint256 initialATime,
uint256 futureATime,
uint256 swapFee,
uint256 adminFee,
address lpToken
)
{}

function getToken(uint8 index) external pure returns (address token) {
if (index < TOKENS) {
// Will be overridden by vm.mockCall
return address(uint160(1 + index));
}
revert("Token does not exist");
}
}
20 changes: 20 additions & 0 deletions packages/contracts-rfq/test/mocks/SwapQuoterMock.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import {ISwapQuoter, LimitedToken, SwapQuery} from "../../contracts/legacy/rfq/interfaces/ISwapQuoter.sol";

// solhint-disable no-empty-blocks
contract SwapQuoterMock is ISwapQuoter {
/// @notice We include an empty "test" function so that this contract does not appear in the coverage report.
function testSwapQuoterMock() external {}

function getAmountOut(
LimitedToken memory tokenIn,
address tokenOut,
uint256 amountIn
)
external
view
returns (SwapQuery memory query)
{}
}
Loading

0 comments on commit 4106cd5

Please sign in to comment.