Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
642375a
feat: add generic swapper contract
kkirka Aug 28, 2025
e2312fa
feat: add backend signature verification to the swapper
kkirka Oct 3, 2025
2981707
feat: add SwapRouter contract
Debugger022 Oct 17, 2025
fbc3044
test: add unit test for SwapRouter
Debugger022 Oct 22, 2025
82082ba
feat: add deployment script
Debugger022 Oct 24, 2025
3417be5
feat: add SwapRouter fork test
Debugger022 Oct 28, 2025
f487c79
fix: fix comments
Debugger022 Nov 19, 2025
f2459c8
fix: major fixes
Debugger022 Nov 20, 2025
e21d01b
fix: fix unit and fork test
Debugger022 Nov 20, 2025
85f2930
Merge branch 'feat/swapper' into feat/swapRouter
Debugger022 Nov 20, 2025
e233965
Merge branch 'develop' into feat/swapRouter-develop-merge
Exef Dec 15, 2025
215a735
test: update unit test for swapRouter
Debugger022 Dec 18, 2025
059cd0a
Merge pull request #31 from VenusProtocol/feat/swapRouter-develop-merge
Debugger022 Dec 19, 2025
a5bf806
fix: tests
Debugger022 Dec 19, 2025
e6add02
test: update swapRouter fork tests
Debugger022 Dec 19, 2025
9f06257
feat: add swapRouter bscmainnet deployment
Debugger022 Dec 23, 2025
de928dd
feat: updating deployment files
Debugger022 Dec 23, 2025
4487e12
feat: add swapNativeAndRepayFull function
Debugger022 Dec 24, 2025
594b4ff
feat: L-01
Debugger022 Jan 12, 2026
aeb20e1
feat: L-05
Debugger022 Jan 12, 2026
f042ecd
refactor: consolidate slippage check in repayFull
Debugger022 Jan 13, 2026
0f8abbe
feat: I-01
Debugger022 Jan 15, 2026
50a4993
feat: add SwapRouter audits
Debugger022 Jan 21, 2026
f949020
Merge pull request #45 from VenusProtocol/fix/VPD-458
Debugger022 Jan 21, 2026
6b3774d
Merge pull request #43 from VenusProtocol/fix/vpd-440
Debugger022 Jan 21, 2026
d1d28c0
feat: add deployments
Debugger022 Jan 21, 2026
41bb9e0
feat: updating deployment files
Debugger022 Jan 21, 2026
ec44ad8
Merge branch 'develop' into feat/swapRouter
Debugger022 Feb 23, 2026
1db1685
feat: add barrel Interfaces.sol to re-export split interface files
Debugger022 Feb 23, 2026
8de1ccf
feat: updating deployment files
Debugger022 Feb 23, 2026
65165ef
chore: clean up .gitignore duplicates and organize sections
Debugger022 Feb 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 44 additions & 37 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,66 +1,73 @@
node_modules
node_modules_tmp
.env
coverage
coverage.json
typechain
.openzeppelin
#Hardhat files
secrets.json

# Hardhat
cache
cache-zk
artifacts
artifacts-zk
typechain
.openzeppelin

#Compound
allFiredEvents
.build-temp
# Coverage
coverage
coverage.json
coverageEnv

# Build
dist
docs
build
build_
node_modules
.env
.build
.build-temp
.tsbuilt

# Certora
.certora*
certora_*
coverage/
coverage.json
coverageEnv/
emv-*/
formulas/
outputs/
Reports/
scTopics
test-results.xml
.tsbuilt
yarn-error.log
scenario/build/webpack.js
.scencache
.solcache
.solcachecov
scenario/.tscache
script/certora

# Tests
test-results.xml
junit.xml
allFiredEvents
tests/scenarios/
tests/Scenarios/
junit.xml
.build
.last_confs
node_modules_tmp
.idea

secrets.json
# Solidity
.solcache
.solcachecov
formulas
outputs
Reports
scTopics

# Scenario
scenario/build/webpack.js
scenario/.tscache
.scencache
emv-*/

