Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ contract LenderCommitmentGroup_Pool_V2 is
uint256 _principalAmount,
uint256 _maxPrincipalPerCollateralAmount

) public view virtual returns (uint256) {
) internal view virtual returns (uint256) {

return
MathUpgradeable.mulDiv(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ abstract contract OracleProtectedChild {
modifier onlyOracleApproved() {

IOracleProtectionManager oracleManager = IOracleProtectionManager(ORACLE_MANAGER);
require( oracleManager .isOracleApproved(msg.sender ) , "Oracle: Not Approved");
require( oracleManager .isOracleApproved(msg.sender ) , "O_NA");
_;
}

modifier onlyOracleApprovedAllowEOA() {

IOracleProtectionManager oracleManager = IOracleProtectionManager(ORACLE_MANAGER);
require( oracleManager .isOracleApprovedAllowEOA(msg.sender ) , "Oracle: Not Approved");
require( oracleManager .isOracleApprovedAllowEOA(msg.sender ) , "O_NA");
_;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ const deployFn: DeployFunction = async (hre) => {
)
const tellerV2Address = await tellerV2.getAddress()


// const uniswapPricingLibraryV2 = await hre.contracts.get('UniswapPricingLibraryV2')

const smartCommitmentForwarderAddress =
await SmartCommitmentForwarder.getAddress()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import { DeployFunction } from 'hardhat-deploy/dist/types'

import { get_ecosystem_contract_address } from "../../helpers/ecosystem-contracts-lookup"


const deployFn: DeployFunction = async (hre) => {
hre.log('----------')
hre.log('')
hre.log('Lender pools V2: Proposing upgrade...')



const lenderCommitmentGroupV2BeaconProxy = await hre.contracts.get('LenderCommitmentGroupBeaconV2')

const tellerV2 = await hre.contracts.get('TellerV2')
const SmartCommitmentForwarder = await hre.contracts.get(
'SmartCommitmentForwarder'
)
const tellerV2Address = await tellerV2.getAddress()


const smartCommitmentForwarderAddress =
await SmartCommitmentForwarder.getAddress()


let uniswapV3FactoryAddress: string = get_ecosystem_contract_address( hre.network.name, "uniswapV3Factory" ) ;


const uniswapPricingLibraryV2 = await hre.deployments.get('UniswapPricingLibraryV2')



//this is why the owner of the beacon should be timelock controller !
// so we can upgrade it like this . Using a proposal. This actually goes AROUND the proxy admin, interestingly.
await hre.upgrades.proposeBatchTimelock({
title: 'Lender Pools V2: Upgrade Rollover Fns',
description: `
# Lender Pools V2

* A patch to add readonly fns for rollover.
`,
_steps: [
{
beacon: lenderCommitmentGroupV2BeaconProxy,
implFactory: await hre.ethers.getContractFactory('LenderCommitmentGroup_Pool_V2', {
libraries: {
UniswapPricingLibraryV2: uniswapPricingLibraryV2.address,
},
}),

opts: {
unsafeSkipStorageCheck: true,
unsafeAllow: [
'constructor',
'state-variable-immutable',
'external-library-linking',
],
constructorArgs: [
tellerV2Address,
smartCommitmentForwarderAddress,
uniswapV3FactoryAddress,

],
},
},
],
})

hre.log('done.')
hre.log('')
hre.log('----------')

return true
}

// tags and deployment
deployFn.id = 'lender-commitment-group-beacon-v2:upgrade-readonly-fns'
deployFn.tags = ['lender-commitment-group-beacon-v2']
deployFn.dependencies = [
'teller-v2:deploy',
'smart-commitment-forwarder:deploy',
'teller-v2:uniswap-pricing-library-v2',

'lender-commitment-group-beacon-v2:deploy'
]

deployFn.skip = async (hre) => {
return !hre.network.live || !['sepolia','polygon','base','mainnet','arbitrum','katana','optimism'].includes(hre.network.name)
}
export default deployFn