Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
df8f616
fix test
ethereumdegen Oct 14, 2025
10b2eb4
draft poolv3 with agnostic price
ethereumdegen Oct 23, 2025
f45f4e2
add
ethereumdegen Oct 23, 2025
d51a46f
poolsv3 compiles w q96
ethereumdegen Oct 23, 2025
96454e1
uniswapv3 price adapter draft
ethereumdegen Oct 27, 2025
3a31e11
tests pass for uniswap v3 price adapter
ethereumdegen Oct 27, 2025
b9f0159
add to uniswap v4 state view
ethereumdegen Oct 28, 2025
33bf522
add dependencies
ethereumdegen Oct 29, 2025
b4f06af
v4 works with no twap
ethereumdegen Oct 30, 2025
16d7157
using recommended library from uniswap docs
ethereumdegen Oct 30, 2025
3e373e8
add
ethereumdegen Nov 3, 2025
1c96e02
Merge branch 'feature/agnostic-oracle' of github.com:teller-protocol/…
ethereumdegen Nov 3, 2025
201b333
Merge branch 'develop' of github.com:teller-protocol/teller-protocol-…
ethereumdegen Nov 3, 2025
75a3997
add
ethereumdegen Nov 10, 2025
67fc682
merge in develop
ethereumdegen Nov 10, 2025
d5a831f
add to price adapter aerodrome
ethereumdegen Nov 10, 2025
33ac643
tests work better
ethereumdegen Nov 10, 2025
109f275
tests pass
ethereumdegen Nov 13, 2025
7643664
add
ethereumdegen Nov 13, 2025
bb07ae2
add to test
ethereumdegen Nov 17, 2025
fe6119c
test runs but fails
ethereumdegen Nov 17, 2025
7922ae5
test passes
ethereumdegen Nov 17, 2025
e0a2170
test pass
ethereumdegen Nov 17, 2025
e4b5141
v3 deploy scripts
ethereumdegen Nov 18, 2025
94fbf66
ready to deploy
ethereumdegen Nov 18, 2025
d0da1c9
ready to deploy
ethereumdegen Nov 18, 2025
a08a762
deployed to base
ethereumdegen Nov 18, 2025
43646d0
reset deployments
ethereumdegen Nov 18, 2025
53cf89a
reset deployment
ethereumdegen Nov 18, 2025
5d1eb99
reset deployment
ethereumdegen Nov 18, 2025
3d6be3d
try to deploy
ethereumdegen Nov 18, 2025
2705ffc
deployed contracts on base
ethereumdegen Nov 18, 2025
a430688
improve deploy scripts
ethereumdegen Nov 18, 2025
369aad3
update factory v3
ethereumdegen Nov 20, 2025
075daa8
reset base state
ethereumdegen Nov 20, 2025
1ab3c64
improve PoolV3 reliance on lib
ethereumdegen Nov 20, 2025
ea82f4b
reset migrations
ethereumdegen Nov 20, 2025
1c73da1
deployed
ethereumdegen Nov 20, 2025
bf37eb5
uniswap v2 adapter draft
ethereumdegen Nov 21, 2025
e55587e
deploy script
ethereumdegen Nov 21, 2025
86ce047
deployed univ3 price adapter
ethereumdegen Nov 21, 2025
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
7,780 changes: 245 additions & 7,535 deletions packages/contracts/.openzeppelin/unknown-8453.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

// Contracts
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

// Interfaces
import "../../../interfaces/ITellerV2.sol";
import "../../../interfaces/IProtocolFee.sol";
import "../../../interfaces/ITellerV2Storage.sol";
import "../../../libraries/NumbersLib.sol";

import {IUniswapPricingLibrary} from "../../../interfaces/IUniswapPricingLibrary.sol";

import "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol";

import { IERC4626 } from "../../../interfaces/IERC4626.sol";

import { ILenderCommitmentGroup_V3 } from "../../../interfaces/ILenderCommitmentGroup_V3.sol";


contract LenderCommitmentGroupFactory_V3 is OwnableUpgradeable {
using AddressUpgradeable for address;
using NumbersLib for uint256;


//this is the beacon proxy
address public lenderGroupBeacon;



mapping(address => uint256) public deployedLenderGroupContracts;

event DeployedLenderGroupContract(address indexed groupContract);



/**
* @notice Initializes the factory contract.
* @param _lenderGroupBeacon The address of the beacon proxy used for deploying group contracts.
*/
function initialize(address _lenderGroupBeacon )
external
initializer
{
lenderGroupBeacon = _lenderGroupBeacon;

__Ownable_init_unchained();
}


/**
* @notice Deploys a new lender commitment group pool contract.
* @dev The function initializes the deployed contract and optionally adds an initial principal amount.
* @param _initialPrincipalAmount The initial principal amount to be deposited into the group contract.
* @param _commitmentGroupConfig Configuration parameters for the lender commitment group.
* @param _priceAdapterAddress Address for the pool price adapter
* @param _priceAdapterRoute Encoded roue for the price adapter
* @return newGroupContract_ Address of the newly deployed group contract.
*/
function deployLenderCommitmentGroupPool(
uint256 _initialPrincipalAmount,
ILenderCommitmentGroup_V3.CommitmentGroupConfig calldata _commitmentGroupConfig,
address _priceAdapterAddress,
bytes calldata _priceAdapterRoute
) external returns ( address ) {


BeaconProxy newGroupContract_ = new BeaconProxy(
lenderGroupBeacon,
abi.encodeWithSelector(
ILenderCommitmentGroup_V3.initialize.selector, //this initializes
_commitmentGroupConfig,
_priceAdapterAddress,
_priceAdapterRoute

)
);

deployedLenderGroupContracts[address(newGroupContract_)] = block.number; //consider changing this ?
emit DeployedLenderGroupContract(address(newGroupContract_));



//it is not absolutely necessary to have this call here but it allows the user to potentially save a tx step so it is nice to have .
if (_initialPrincipalAmount > 0) {
_depositPrincipal(
address(newGroupContract_),
_initialPrincipalAmount,
_commitmentGroupConfig.principalTokenAddress

);
}


//transfer ownership to msg.sender
OwnableUpgradeable(address(newGroupContract_))
.transferOwnership(msg.sender);


return address(newGroupContract_) ;
}


/**
* @notice Adds principal tokens to a commitment group.
* @param _newGroupContract The address of the group contract to add principal tokens to.
* @param _initialPrincipalAmount The amount of principal tokens to add.
* @param _principalTokenAddress The address of the principal token contract.
*/
function _depositPrincipal(
address _newGroupContract,
uint256 _initialPrincipalAmount,
address _principalTokenAddress
) internal returns (uint256) {


IERC20(_principalTokenAddress).transferFrom(
msg.sender,
address(this),
_initialPrincipalAmount
);
IERC20(_principalTokenAddress).approve(
_newGroupContract,
_initialPrincipalAmount
);

address sharesRecipient = msg.sender;

uint256 sharesAmount_ = IERC4626( address(_newGroupContract) )
.deposit(
_initialPrincipalAmount,
sharesRecipient
);

return sharesAmount_;
}

}
Loading