# yarn
# Yarn
yarn-error.log
.yarn/*
!.yarn/patches
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions

# Build
dist
docs

# Generated/External
contracts/oracle/*
contracts/generated
deployments/localhost

# IDE
.idea
.last_confs

# OSX
.DS_Store
Binary file added audits/165_SwapRouter_Pashov_20260118.pdf
Binary file not shown.
Binary file added audits/166_SwapRouter_Cyfrin_20260120.pdf
Binary file not shown.
9 changes: 9 additions & 0 deletions contracts/Interfaces.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.25;

import { IVToken } from "./Interfaces/IVToken.sol";
import { IComptroller } from "./Interfaces/IComptroller.sol";
import { IVBNB } from "./Interfaces/IVBNB.sol";
import { IWBNB } from "./Interfaces/IWBNB.sol";
import { IFlashLoanReceiver } from "./Interfaces/IFlashLoanReceiver.sol";
import { IProtocolShareReserve } from "./Interfaces/IProtocolShareReserve.sol";
2 changes: 2 additions & 0 deletions contracts/Interfaces/IVBNB.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ pragma solidity ^0.8.25;
import { IVToken } from "../Interfaces/IVToken.sol";

interface IVBNB is IVToken {
function mint() external payable;

function repayBorrowBehalf(address borrower) external payable;

function liquidateBorrow(address borrower, IVToken vTokenCollateral) external payable;
Expand Down
97 changes: 97 additions & 0 deletions contracts/SwapRouter/ISwapRouter.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.28;

/**
* @title ISwapRouter
* @author Venus Protocol
* @notice Interface for the SwapRouter contract implementing swap features
*/
interface ISwapRouter {
/**
* @notice Swaps tokens and supplies the result to a Venus market
* @param vToken The vToken market to supply to
* @param tokenIn The input token to swap from
* @param amountIn The amount of input tokens to swap
* @param minAmountOut The minimum amount of output tokens expected
* @param swapCallData Array of bytes containing swap instructions
* @custom:event Emits SwapAndSupply event
*/
function swapAndSupply(
address vToken,
address tokenIn,
uint256 amountIn,
uint256 minAmountOut,
bytes calldata swapCallData
) external payable;

/**
* @notice Swaps native tokens (BNB) and supplies to a Venus market
* @param vToken The vToken market to supply to
* @param minAmountOut The minimum amount of output tokens expected
* @param swapCallData Array of bytes containing swap instructions
* @custom:event Emits SwapAndSupply event
*/
function swapNativeAndSupply(address vToken, uint256 minAmountOut, bytes calldata swapCallData) external payable;

/**
* @notice Swaps tokens and repays debt to a Venus market
* @param vToken The vToken market to repay debt to
* @param tokenIn The input token to swap from
* @param amountIn The amount of input tokens to swap
* @param minAmountOut The minimum amount of output tokens expected
* @param swapCallData Array of bytes containing swap instructions
* @custom:event Emits SwapAndRepay event
*/
function swapAndRepay(
address vToken,
address tokenIn,
uint256 amountIn,
uint256 minAmountOut,
bytes calldata swapCallData
) external payable;

/**
* @notice Swaps native tokens and repays debt to a Venus market
* @param vToken The vToken market to repay debt to
* @param minAmountOut The minimum amount of output tokens expected
* @param swapCallData Array of bytes containing swap instructions
* @custom:event Emits SwapAndRepay event
*/
function swapNativeAndRepay(address vToken, uint256 minAmountOut, bytes calldata swapCallData) external payable;

/**
* @notice Swaps tokens and repays the full debt for a user
* @param vToken The vToken market to repay full debt to
* @param tokenIn The input token to swap from
* @param maxAmountIn The maximum amount of input tokens to use
* @param swapCallData Array of bytes containing swap instructions
* @custom:event Emits SwapAndRepay event
*/
function swapAndRepayFull(
address vToken,
address tokenIn,
uint256 maxAmountIn,
bytes calldata swapCallData
) external payable;

/**
* @notice Swaps native tokens and repays the full debt for a user
* @param vToken The vToken market to repay full debt to
* @param swapCallData Array of bytes containing swap instructions
* @custom:event Emits SwapAndRepay event
*/
function swapNativeAndRepayFull(address vToken, bytes calldata swapCallData) external payable;

/**
* @notice Sweeps leftover ERC-20 tokens from the contract
* @param token The token to sweep
* @custom:event Emits SweepToken event
*/
function sweepToken(address token) external;

/**
* @notice Sweeps leftover native tokens from the contract
* @custom:event Emits SweepNative event
*/
function sweepNative() external;
}
Loading
Loading