From 44f585363ef93a259ad4950d72291d1d40438225 Mon Sep 17 00:00:00 2001 From: engn33r Date: Wed, 18 Mar 2026 00:00:00 +0000 Subject: [PATCH 1/5] Add missing addresses to docs --- docs/developers/addresses/core-contracts.md | 1 - docs/developers/addresses/v3-contracts.md | 6 ++++++ src/ethereum/constants.ts | 5 ++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/developers/addresses/core-contracts.md b/docs/developers/addresses/core-contracts.md index 23c09e61c..f415af520 100644 --- a/docs/developers/addresses/core-contracts.md +++ b/docs/developers/addresses/core-contracts.md @@ -78,7 +78,6 @@ See all stYFI contracts [on this page](./styfi-contracts.md) | --------------------- | ------------------------------------------ | | kChad multisig | [0xe6ad5A88f5da0F276C903d9Ac2647A937c917162](https://katanascan.com/address/0xe6ad5A88f5da0F276C903d9Ac2647A937c917162) | | Strategist multisig | [0xBe7c7efc1ef3245d37E3157F76A512108D6D7aE6](https://katanascan.com/address/0xBe7c7efc1ef3245d37E3157F76A512108D6D7aE6) | -| V3 multisig | [0x33333333D5eFb92f19a5F94a43456b3cec2797AE](https://katanascan.com/address/0x33333333D5eFb92f19a5F94a43456b3cec2797AE) | | Timelock | [0x88Ba032be87d5EF1fbE87336B7090767F367BF73](https://katanascan.com/address/0x88Ba032be87d5EF1fbE87336B7090767F367BF73) | | Timelock Executor | [0xF8f60BF9456A6e0141149Db2DD6f02C60da5779B](https://katanascan.com/address/0xF8f60BF9456A6e0141149Db2DD6f02C60da5779B) | diff --git a/docs/developers/addresses/v3-contracts.md b/docs/developers/addresses/v3-contracts.md index b86af9932..05f684003 100644 --- a/docs/developers/addresses/v3-contracts.md +++ b/docs/developers/addresses/v3-contracts.md @@ -66,7 +66,9 @@ All generic periphery contracts and factories can be retrieved on chain from the | **Debt Allocator Factory**
| | | **Registry Factory**
| | | **Splitter Factory**
| | +| **Auction Registry**
| | | **Auction Factory**
| | +| **Dumper**
| | | **Keeper**
| | | **Base Fee Provider**
| | @@ -84,6 +86,7 @@ These addresses are consistent across all EVM chains. | Name / ENS | Contract Address | | ---------------------- | ---------------------- | +| **V3 Deployer Multisig**
registry.v3.ychad.eth | | | **Current V3 Registry**
registry.v3.ychad.eth | | | **Legacy V3 Registry**
| | @@ -95,6 +98,7 @@ Ethereum-specific Yearn addresses | ---------------------- | ---------------------- | | **Role Manager**
role-manager.v3.ychad.eth | | | **Accountant**
accountant.v3.ychad.eth | | +| **Debt Allocator**
| | ### Optimism (10) Addresses @@ -122,6 +126,7 @@ Base-specific Yearn addresses | ---------------------- | ---------------------- | | **Role Manager**
| | | **Accountant**
| | +| **Debt Allocator**
| | ### Arbitrum (42161) Addresses @@ -131,6 +136,7 @@ Arbitrum-specific Yearn addresses | ---------------------- | ---------------------- | | **Role Manager**
| | | **Accountant**
| | +| **Debt Allocator**
| | ### Katana (747474) Addresses diff --git a/src/ethereum/constants.ts b/src/ethereum/constants.ts index 2d46c00e0..49108bd23 100644 --- a/src/ethereum/constants.ts +++ b/src/ethereum/constants.ts @@ -185,7 +185,9 @@ export const protocolPeriphery = { aprOracle: '0x1981AD9F44F2EA9aDd2dC4AD7D075c102C70aF92', baseFeeProvider: '0xe0514dd71cfdc30147e76f65c30bdf60bfd437c3', commonReportTrigger: '0xf8dF17a35c88AbB25e83C92f9D293B4368b9D52D', - auctionFactory: '0xbC587a495420aBB71Bbd40A0e291B64e80117526', + auctionRegistry: '0x94F44706A61845a4f9e59c4Bc08cEA4503e48D12', + auctionFactory: '0xbA7FCb508c7195eE5AE823F37eE2c11D7ED52F8e', + dumper: '0x590Dd9399bB53f1085097399C3265C7137c1C4Cf', splitterFactory: '0xe28fCC9FB2998ba57754789F6666DAa8C815614D', registryFactory: '0x3A0fa8aac82aD94048098D6af6e8eB36c98816A1', debtAllocatorFactory: '0x03D43dF6FF894C848fC6F1A0a7E8a539Ef9A4C18', @@ -198,6 +200,7 @@ export const protocolPeriphery = { * Queried from the Yearn Role Manager */ export const yearnV3ContractsStable = { + v3Deployer: '0x33333333D5eFb92f19a5F94a43456b3cec2797AE', registryENS: 'registry.v3.ychad.eth', registry: '0xd40ecF29e001c76Dcc4cC0D9cd50520CE845B038', legacyRegistry1: '0xff31A1B020c868F6eA3f61Eb953344920EeCA3af', From 2b1bb2534650ea24f19d038c01c2ca98826994a0 Mon Sep 17 00:00:00 2001 From: engn33r Date: Wed, 18 Mar 2026 00:00:00 +0000 Subject: [PATCH 2/5] Add address to check scripts --- src/ethereum/ABIs/accountantABI.ts | 9 ++++++ src/ethereum/ABIs/auctionRegistryABI.ts | 9 ++++++ src/ethereum/ABIs/index.ts | 2 ++ src/ethereum/v3Calls.ts | 38 +++++++++++++++++++++++++ src/ethereum/v3Checks.ts | 37 ++++++++++++++++++++++-- 5 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 src/ethereum/ABIs/accountantABI.ts create mode 100644 src/ethereum/ABIs/auctionRegistryABI.ts diff --git a/src/ethereum/ABIs/accountantABI.ts b/src/ethereum/ABIs/accountantABI.ts new file mode 100644 index 000000000..6e5e66fb5 --- /dev/null +++ b/src/ethereum/ABIs/accountantABI.ts @@ -0,0 +1,9 @@ +export const accountantABI = [ + { + stateMutability: 'view', + type: 'function', + name: 'feeRecipient', + inputs: [], + outputs: [{ name: '', type: 'address' }], + }, +] as const diff --git a/src/ethereum/ABIs/auctionRegistryABI.ts b/src/ethereum/ABIs/auctionRegistryABI.ts new file mode 100644 index 000000000..1f0b37f9e --- /dev/null +++ b/src/ethereum/ABIs/auctionRegistryABI.ts @@ -0,0 +1,9 @@ +export const auctionRegistryABI = [ + { + stateMutability: 'view', + type: 'function', + name: 'getLatestFactory', + inputs: [], + outputs: [{ name: '', type: 'address' }], + }, +] as const diff --git a/src/ethereum/ABIs/index.ts b/src/ethereum/ABIs/index.ts index ab19c5d7e..e226bca5f 100644 --- a/src/ethereum/ABIs/index.ts +++ b/src/ethereum/ABIs/index.ts @@ -16,3 +16,5 @@ export * from './veyfiABI' export * from './yPoolsGenericGovernorABI' export * from './yPoolsInclusionVoteABI' export * from './gnosisSafeABI' +export * from './auctionRegistryABI' +export * from './accountantABI' diff --git a/src/ethereum/v3Calls.ts b/src/ethereum/v3Calls.ts index 0be640a66..5cfcef677 100644 --- a/src/ethereum/v3Calls.ts +++ b/src/ethereum/v3Calls.ts @@ -5,6 +5,8 @@ import { v3VaultFactoryABI, yearnV3RoleManagerABI, v3VaultFactoryBlueprintABI, + auctionRegistryABI, + accountantABI, } from './ABIs' import { V3ReleaseDataMap } from './types' @@ -159,3 +161,39 @@ export const readYearnRoleManager = async ( yearnRegistry, } } + +export const getAuctionFactoryFromRegistry = async ( + auctionRegistryAddress: Address, + publicClient: PublicClient +) => { + const contract = getContract({ + address: auctionRegistryAddress, + abi: auctionRegistryABI, + client: publicClient, + }) + console.log('Fetching auction factory from auction registry...') + const auctionFactory = await contract.read.getLatestFactory().catch(() => { + console.warn('auctionFactory not found in auction registry') + return undefined + }) + console.log('Auction factory address fetched from registry.') + return auctionFactory +} + +export const getFeeRecipientFromAccountant = async ( + accountantAddress: Address, + publicClient: PublicClient +) => { + const contract = getContract({ + address: accountantAddress, + abi: accountantABI, + client: publicClient, + }) + console.log('Fetching fee recipient from accountant...') + const feeRecipient = await contract.read.feeRecipient().catch(() => { + console.warn('feeRecipient not found in accountant') + return undefined + }) + console.log('Fee recipient address fetched from accountant.') + return feeRecipient +} diff --git a/src/ethereum/v3Checks.ts b/src/ethereum/v3Checks.ts index 41c7a48e5..d4e8d81c0 100644 --- a/src/ethereum/v3Checks.ts +++ b/src/ethereum/v3Checks.ts @@ -3,6 +3,8 @@ import { getProtocolContractAddresses, readReleaseRegistryAll, readYearnRoleManager, + getAuctionFactoryFromRegistry, + getFeeRecipientFromAccountant, } from './v3Calls' import { Address, PublicClient, getAddress } from 'viem' import { V3ReleaseDataMap, V3ReleaseData } from './types' @@ -186,12 +188,27 @@ export const fetchAndCheckProtocolAddresses = async ( roleManagerFactory, failedChecks ) + + // Fetch auctionFactory from auctionRegistry + const auctionRegistryAddress = constants.protocolPeriphery.auctionRegistry as Address + const auctionFactoryFromRegistry = await getAuctionFactoryFromRegistry( + auctionRegistryAddress, + publicClient + ) + const auctionFactoryCheck = await validateAddress( + constants.protocolPeriphery.auctionFactory, + 'v3AuctionFactory', + auctionFactoryFromRegistry || '0x0000000000000000000000000000000000000000', + failedChecks + ) + if ( !aprOracleCheck || !aprOracleENSCheck || !routerCheck || !reportTriggerCheck || - !roleManagerFactoryCheck + !roleManagerFactoryCheck || + !auctionFactoryCheck ) { checkFlag = false } @@ -200,6 +217,7 @@ export const fetchAndCheckProtocolAddresses = async ( routerCheck, reportTriggerCheck, roleManagerFactoryCheck, + auctionFactoryCheck, } console.log('V3 protocol address validation complete. \n') return { @@ -357,13 +375,27 @@ export const fetchAndCheckYearnV3Addresses = async ( failedChecks ) + // Fetch feeRecipient from Accountant and validate against dumper + const accountantAddress = constants.yearnV3ContractsMainnet.accountant as Address + const feeRecipientFromAccountant = await getFeeRecipientFromAccountant( + accountantAddress, + publicClient + ) + const feeRecipientCheck = await validateAddress( + constants.yearnV3ContractsMainnet.dumper, + 'yearnV3FeeRecipient (Dumper)', + feeRecipientFromAccountant || '0x0000000000000000000000000000000000000000', + failedChecks + ) + if ( !accountantCheck || !accountantENSCheck || !registryCheck || !registryENSCheck || !debtAllocatorCheck || - !daddyCheck + !daddyCheck || + !feeRecipientCheck ) { checkFlag = false } @@ -373,6 +405,7 @@ export const fetchAndCheckYearnV3Addresses = async ( registryCheck, debtAllocatorCheck, daddyCheck, + feeRecipientCheck, } console.log('Yearn V3 Periphery address validation complete. \n') return { addresses, checks, checkFlag } From f132726325a96e7eb38c4d1489d5a2c953b9100f Mon Sep 17 00:00:00 2001 From: engn33r Date: Wed, 18 Mar 2026 00:00:00 +0000 Subject: [PATCH 3/5] Remove Yearn4626Router docs, add Auction and Keeper docs, fixed: bun run v3-docs --- README.md | 1 - .../V3/Periphery/AuctionFactory.md | 199 +++++++++++++ .../V3/Periphery/AuctionRegistry.md | 223 +++++++++++++++ .../smart-contracts/V3/Periphery/Keeper.md | 37 +++ .../V3/Periphery/Yearn4626Router/Multicall.md | 32 --- .../Yearn4626Router/PeripheryPayments.md | 73 ----- .../Periphery/Yearn4626Router/SelfPermit.md | 111 -------- .../Yearn4626Router/Yearn4626Router.md | 262 ------------------ .../Yearn4626Router/Yearn4626RouterBase.md | 188 ------------- natspec/lib/tokenized-strategy-periphery | 2 +- natspec/lib/vault-periphery | 2 +- requirements.txt | 4 +- smartContracts.json | 40 +-- 13 files changed, 476 insertions(+), 698 deletions(-) create mode 100644 docs/developers/smart-contracts/V3/Periphery/AuctionFactory.md create mode 100644 docs/developers/smart-contracts/V3/Periphery/AuctionRegistry.md create mode 100644 docs/developers/smart-contracts/V3/Periphery/Keeper.md delete mode 100644 docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/Multicall.md delete mode 100644 docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/PeripheryPayments.md delete mode 100644 docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/SelfPermit.md delete mode 100644 docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/Yearn4626Router.md delete mode 100644 docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/Yearn4626RouterBase.md diff --git a/README.md b/README.md index f5c14ed5f..17247e4b9 100644 --- a/README.md +++ b/README.md @@ -236,7 +236,6 @@ For reference, these are the addresses for the different submodules: - [yearn/vault-periphery](https://github.com/yearn/vault-periphery) - [yearn/tokenized-strategy](https://github.com/yearn/tokenized-strategy/tree/master) - [yearn/tokenized-strategy-periphery](https://github.com/yearn/tokenized-strategy-periphery/tree/master) -- [yearn/yearn-ERC4626-Router](https://github.com/yearn/Yearn-ERC4626-Router) 2. If you haven't already, create a python virtual environment and initialize. diff --git a/docs/developers/smart-contracts/V3/Periphery/AuctionFactory.md b/docs/developers/smart-contracts/V3/Periphery/AuctionFactory.md new file mode 100644 index 000000000..40fe43dad --- /dev/null +++ b/docs/developers/smart-contracts/V3/Periphery/AuctionFactory.md @@ -0,0 +1,199 @@ + +# AuctionFactory + +[Git Source](https://github.com/yearn/tokenized-strategy-periphery/blob/c0dfe4a563a45efb72718547e840429b3a6092e6/src/Auctions/AuctionFactory.sol) + +**Inherits:** ClonableCreate2 + +**Title:** +AuctionFactory + +Deploy a new Auction. + +## State Variables + +### DEFAULT_STARTING_PRICE + +The amount to start the auction with. + +```solidity +uint256 public constant DEFAULT_STARTING_PRICE = 1_000_000 +``` + +### auctions + +Full array of all auctions deployed through this factory. + +```solidity +address[] public auctions +``` + +## Functions + +### constructor + +```solidity +constructor() ; +``` + +### version + +```solidity +function version() external pure returns (string memory); +``` + +### createNewAuction + +Creates a new auction contract. + +```solidity +function createNewAuction(address _want) external returns (address); +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`_want`|`address`|Address of the token users will bid with.| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`address`|_newAuction Address of the newly created auction contract.| + +### createNewAuction + +Creates a new auction contract. + +```solidity +function createNewAuction(address _want, address _receiver) external returns (address); +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`_want`|`address`|Address of the token users will bid with.| +|`_receiver`|`address`|Address that will receive the funds in the auction.| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`address`|_newAuction Address of the newly created auction contract.| + +### createNewAuction + +Creates a new auction contract. + +```solidity +function createNewAuction(address _want, address _receiver, address _governance) external returns (address); +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`_want`|`address`|Address of the token users will bid with.| +|`_receiver`|`address`|Address that will receive the funds in the auction.| +|`_governance`|`address`|Address allowed to enable and disable auctions.| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`address`|_newAuction Address of the newly created auction contract.| + +### createNewAuction + +Creates a new auction contract. + +```solidity +function createNewAuction(address _want, address _receiver, address _governance, uint256 _startingPrice) + external + returns (address); +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`_want`|`address`|Address of the token users will bid with.| +|`_receiver`|`address`|Address that will receive the funds in the auction.| +|`_governance`|`address`|Address allowed to enable and disable auctions.| +|`_startingPrice`|`uint256`|Starting price for the auction (no decimals). NOTE: The starting price should be without decimals (1k == 1_000).| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`address`|_newAuction Address of the newly created auction contract.| + +### createNewAuction + +Creates a new auction contract. + +```solidity +function createNewAuction( + address _want, + address _receiver, + address _governance, + uint256 _startingPrice, + bytes32 _salt +) external returns (address); +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`_want`|`address`|Address of the token users will bid with.| +|`_receiver`|`address`|Address that will receive the funds in the auction.| +|`_governance`|`address`|Address allowed to enable and disable auctions.| +|`_startingPrice`|`uint256`|Starting price for the auction (no decimals).| +|`_salt`|`bytes32`|The salt to use for deterministic deployment.| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`address`|_newAuction Address of the newly created auction contract.| + +### _createNewAuction + +Deploys and initializes a new Auction + +```solidity +function _createNewAuction( + address _want, + address _receiver, + address _governance, + uint256 _startingPrice, + bytes32 _salt +) internal returns (address _newAuction); +``` + +### getAllAuctions + +Get the full list of auctions deployed through this factory. + +```solidity +function getAllAuctions() external view returns (address[] memory); +``` + +### numberOfAuctions + +Get the total number of auctions deployed through this factory. + +```solidity +function numberOfAuctions() external view returns (uint256); +``` + +## Events + +### DeployedNewAuction + +```solidity +event DeployedNewAuction(address indexed auction, address indexed want); +``` diff --git a/docs/developers/smart-contracts/V3/Periphery/AuctionRegistry.md b/docs/developers/smart-contracts/V3/Periphery/AuctionRegistry.md new file mode 100644 index 000000000..7305d8c67 --- /dev/null +++ b/docs/developers/smart-contracts/V3/Periphery/AuctionRegistry.md @@ -0,0 +1,223 @@ + +# AuctionRegistry + +[Git Source](https://github.com/yearn/tokenized-strategy-periphery/blob/c0dfe4a563a45efb72718547e840429b3a6092e6/src/Auctions/AuctionRegistry.sol) + +**Inherits:** Governance2Step + +**Title:** +AuctionRegistry + +Registry contract that manages released and endorsed auction factory addresses + +Provides on-chain discovery and verification of official auction factories + +## State Variables + +### factories + +Array of all registered factories + +```solidity +address[] public factories +``` + +### factoryInfo + +Mapping from factory address to its index in the factories array + +```solidity +mapping(address => FactoryInfo) public factoryInfo +``` + +### versionToFactory + +Mapping from version string to factory address + +```solidity +mapping(string => address) public versionToFactory +``` + +## Functions + +### constructor + +Initialize the registry with known factory addresses + +```solidity +constructor(address _governance, address[] memory _knownFactories, string[] memory _versions) + Governance2Step(_governance); +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`_governance`|`address`|The address that will have governance rights| +|`_knownFactories`|`address[]`|Array of known factory addresses to register| +|`_versions`|`string[]`|Array of version strings corresponding to the factories| + +### getLatestFactory + +Get the latest endorsed auction factory address + +```solidity +function getLatestFactory() external view returns (address factory); +``` + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`factory`|`address`|The address of the latest endorsed factory| + +### getFactory + +Get a factory by its version string + +```solidity +function getFactory(string memory _version) external view returns (address factory); +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`_version`|`string`|The version string of the factory| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`factory`|`address`|The address of the factory| + +### getFactoryInfo + +Get factory information by address + +```solidity +function getFactoryInfo(address _factory) external view returns (FactoryInfo memory info); +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`_factory`|`address`|The address of the factory| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`info`|`FactoryInfo`|The factory information struct| + +### getAllFactories + +Get all registered factories + +```solidity +function getAllFactories() external view returns (address[] memory); +``` + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`address[]`|All factory information| + +### numberOfFactories + +Get the total number of registered factories + +```solidity +function numberOfFactories() external view returns (uint256); +``` + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`uint256`|The number of registered factories| + +### isRegisteredFactory + +Check if a factory is endorsed + +```solidity +function isRegisteredFactory(address _factory) public view returns (bool); +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`_factory`|`address`|The address to check| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`bool`|True if the factory is endorsed| + +### registerNewFactory + +Release a new factory + +```solidity +function registerNewFactory(address _factory, string memory _version) external onlyGovernance; +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`_factory`|`address`|The address of the factory| +|`_version`|`string`|The version string of the factory| + +### retireFactory + +Revoke endorsement from a factory + +```solidity +function retireFactory(address _factory) external onlyGovernance; +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`_factory`|`address`|The address of the factory| + +### _registerFactory + +Internal function to register a factory + +```solidity +function _registerFactory(address _factory, string memory _version) internal; +``` + +## Events + +### FactoryRegistered + +```solidity +event FactoryRegistered(address indexed factory, string version, uint256 index); +``` + +### FactoryRetired + +```solidity +event FactoryRetired(address indexed factory); +``` + +## Structs + +### FactoryInfo + +```solidity +struct FactoryInfo { + string version; + uint256 index; + bool isRetired; +} +``` diff --git a/docs/developers/smart-contracts/V3/Periphery/Keeper.md b/docs/developers/smart-contracts/V3/Periphery/Keeper.md new file mode 100644 index 000000000..52c0ed082 --- /dev/null +++ b/docs/developers/smart-contracts/V3/Periphery/Keeper.md @@ -0,0 +1,37 @@ + +# Keeper + +[Git Source](https://github.com/yearn/vault-periphery/blob/bc4eee4051e3319427012e65296110bbdc00488d/src/Keeper.sol) + +**Title:** +Keeper + +To allow permissionless reporting on V3 vaults and strategies. +This will do low level calls so that in can be used without reverting +it the roles have not been set or the functions are not available. + +## Functions + +### report + +Reports on a strategy. + +```solidity +function report(address _strategy) external returns (uint256, uint256); +``` + +### tend + +Tends a strategy. + +```solidity +function tend(address _strategy) external; +``` + +### process_report + +Report strategy profits on a vault. + +```solidity +function process_report(address _vault, address _strategy) external returns (uint256, uint256); +``` diff --git a/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/Multicall.md b/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/Multicall.md deleted file mode 100644 index 9a2146eb3..000000000 --- a/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/Multicall.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Multicall - -[Git Source](https://github.com/yearn/Yearn-ERC4626-Router/blob/68165774ec8858b43db24620756402def14b7ec1/src/external/Multicall.sol) - -**Inherits:** IMulticall - -Enables calling multiple methods in a single call to the contract - -## Functions - -### multicall - -Call multiple functions in the current contract and return the data from all of them if they all succeed - -*The `msg.value` should not be trusted for any method callable from multicall.* - -```solidity -function multicall(bytes[] calldata data) public payable override returns (bytes[] memory results); -``` - -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`data`|`bytes[]`|The encoded function data for each of the calls to make to this contract| - -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|`results`|`bytes[]`|The results from each of the calls passed in via data| diff --git a/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/PeripheryPayments.md b/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/PeripheryPayments.md deleted file mode 100644 index 2e417c2ee..000000000 --- a/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/PeripheryPayments.md +++ /dev/null @@ -1,73 +0,0 @@ - -# PeripheryPayments - -[Git Source](https://github.com/yearn/Yearn-ERC4626-Router/blob/68165774ec8858b43db24620756402def14b7ec1/src/external/PeripheryPayments.sol) - -Immutable state used by periphery contracts -Largely Forked from https://github.com/Uniswap/v3-periphery/blob/main/contracts/base/PeripheryPayments.sol -Changes: -no interface -no inheritdoc -add immutable WETH9 in constructor instead of PeripheryImmutableState -receive from any address -Solmate interfaces and transfer lib -casting -add approve, wrapWETH9 and pullToken - -## State Variables - -### WETH9 - -```solidity -IWETH9 public immutable WETH9; -``` - -## Functions - -### constructor - -```solidity -constructor(IWETH9 _WETH9); -``` - -### receive - -```solidity -receive() external payable; -``` - -### approve - -```solidity -function approve(ERC20 token, address to, uint256 amount) public payable; -``` - -### unwrapWETH9 - -```solidity -function unwrapWETH9(uint256 amountMinimum, address recipient) public payable; -``` - -### wrapWETH9 - -```solidity -function wrapWETH9() public payable; -``` - -### pullToken - -```solidity -function pullToken(ERC20 token, uint256 amount, address recipient) public payable; -``` - -### sweepToken - -```solidity -function sweepToken(ERC20 token, uint256 amountMinimum, address recipient) public payable; -``` - -### refundETH - -```solidity -function refundETH() external payable; -``` diff --git a/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/SelfPermit.md b/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/SelfPermit.md deleted file mode 100644 index 62ff0f699..000000000 --- a/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/SelfPermit.md +++ /dev/null @@ -1,111 +0,0 @@ - -# SelfPermit - -[Git Source](https://github.com/yearn/Yearn-ERC4626-Router/blob/68165774ec8858b43db24620756402def14b7ec1/src/external/SelfPermit.sol) - -**Inherits:** ISelfPermit - -Functionality to call permit on any EIP-2612-compliant token for use in the route - -These functions are expected to be embedded in multicalls to allow EOAs to approve a contract and call a function -that requires an approval in a single transaction. - -## Functions - -### selfPermit - -Permits this contract to spend a given token from `msg.sender` - -*The `owner` is always msg.sender and the `spender` is always address(this).* - -```solidity -function selfPermit(address token, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) - public - payable - override; -``` - -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`token`|`address`|The address of the token spent| -|`value`|`uint256`|The amount that can be spent of token| -|`deadline`|`uint256`|A timestamp, the current blocktime must be less than or equal to this timestamp| -|`v`|`uint8`|Must produce valid secp256k1 signature from the holder along with `r` and `s`| -|`r`|`bytes32`|Must produce valid secp256k1 signature from the holder along with `v` and `s`| -|`s`|`bytes32`|Must produce valid secp256k1 signature from the holder along with `r` and `v`| - -### selfPermitIfNecessary - -Permits this contract to spend a given token from `msg.sender` - -*The `owner` is always msg.sender and the `spender` is always address(this). -Can be used instead of #selfPermit to prevent calls from failing due to a frontrun of a call to #selfPermit* - -```solidity -function selfPermitIfNecessary(address token, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) - external - payable - override; -``` - -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`token`|`address`|The address of the token spent| -|`value`|`uint256`|The amount that can be spent of token| -|`deadline`|`uint256`|A timestamp, the current blocktime must be less than or equal to this timestamp| -|`v`|`uint8`|Must produce valid secp256k1 signature from the holder along with `r` and `s`| -|`r`|`bytes32`|Must produce valid secp256k1 signature from the holder along with `v` and `s`| -|`s`|`bytes32`|Must produce valid secp256k1 signature from the holder along with `r` and `v`| - -### selfPermitAllowed - -Permits this contract to spend the sender's tokens for permit signatures that have the `allowed` parameter - -*The `owner` is always msg.sender and the `spender` is always address(this)* - -```solidity -function selfPermitAllowed(address token, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) - public - payable - override; -``` - -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`token`|`address`|The address of the token spent| -|`nonce`|`uint256`|The current nonce of the owner| -|`expiry`|`uint256`|The timestamp at which the permit is no longer valid| -|`v`|`uint8`|Must produce valid secp256k1 signature from the holder along with `r` and `s`| -|`r`|`bytes32`|Must produce valid secp256k1 signature from the holder along with `v` and `s`| -|`s`|`bytes32`|Must produce valid secp256k1 signature from the holder along with `r` and `v`| - -### selfPermitAllowedIfNecessary - -Permits this contract to spend the sender's tokens for permit signatures that have the `allowed` parameter - -*The `owner` is always msg.sender and the `spender` is always address(this) -Can be used instead of #selfPermitAllowed to prevent calls from failing due to a frontrun of a call to #selfPermitAllowed.* - -```solidity -function selfPermitAllowedIfNecessary(address token, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) - external - payable - override; -``` - -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`token`|`address`|The address of the token spent| -|`nonce`|`uint256`|The current nonce of the owner| -|`expiry`|`uint256`|The timestamp at which the permit is no longer valid| -|`v`|`uint8`|Must produce valid secp256k1 signature from the holder along with `r` and `s`| -|`r`|`bytes32`|Must produce valid secp256k1 signature from the holder along with `v` and `s`| -|`s`|`bytes32`|Must produce valid secp256k1 signature from the holder along with `r` and `v`| diff --git a/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/Yearn4626Router.md b/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/Yearn4626Router.md deleted file mode 100644 index ae8318102..000000000 --- a/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/Yearn4626Router.md +++ /dev/null @@ -1,262 +0,0 @@ - -# Yearn4626Router - -[Git Source](https://github.com/yearn/Yearn-ERC4626-Router/blob/68165774ec8858b43db24620756402def14b7ec1/src/Yearn4626Router.sol) - -**Inherits:** IYearn4626Router, Yearn4626RouterBase - -Router that is meant to be used with Yearn V3 vaults and strategies -for deposits, withdraws and migrations. -The router was developed from the original router by FEI protocol -https://github.com/fei-protocol/ERC4626 -The router is designed to be used with permit and multicall for the -optimal experience. -NOTE: It is important to never leave tokens in the router at the -end of a call, otherwise they can be swept by anyone. - -## State Variables - -### _name - -```solidity -bytes32 private immutable _name; -``` - -## Functions - -### constructor - -```solidity -constructor(string memory _name_, IWETH9 weth) PeripheryPayments(weth); -``` - -### name - -```solidity -function name() external view returns (string memory); -``` - -### depositToVault - -deposit `amount` to an ERC4626 vault. - -*throws "!minShares" Error.* - -```solidity -function depositToVault(IYearn4626 vault, uint256 amount, address to, uint256 minSharesOut) - public - payable - override - returns (uint256); -``` - -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`vault`|`IYearn4626`|The ERC4626 vault to deposit assets to.| -|`amount`|`uint256`|The amount of assets to deposit to `vault`.| -|`to`|`address`|The destination of ownership shares.| -|`minSharesOut`|`uint256`|The min amount of `vault` shares received by `to`.| - -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|``|`uint256`|. the amount of shares received by `to`.| - -### depositToVault - -See [depositToVault](#deposittovault) in IYearn4626Router. - -*Uses msg.sender as the default for `to`.* - -```solidity -function depositToVault(IYearn4626 vault, uint256 amount, uint256 minSharesOut) external payable returns (uint256); -``` - -### depositToVault - -See [depositToVault](#deposittovault) in IYearn4626Router. - -*Uses msg.sender as the default for `to` and their full -balance of msg.sender as `amount`.* - -```solidity -function depositToVault(IYearn4626 vault, uint256 minSharesOut) external payable returns (uint256); -``` - -### depositToVault - -See [depositToVault](#deposittovault) in IYearn4626Router. - -*Uses msg.sender as the default for `to`, their full balance -of msg.sender as `amount` and 1 Basis point for `maxLoss`. -NOTE: The slippage tollerance is only useful if `previewDeposit` -cannot be manipulated for the `vault`.* - -```solidity -function depositToVault(IYearn4626 vault) external payable returns (uint256); -``` - -### redeem - -See [redeem](#redeem) in IYearn4626RouterBase. - -*Uses msg.sender as `receiver`.* - -```solidity -function redeem(IYearn4626 vault, uint256 shares, uint256 maxLoss) external payable returns (uint256); -``` - -### redeem - -See [redeem](#redeem) in IYearn4626RouterBase. - -*Uses msg.sender as `receiver` and their full balance as `shares`.* - -```solidity -function redeem(IYearn4626 vault, uint256 maxLoss) external payable returns (uint256); -``` - -### redeem - -See [redeem](#redeem) in IYearn4626RouterBase. - -*Uses msg.sender as `receiver`, their full balance as `shares` -and 1 Basis Point for `maxLoss`.* - -```solidity -function redeem(IYearn4626 vault) external payable returns (uint256); -``` - -### migrate - -will redeem `shares` from one vault and deposit amountOut to a different ERC4626 vault. - -*throws "!minAmount", "!minShares" Errors.* - -```solidity -function migrate(IYearn4626 fromVault, IYearn4626 toVault, uint256 shares, address to, uint256 minSharesOut) - public - payable - override - returns (uint256); -``` - -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`fromVault`|`IYearn4626`|The ERC4626 vault to redeem shares from.| -|`toVault`|`IYearn4626`|The ERC4626 vault to deposit assets to.| -|`shares`|`uint256`|The amount of shares to redeem from fromVault.| -|`to`|`address`|The destination of ownership shares.| -|`minSharesOut`|`uint256`|The min amount of toVault shares received by `to`.| - -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|``|`uint256`|. the amount of shares received by `to`.| - -### migrate - -See [migrate](#migrate) in IYearn4626Router. - -*Uses msg.sender as `to`.* - -```solidity -function migrate(IYearn4626 fromVault, IYearn4626 toVault, uint256 shares, uint256 minSharesOut) - external - payable - returns (uint256); -``` - -### migrate - -See [migrate](#migrate) in IYearn4626Router. - -*Uses msg.sender as `to` and their full balance for `shares`.* - -```solidity -function migrate(IYearn4626 fromVault, IYearn4626 toVault, uint256 minSharesOut) external payable returns (uint256); -``` - -### migrate - -See [migrate](#migrate) in IYearn4626Router. - -*Uses msg.sender as `to`, their full balance for `shares` and no `minamountOut`. -NOTE: Using this will enforce no slippage checks and should be used with care.* - -```solidity -function migrate(IYearn4626 fromVault, IYearn4626 toVault) external payable returns (uint256); -``` - -### migrateFromV2 - -migrate from Yearn V2 vault to a V3 vault'. - -*throws "!minAmount", "!minShares" Errors.* - -```solidity -function migrateFromV2(IYearnV2 fromVault, IYearn4626 toVault, uint256 shares, address to, uint256 minSharesOut) - public - payable - override - returns (uint256); -``` - -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`fromVault`|`IYearnV2`|The Yearn V2 vault to withdraw from.| -|`toVault`|`IYearn4626`|The Yearn V3 vault to deposit assets to.| -|`shares`|`uint256`|The amount of V2 shares to redeem form 'fromVault'.| -|`to`|`address`|The destination of ownership shares| -|`minSharesOut`|`uint256`|The min amount of 'toVault' shares to be received by 'to'.| - -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|``|`uint256`|. The actual amount of 'toVault' shares received by 'to'.| - -### migrateFromV2 - -See [migrateFromV2](#migratefromv2) in IYearn4626Router. - -*Uses msg.sender as `to`.* - -```solidity -function migrateFromV2(IYearnV2 fromVault, IYearn4626 toVault, uint256 shares, uint256 minSharesOut) - external - payable - returns (uint256); -``` - -### migrateFromV2 - -See [migrateFromV2](#migratefromv2) in IYearn4626Router. - -*Uses msg.sender as `to` and their full balance as `shares`.* - -```solidity -function migrateFromV2(IYearnV2 fromVault, IYearn4626 toVault, uint256 minSharesOut) - external - payable - returns (uint256); -``` - -### migrateFromV2 - -See [migrate](#migrate) in IYearn4626Router. - -*Uses msg.sender as `to`, their full balance for `shares` and no `minamountOut`. -NOTE: Using this will enforce no slippage checks and should be used with care.* - -```solidity -function migrateFromV2(IYearnV2 fromVault, IYearn4626 toVault) external payable returns (uint256 sharesOut); -``` diff --git a/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/Yearn4626RouterBase.md b/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/Yearn4626RouterBase.md deleted file mode 100644 index 5e986b71e..000000000 --- a/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/Yearn4626RouterBase.md +++ /dev/null @@ -1,188 +0,0 @@ - -# Yearn4626RouterBase - -[Git Source](https://github.com/yearn/Yearn-ERC4626-Router/blob/68165774ec8858b43db24620756402def14b7ec1/src/Yearn4626RouterBase.sol) - -**Inherits:** IYearn4626RouterBase, SelfPermit, Multicall, PeripheryPayments - -## Functions - -### mint - -mint `shares` from an ERC4626 vault. - -*throws "!maxAmount" Error* - -```solidity -function mint(IYearn4626 vault, uint256 shares, address to, uint256 maxAmountIn) - public - payable - virtual - override - returns (uint256 amountIn); -``` - -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`vault`|`IYearn4626`|The ERC4626 vault to mint shares from.| -|`shares`|`uint256`|The amount of shares to mint from `vault`.| -|`to`|`address`|The destination of ownership shares.| -|`maxAmountIn`|`uint256`|The max amount of assets used to mint.| - -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|`amountIn`|`uint256`|the amount of assets used to mint by `to`.| - -### deposit - -deposit `amount` to an ERC4626 vault. - -*throws "!minShares" Error* - -```solidity -function deposit(IYearn4626 vault, uint256 amount, address to, uint256 minSharesOut) - public - payable - virtual - override - returns (uint256 sharesOut); -``` - -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`vault`|`IYearn4626`|The ERC4626 vault to deposit assets to.| -|`amount`|`uint256`|The amount of assets to deposit to `vault`.| -|`to`|`address`|The destination of ownership shares.| -|`minSharesOut`|`uint256`|The min amount of `vault` shares received by `to`.| - -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|`sharesOut`|`uint256`|the amount of shares received by `to`.| - -### withdraw - -withdraw `amount` from an ERC4626 vault. - -*Uses the Yearn specific 'maxLoss' accounting.* - -```solidity -function withdraw(IYearn4626 vault, uint256 amount, address to, uint256 maxLoss) - public - payable - virtual - override - returns (uint256); -``` - -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`vault`|`IYearn4626`|The ERC4626 vault to redeem shares from.| -|`amount`|`uint256`|The amount of assets to withdraw from vault.| -|`to`|`address`|The destination of assets.| -|`maxLoss`|`uint256`|The acceptable loss in Basis Points.| - -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|``|`uint256`|sharesOut the amount of shares received by `to`.| - -### withdrawDefault - -withdraw `amount` from an ERC4626 vault. - -*Uses the default 4626 syntax, throws !maxShares" Error.* - -```solidity -function withdrawDefault(IYearn4626 vault, uint256 amount, address to, uint256 maxSharesOut) - public - payable - virtual - override - returns (uint256 sharesOut); -``` - -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`vault`|`IYearn4626`|The ERC4626 vault to withdraw assets from.| -|`amount`|`uint256`|The amount of assets to withdraw from vault.| -|`to`|`address`|The destination of assets.| -|`maxSharesOut`|`uint256`|| - -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|`sharesOut`|`uint256`|the amount of shares received by `to`.| - -### redeem - -redeem `shares` shares from an ERC4626 vault. - -*Uses the Yearn specific 'maxLoss' accounting.* - -```solidity -function redeem(IYearn4626 vault, uint256 shares, address to, uint256 maxLoss) - public - payable - virtual - override - returns (uint256); -``` - -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`vault`|`IYearn4626`|The ERC4626 vault to redeem shares from.| -|`shares`|`uint256`|The amount of shares to redeem from vault.| -|`to`|`address`|The destination of assets.| -|`maxLoss`|`uint256`|The acceptable loss in Basis Points.| - -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|``|`uint256`|amountOut the amount of assets received by `to`.| - -### redeemDefault - -redeem `shares` shares from an ERC4626 vault. - -*Uses the default 4626 syntax, throws "!minAmount" Error.* - -```solidity -function redeemDefault(IYearn4626 vault, uint256 shares, address to, uint256 minAmountOut) - public - payable - virtual - override - returns (uint256 amountOut); -``` - -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`vault`|`IYearn4626`|The ERC4626 vault to redeem shares from.| -|`shares`|`uint256`|The amount of shares to redeem from vault.| -|`to`|`address`|The destination of assets.| -|`minAmountOut`|`uint256`|The min amount of assets received by `to`.| - -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|`amountOut`|`uint256`|the amount of assets received by `to`.| diff --git a/natspec/lib/tokenized-strategy-periphery b/natspec/lib/tokenized-strategy-periphery index f70e702c3..c0dfe4a56 160000 --- a/natspec/lib/tokenized-strategy-periphery +++ b/natspec/lib/tokenized-strategy-periphery @@ -1 +1 @@ -Subproject commit f70e702c378fa41e52c46acf3da8b4e90c6a0ff8 +Subproject commit c0dfe4a563a45efb72718547e840429b3a6092e6 diff --git a/natspec/lib/vault-periphery b/natspec/lib/vault-periphery index 329c63c18..bc4eee405 160000 --- a/natspec/lib/vault-periphery +++ b/natspec/lib/vault-periphery @@ -1 +1 @@ -Subproject commit 329c63c187d13c1e1443571238f6144b1ee0726f +Subproject commit bc4eee4051e3319427012e65296110bbdc00488d diff --git a/requirements.txt b/requirements.txt index ff32abfa1..cca8dfc34 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -asttokens==3.0.1 +asttokens==2.0.5 certifi==2025.11.12 charset-normalizer==3.4.4 idna==3.11 @@ -9,5 +9,5 @@ semantic-version==2.10.0 six==1.17.0 solc-select==1.1.0 urllib3==2.6.0 -vyper==0.4.3 +vyper==0.3.7 # ypricemagic==4.10.10 diff --git a/smartContracts.json b/smartContracts.json index 9235f1742..7a8719faa 100644 --- a/smartContracts.json +++ b/smartContracts.json @@ -43,6 +43,18 @@ "type": "file", "git": "https://github.com/yearn/vault-periphery" }, + "Keeper.sol": { + "type": "file", + "git": "https://github.com/yearn/vault-periphery" + }, + "AuctionRegistry.sol": { + "type": "file", + "git": "https://github.com/yearn/tokenized-strategy-periphery" + }, + "AuctionFactory.sol": { + "type": "file", + "git": "https://github.com/yearn/tokenized-strategy-periphery" + }, "Auction.sol": { "type": "file", "git": "https://github.com/yearn/tokenized-strategy-periphery" @@ -58,31 +70,6 @@ "CommonReportTrigger.sol": { "type": "file", "git": "https://github.com/yearn/tokenized-strategy-periphery" - }, - "Yearn4626Router": { - "type": "folder", - "contents": { - "Multicall.sol": { - "type": "file", - "git": "https://github.com/yearn/Yearn-ERC4626-Router" - }, - "PeripheryPayments.sol": { - "type": "file", - "git": "https://github.com/yearn/Yearn-ERC4626-Router" - }, - "SelfPermit.sol": { - "type": "file", - "git": "https://github.com/yearn/Yearn-ERC4626-Router" - }, - "Yearn4626Router.sol": { - "type": "file", - "git": "https://github.com/yearn/Yearn-ERC4626-Router" - }, - "Yearn4626RouterBase.sol": { - "type": "file", - "git": "https://github.com/yearn/Yearn-ERC4626-Router" - } - } } } } @@ -91,7 +78,6 @@ "https://github.com/yearn/yearn-vaults-v3.git", "https://github.com/yearn/tokenized-strategy.git", "https://github.com/yearn/tokenized-strategy-periphery.git", - "https://github.com/yearn/vault-periphery.git", - "https://github.com/yearn/Yearn-ERC4626-Router.git" + "https://github.com/yearn/vault-periphery.git" ] } From 2d145ac9c566ec1ce37d586cdb4ce97a12a28daf Mon Sep 17 00:00:00 2001 From: engn33r Date: Wed, 18 Mar 2026 00:00:00 +0000 Subject: [PATCH 4/5] Remove broken link --- docs/developers/v3/Integrating_v3.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/developers/v3/Integrating_v3.md b/docs/developers/v3/Integrating_v3.md index 19d60691e..1d88fc625 100644 --- a/docs/developers/v3/Integrating_v3.md +++ b/docs/developers/v3/Integrating_v3.md @@ -16,8 +16,6 @@ token.approve(vault, amount) vault.deposit(amount, receiver) ``` -There is also a [4626 Router](/developers/smart-contracts/V3/Periphery/Yearn4626Router) available to make multi-step user flows easier. - The max amount that a vault will accept from an address can be returned using the [`maxDeposit`](https://eips.ethereum.org/EIPS/eip-4626#maxdeposit) function. ### Withdrawals From 3c3ccb2a7141c6630ea35ac818a953ad965acdff Mon Sep 17 00:00:00 2001 From: engn33r Date: Wed, 18 Mar 2026 00:00:00 +0000 Subject: [PATCH 5/5] Reintroduce mistakenly deleted Yearn4626Router docs --- README.md | 1 + .../V3/Periphery/Yearn4626Router/Multicall.md | 32 +++ .../Yearn4626Router/PeripheryPayments.md | 73 +++++ .../Periphery/Yearn4626Router/SelfPermit.md | 111 ++++++++ .../Yearn4626Router/Yearn4626Router.md | 262 ++++++++++++++++++ .../Yearn4626Router/Yearn4626RouterBase.md | 188 +++++++++++++ smartContracts.json | 28 +- 7 files changed, 694 insertions(+), 1 deletion(-) create mode 100644 docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/Multicall.md create mode 100644 docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/PeripheryPayments.md create mode 100644 docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/SelfPermit.md create mode 100644 docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/Yearn4626Router.md create mode 100644 docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/Yearn4626RouterBase.md diff --git a/README.md b/README.md index 17247e4b9..f5c14ed5f 100644 --- a/README.md +++ b/README.md @@ -236,6 +236,7 @@ For reference, these are the addresses for the different submodules: - [yearn/vault-periphery](https://github.com/yearn/vault-periphery) - [yearn/tokenized-strategy](https://github.com/yearn/tokenized-strategy/tree/master) - [yearn/tokenized-strategy-periphery](https://github.com/yearn/tokenized-strategy-periphery/tree/master) +- [yearn/yearn-ERC4626-Router](https://github.com/yearn/Yearn-ERC4626-Router) 2. If you haven't already, create a python virtual environment and initialize. diff --git a/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/Multicall.md b/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/Multicall.md new file mode 100644 index 000000000..9a2146eb3 --- /dev/null +++ b/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/Multicall.md @@ -0,0 +1,32 @@ + +# Multicall + +[Git Source](https://github.com/yearn/Yearn-ERC4626-Router/blob/68165774ec8858b43db24620756402def14b7ec1/src/external/Multicall.sol) + +**Inherits:** IMulticall + +Enables calling multiple methods in a single call to the contract + +## Functions + +### multicall + +Call multiple functions in the current contract and return the data from all of them if they all succeed + +*The `msg.value` should not be trusted for any method callable from multicall.* + +```solidity +function multicall(bytes[] calldata data) public payable override returns (bytes[] memory results); +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`data`|`bytes[]`|The encoded function data for each of the calls to make to this contract| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`results`|`bytes[]`|The results from each of the calls passed in via data| diff --git a/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/PeripheryPayments.md b/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/PeripheryPayments.md new file mode 100644 index 000000000..2e417c2ee --- /dev/null +++ b/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/PeripheryPayments.md @@ -0,0 +1,73 @@ + +# PeripheryPayments + +[Git Source](https://github.com/yearn/Yearn-ERC4626-Router/blob/68165774ec8858b43db24620756402def14b7ec1/src/external/PeripheryPayments.sol) + +Immutable state used by periphery contracts +Largely Forked from https://github.com/Uniswap/v3-periphery/blob/main/contracts/base/PeripheryPayments.sol +Changes: +no interface +no inheritdoc +add immutable WETH9 in constructor instead of PeripheryImmutableState +receive from any address +Solmate interfaces and transfer lib +casting +add approve, wrapWETH9 and pullToken + +## State Variables + +### WETH9 + +```solidity +IWETH9 public immutable WETH9; +``` + +## Functions + +### constructor + +```solidity +constructor(IWETH9 _WETH9); +``` + +### receive + +```solidity +receive() external payable; +``` + +### approve + +```solidity +function approve(ERC20 token, address to, uint256 amount) public payable; +``` + +### unwrapWETH9 + +```solidity +function unwrapWETH9(uint256 amountMinimum, address recipient) public payable; +``` + +### wrapWETH9 + +```solidity +function wrapWETH9() public payable; +``` + +### pullToken + +```solidity +function pullToken(ERC20 token, uint256 amount, address recipient) public payable; +``` + +### sweepToken + +```solidity +function sweepToken(ERC20 token, uint256 amountMinimum, address recipient) public payable; +``` + +### refundETH + +```solidity +function refundETH() external payable; +``` diff --git a/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/SelfPermit.md b/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/SelfPermit.md new file mode 100644 index 000000000..62ff0f699 --- /dev/null +++ b/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/SelfPermit.md @@ -0,0 +1,111 @@ + +# SelfPermit + +[Git Source](https://github.com/yearn/Yearn-ERC4626-Router/blob/68165774ec8858b43db24620756402def14b7ec1/src/external/SelfPermit.sol) + +**Inherits:** ISelfPermit + +Functionality to call permit on any EIP-2612-compliant token for use in the route + +These functions are expected to be embedded in multicalls to allow EOAs to approve a contract and call a function +that requires an approval in a single transaction. + +## Functions + +### selfPermit + +Permits this contract to spend a given token from `msg.sender` + +*The `owner` is always msg.sender and the `spender` is always address(this).* + +```solidity +function selfPermit(address token, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) + public + payable + override; +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`token`|`address`|The address of the token spent| +|`value`|`uint256`|The amount that can be spent of token| +|`deadline`|`uint256`|A timestamp, the current blocktime must be less than or equal to this timestamp| +|`v`|`uint8`|Must produce valid secp256k1 signature from the holder along with `r` and `s`| +|`r`|`bytes32`|Must produce valid secp256k1 signature from the holder along with `v` and `s`| +|`s`|`bytes32`|Must produce valid secp256k1 signature from the holder along with `r` and `v`| + +### selfPermitIfNecessary + +Permits this contract to spend a given token from `msg.sender` + +*The `owner` is always msg.sender and the `spender` is always address(this). +Can be used instead of #selfPermit to prevent calls from failing due to a frontrun of a call to #selfPermit* + +```solidity +function selfPermitIfNecessary(address token, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) + external + payable + override; +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`token`|`address`|The address of the token spent| +|`value`|`uint256`|The amount that can be spent of token| +|`deadline`|`uint256`|A timestamp, the current blocktime must be less than or equal to this timestamp| +|`v`|`uint8`|Must produce valid secp256k1 signature from the holder along with `r` and `s`| +|`r`|`bytes32`|Must produce valid secp256k1 signature from the holder along with `v` and `s`| +|`s`|`bytes32`|Must produce valid secp256k1 signature from the holder along with `r` and `v`| + +### selfPermitAllowed + +Permits this contract to spend the sender's tokens for permit signatures that have the `allowed` parameter + +*The `owner` is always msg.sender and the `spender` is always address(this)* + +```solidity +function selfPermitAllowed(address token, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) + public + payable + override; +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`token`|`address`|The address of the token spent| +|`nonce`|`uint256`|The current nonce of the owner| +|`expiry`|`uint256`|The timestamp at which the permit is no longer valid| +|`v`|`uint8`|Must produce valid secp256k1 signature from the holder along with `r` and `s`| +|`r`|`bytes32`|Must produce valid secp256k1 signature from the holder along with `v` and `s`| +|`s`|`bytes32`|Must produce valid secp256k1 signature from the holder along with `r` and `v`| + +### selfPermitAllowedIfNecessary + +Permits this contract to spend the sender's tokens for permit signatures that have the `allowed` parameter + +*The `owner` is always msg.sender and the `spender` is always address(this) +Can be used instead of #selfPermitAllowed to prevent calls from failing due to a frontrun of a call to #selfPermitAllowed.* + +```solidity +function selfPermitAllowedIfNecessary(address token, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) + external + payable + override; +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`token`|`address`|The address of the token spent| +|`nonce`|`uint256`|The current nonce of the owner| +|`expiry`|`uint256`|The timestamp at which the permit is no longer valid| +|`v`|`uint8`|Must produce valid secp256k1 signature from the holder along with `r` and `s`| +|`r`|`bytes32`|Must produce valid secp256k1 signature from the holder along with `v` and `s`| +|`s`|`bytes32`|Must produce valid secp256k1 signature from the holder along with `r` and `v`| diff --git a/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/Yearn4626Router.md b/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/Yearn4626Router.md new file mode 100644 index 000000000..ae8318102 --- /dev/null +++ b/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/Yearn4626Router.md @@ -0,0 +1,262 @@ + +# Yearn4626Router + +[Git Source](https://github.com/yearn/Yearn-ERC4626-Router/blob/68165774ec8858b43db24620756402def14b7ec1/src/Yearn4626Router.sol) + +**Inherits:** IYearn4626Router, Yearn4626RouterBase + +Router that is meant to be used with Yearn V3 vaults and strategies +for deposits, withdraws and migrations. +The router was developed from the original router by FEI protocol +https://github.com/fei-protocol/ERC4626 +The router is designed to be used with permit and multicall for the +optimal experience. +NOTE: It is important to never leave tokens in the router at the +end of a call, otherwise they can be swept by anyone. + +## State Variables + +### _name + +```solidity +bytes32 private immutable _name; +``` + +## Functions + +### constructor + +```solidity +constructor(string memory _name_, IWETH9 weth) PeripheryPayments(weth); +``` + +### name + +```solidity +function name() external view returns (string memory); +``` + +### depositToVault + +deposit `amount` to an ERC4626 vault. + +*throws "!minShares" Error.* + +```solidity +function depositToVault(IYearn4626 vault, uint256 amount, address to, uint256 minSharesOut) + public + payable + override + returns (uint256); +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`vault`|`IYearn4626`|The ERC4626 vault to deposit assets to.| +|`amount`|`uint256`|The amount of assets to deposit to `vault`.| +|`to`|`address`|The destination of ownership shares.| +|`minSharesOut`|`uint256`|The min amount of `vault` shares received by `to`.| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`uint256`|. the amount of shares received by `to`.| + +### depositToVault + +See [depositToVault](#deposittovault) in IYearn4626Router. + +*Uses msg.sender as the default for `to`.* + +```solidity +function depositToVault(IYearn4626 vault, uint256 amount, uint256 minSharesOut) external payable returns (uint256); +``` + +### depositToVault + +See [depositToVault](#deposittovault) in IYearn4626Router. + +*Uses msg.sender as the default for `to` and their full +balance of msg.sender as `amount`.* + +```solidity +function depositToVault(IYearn4626 vault, uint256 minSharesOut) external payable returns (uint256); +``` + +### depositToVault + +See [depositToVault](#deposittovault) in IYearn4626Router. + +*Uses msg.sender as the default for `to`, their full balance +of msg.sender as `amount` and 1 Basis point for `maxLoss`. +NOTE: The slippage tollerance is only useful if `previewDeposit` +cannot be manipulated for the `vault`.* + +```solidity +function depositToVault(IYearn4626 vault) external payable returns (uint256); +``` + +### redeem + +See [redeem](#redeem) in IYearn4626RouterBase. + +*Uses msg.sender as `receiver`.* + +```solidity +function redeem(IYearn4626 vault, uint256 shares, uint256 maxLoss) external payable returns (uint256); +``` + +### redeem + +See [redeem](#redeem) in IYearn4626RouterBase. + +*Uses msg.sender as `receiver` and their full balance as `shares`.* + +```solidity +function redeem(IYearn4626 vault, uint256 maxLoss) external payable returns (uint256); +``` + +### redeem + +See [redeem](#redeem) in IYearn4626RouterBase. + +*Uses msg.sender as `receiver`, their full balance as `shares` +and 1 Basis Point for `maxLoss`.* + +```solidity +function redeem(IYearn4626 vault) external payable returns (uint256); +``` + +### migrate + +will redeem `shares` from one vault and deposit amountOut to a different ERC4626 vault. + +*throws "!minAmount", "!minShares" Errors.* + +```solidity +function migrate(IYearn4626 fromVault, IYearn4626 toVault, uint256 shares, address to, uint256 minSharesOut) + public + payable + override + returns (uint256); +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`fromVault`|`IYearn4626`|The ERC4626 vault to redeem shares from.| +|`toVault`|`IYearn4626`|The ERC4626 vault to deposit assets to.| +|`shares`|`uint256`|The amount of shares to redeem from fromVault.| +|`to`|`address`|The destination of ownership shares.| +|`minSharesOut`|`uint256`|The min amount of toVault shares received by `to`.| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`uint256`|. the amount of shares received by `to`.| + +### migrate + +See [migrate](#migrate) in IYearn4626Router. + +*Uses msg.sender as `to`.* + +```solidity +function migrate(IYearn4626 fromVault, IYearn4626 toVault, uint256 shares, uint256 minSharesOut) + external + payable + returns (uint256); +``` + +### migrate + +See [migrate](#migrate) in IYearn4626Router. + +*Uses msg.sender as `to` and their full balance for `shares`.* + +```solidity +function migrate(IYearn4626 fromVault, IYearn4626 toVault, uint256 minSharesOut) external payable returns (uint256); +``` + +### migrate + +See [migrate](#migrate) in IYearn4626Router. + +*Uses msg.sender as `to`, their full balance for `shares` and no `minamountOut`. +NOTE: Using this will enforce no slippage checks and should be used with care.* + +```solidity +function migrate(IYearn4626 fromVault, IYearn4626 toVault) external payable returns (uint256); +``` + +### migrateFromV2 + +migrate from Yearn V2 vault to a V3 vault'. + +*throws "!minAmount", "!minShares" Errors.* + +```solidity +function migrateFromV2(IYearnV2 fromVault, IYearn4626 toVault, uint256 shares, address to, uint256 minSharesOut) + public + payable + override + returns (uint256); +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`fromVault`|`IYearnV2`|The Yearn V2 vault to withdraw from.| +|`toVault`|`IYearn4626`|The Yearn V3 vault to deposit assets to.| +|`shares`|`uint256`|The amount of V2 shares to redeem form 'fromVault'.| +|`to`|`address`|The destination of ownership shares| +|`minSharesOut`|`uint256`|The min amount of 'toVault' shares to be received by 'to'.| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`uint256`|. The actual amount of 'toVault' shares received by 'to'.| + +### migrateFromV2 + +See [migrateFromV2](#migratefromv2) in IYearn4626Router. + +*Uses msg.sender as `to`.* + +```solidity +function migrateFromV2(IYearnV2 fromVault, IYearn4626 toVault, uint256 shares, uint256 minSharesOut) + external + payable + returns (uint256); +``` + +### migrateFromV2 + +See [migrateFromV2](#migratefromv2) in IYearn4626Router. + +*Uses msg.sender as `to` and their full balance as `shares`.* + +```solidity +function migrateFromV2(IYearnV2 fromVault, IYearn4626 toVault, uint256 minSharesOut) + external + payable + returns (uint256); +``` + +### migrateFromV2 + +See [migrate](#migrate) in IYearn4626Router. + +*Uses msg.sender as `to`, their full balance for `shares` and no `minamountOut`. +NOTE: Using this will enforce no slippage checks and should be used with care.* + +```solidity +function migrateFromV2(IYearnV2 fromVault, IYearn4626 toVault) external payable returns (uint256 sharesOut); +``` diff --git a/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/Yearn4626RouterBase.md b/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/Yearn4626RouterBase.md new file mode 100644 index 000000000..5e986b71e --- /dev/null +++ b/docs/developers/smart-contracts/V3/Periphery/Yearn4626Router/Yearn4626RouterBase.md @@ -0,0 +1,188 @@ + +# Yearn4626RouterBase + +[Git Source](https://github.com/yearn/Yearn-ERC4626-Router/blob/68165774ec8858b43db24620756402def14b7ec1/src/Yearn4626RouterBase.sol) + +**Inherits:** IYearn4626RouterBase, SelfPermit, Multicall, PeripheryPayments + +## Functions + +### mint + +mint `shares` from an ERC4626 vault. + +*throws "!maxAmount" Error* + +```solidity +function mint(IYearn4626 vault, uint256 shares, address to, uint256 maxAmountIn) + public + payable + virtual + override + returns (uint256 amountIn); +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`vault`|`IYearn4626`|The ERC4626 vault to mint shares from.| +|`shares`|`uint256`|The amount of shares to mint from `vault`.| +|`to`|`address`|The destination of ownership shares.| +|`maxAmountIn`|`uint256`|The max amount of assets used to mint.| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`amountIn`|`uint256`|the amount of assets used to mint by `to`.| + +### deposit + +deposit `amount` to an ERC4626 vault. + +*throws "!minShares" Error* + +```solidity +function deposit(IYearn4626 vault, uint256 amount, address to, uint256 minSharesOut) + public + payable + virtual + override + returns (uint256 sharesOut); +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`vault`|`IYearn4626`|The ERC4626 vault to deposit assets to.| +|`amount`|`uint256`|The amount of assets to deposit to `vault`.| +|`to`|`address`|The destination of ownership shares.| +|`minSharesOut`|`uint256`|The min amount of `vault` shares received by `to`.| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`sharesOut`|`uint256`|the amount of shares received by `to`.| + +### withdraw + +withdraw `amount` from an ERC4626 vault. + +*Uses the Yearn specific 'maxLoss' accounting.* + +```solidity +function withdraw(IYearn4626 vault, uint256 amount, address to, uint256 maxLoss) + public + payable + virtual + override + returns (uint256); +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`vault`|`IYearn4626`|The ERC4626 vault to redeem shares from.| +|`amount`|`uint256`|The amount of assets to withdraw from vault.| +|`to`|`address`|The destination of assets.| +|`maxLoss`|`uint256`|The acceptable loss in Basis Points.| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`uint256`|sharesOut the amount of shares received by `to`.| + +### withdrawDefault + +withdraw `amount` from an ERC4626 vault. + +*Uses the default 4626 syntax, throws !maxShares" Error.* + +```solidity +function withdrawDefault(IYearn4626 vault, uint256 amount, address to, uint256 maxSharesOut) + public + payable + virtual + override + returns (uint256 sharesOut); +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`vault`|`IYearn4626`|The ERC4626 vault to withdraw assets from.| +|`amount`|`uint256`|The amount of assets to withdraw from vault.| +|`to`|`address`|The destination of assets.| +|`maxSharesOut`|`uint256`|| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`sharesOut`|`uint256`|the amount of shares received by `to`.| + +### redeem + +redeem `shares` shares from an ERC4626 vault. + +*Uses the Yearn specific 'maxLoss' accounting.* + +```solidity +function redeem(IYearn4626 vault, uint256 shares, address to, uint256 maxLoss) + public + payable + virtual + override + returns (uint256); +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`vault`|`IYearn4626`|The ERC4626 vault to redeem shares from.| +|`shares`|`uint256`|The amount of shares to redeem from vault.| +|`to`|`address`|The destination of assets.| +|`maxLoss`|`uint256`|The acceptable loss in Basis Points.| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|``|`uint256`|amountOut the amount of assets received by `to`.| + +### redeemDefault + +redeem `shares` shares from an ERC4626 vault. + +*Uses the default 4626 syntax, throws "!minAmount" Error.* + +```solidity +function redeemDefault(IYearn4626 vault, uint256 shares, address to, uint256 minAmountOut) + public + payable + virtual + override + returns (uint256 amountOut); +``` + +**Parameters** + +|Name|Type|Description| +|----|----|-----------| +|`vault`|`IYearn4626`|The ERC4626 vault to redeem shares from.| +|`shares`|`uint256`|The amount of shares to redeem from vault.| +|`to`|`address`|The destination of assets.| +|`minAmountOut`|`uint256`|The min amount of assets received by `to`.| + +**Returns** + +|Name|Type|Description| +|----|----|-----------| +|`amountOut`|`uint256`|the amount of assets received by `to`.| diff --git a/smartContracts.json b/smartContracts.json index 7a8719faa..c718a0616 100644 --- a/smartContracts.json +++ b/smartContracts.json @@ -70,6 +70,31 @@ "CommonReportTrigger.sol": { "type": "file", "git": "https://github.com/yearn/tokenized-strategy-periphery" + }, + "Yearn4626Router": { + "type": "folder", + "contents": { + "Multicall.sol": { + "type": "file", + "git": "https://github.com/yearn/Yearn-ERC4626-Router" + }, + "PeripheryPayments.sol": { + "type": "file", + "git": "https://github.com/yearn/Yearn-ERC4626-Router" + }, + "SelfPermit.sol": { + "type": "file", + "git": "https://github.com/yearn/Yearn-ERC4626-Router" + }, + "Yearn4626Router.sol": { + "type": "file", + "git": "https://github.com/yearn/Yearn-ERC4626-Router" + }, + "Yearn4626RouterBase.sol": { + "type": "file", + "git": "https://github.com/yearn/Yearn-ERC4626-Router" + } + } } } } @@ -78,6 +103,7 @@ "https://github.com/yearn/yearn-vaults-v3.git", "https://github.com/yearn/tokenized-strategy.git", "https://github.com/yearn/tokenized-strategy-periphery.git", - "https://github.com/yearn/vault-periphery.git" + "https://github.com/yearn/vault-periphery.git", + "https://github.com/yearn/Yearn-ERC4626-Router.git" ] }