Skip to content
Open
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
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PRIVATE_KEY=""
LINEA_RPC_URL=""
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,12 @@
[submodule "lib/periphery-contracts"]
path = lib/periphery-contracts
url = https://github.com/zerolend/periphery-contracts
[submodule "lib/governance"]
path = lib/governance
url = https://github.com/zerolend/governance
[submodule "lib/pyth-oracles"]
path = lib/pyth-oracles
url = https://github.com/zerolend/pyth-oracles
[submodule "lib/pyth-network-contracts"]
path = lib/pyth-network-contracts
url = https://github.com/pyth-network/pyth-sdk-solidity
17 changes: 16 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
[profile.default]
src = "src"
out = "out"
libs = ["lib"]
solc = "0.8.12"
libs = [
"lib/core-contracts",
"lib/forge-std",
"lib/periphery-contracts",
"lib/governance"
]
remappings = [
"forge-std/=lib/forge-std/src/",
"periphery-contracts/=lib/periphery-contracts/",
"@zerolendxyz/core-v3/=lib/core-contracts/",
"@openzeppelin/=lib/core-contracts/contracts/dependencies/openzeppelin/contracts",
"@pythnetwork/pyth-sdk-solidity/=lib/pyth-network-contracts/"
]

[rpc_endpoints]
linea-mainnet = "https://linea-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
2 changes: 1 addition & 1 deletion lib/core-contracts
2 changes: 1 addition & 1 deletion lib/forge-std
1 change: 1 addition & 0 deletions lib/governance
Submodule governance added at a20868
1 change: 1 addition & 0 deletions lib/pyth-network-contracts
Submodule pyth-network-contracts added at c24b3e
1 change: 1 addition & 0 deletions lib/pyth-oracles
Submodule pyth-oracles added at 3c7662
2 changes: 1 addition & 1 deletion script/Deploy_P001.sol → script/Deploy_P001.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.19;
pragma solidity 0.8.12;

// ███████╗███████╗██████╗ ██████╗
// ╚══███╔╝██╔════╝██╔══██╗██╔═══██╗
Expand Down
28 changes: 28 additions & 0 deletions script/Deploy_P002.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.12;

// ███████╗███████╗██████╗ ██████╗
// ╚══███╔╝██╔════╝██╔══██╗██╔═══██╗
// ███╔╝ █████╗ ██████╔╝██║ ██║
// ███╔╝ ██╔══╝ ██╔══██╗██║ ██║
// ███████╗███████╗██║ ██║╚██████╔╝
// ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═════╝

// Website: https://zerolend.xyz
// Discord: https://discord.gg/zerolend
// Twitter: https://twitter.com/zerolendxyz
// Telegram: https://t.me/zerolendxyz

import { P002_UpgradeIncentiveController } from "src/p002/P002_UpgradeIncentivesController.sol";
import {Script} from "../lib/forge-std/src/Script.sol";

contract Deploy_P002 is Script {
function run() external {
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);

new P002_UpgradeIncentiveController();

vm.stopBroadcast();
}
}
28 changes: 28 additions & 0 deletions script/Deploy_P003.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.12;

// ███████╗███████╗██████╗ ██████╗
// ╚══███╔╝██╔════╝██╔══██╗██╔═══██╗
// ███╔╝ █████╗ ██████╔╝██║ ██║
// ███╔╝ ██╔══╝ ██╔══██╗██║ ██║
// ███████╗███████╗██║ ██║╚██████╔╝
// ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═════╝

// Website: https://zerolend.xyz
// Discord: https://discord.gg/zerolend
// Twitter: https://twitter.com/zerolendxyz
// Telegram: https://t.me/zerolendxyz

import { P003_UpdateCliffForAirdrops } from "src/p003/P003_UpdateCliffForAirdrops.sol";
import {Script} from "../lib/forge-std/src/Script.sol";

contract Deploy_P003 is Script {
function run() external {
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);

new P003_UpdateCliffForAirdrops();

vm.stopBroadcast();
}
}
30 changes: 30 additions & 0 deletions script/Deploy_P004.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.12;

// ███████╗███████╗██████╗ ██████╗
// ╚══███╔╝██╔════╝██╔══██╗██╔═══██╗
// ███╔╝ █████╗ ██████╔╝██║ ██║
// ███╔╝ ██╔══╝ ██╔══██╗██║ ██║
// ███████╗███████╗██║ ██║╚██████╔╝
// ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═════╝

// Website: https://zerolend.xyz
// Discord: https://discord.gg/zerolend
// Twitter: https://twitter.com/zerolendxyz
// Telegram: https://t.me/zerolendxyz

// visit https://github.com/zerolend/proposals for information about tests and deployment scripts
import { Script } from "lib/forge-std/src/Script.sol";
import { P004_UpgradePythOracles } from "src/p004/P004_UpgradePythOracles.sol";

contract Deploy_P004 is Script {

function run() external {
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);

new P004_UpgradePythOracles();

vm.stopBroadcast();
}
}
2 changes: 1 addition & 1 deletion src/p001/P001_LineaIsoModeAssests.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.19;
pragma solidity 0.8.12;

// ███████╗███████╗██████╗ ██████╗
// ╚══███╔╝██╔════╝██╔══██╗██╔═══██╗
Expand Down
41 changes: 41 additions & 0 deletions src/p002/P002_UpgradeIncentivesController.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.12;

// ███████╗███████╗██████╗ ██████╗
// ╚══███╔╝██╔════╝██╔══██╗██╔═══██╗
// ███╔╝ █████╗ ██████╔╝██║ ██║
// ███╔╝ ██╔══╝ ██╔══██╗██║ ██║
// ███████╗███████╗██║ ██║╚██████╔╝
// ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═════╝

// Website: https://zerolend.xyz
// Discord: https://discord.gg/zerolend
// Twitter: https://twitter.com/zerolendxyz
// Telegram: https://t.me/zerolendxyz

// visit https://github.com/zerolend/proposals for information about tests and deployment scripts

import {RewardsController} from "lib/periphery-contracts/contracts/rewards/RewardsController.sol";

interface IPoolAddressProvider {
function setAddressAsProxy(bytes32 id, address newImplementationAddress) external;
}

contract P002_UpgradeIncentiveController {
address private constant EMISSIONS_MANAGER = 0x749dF84Fd6DE7c0A67db3827e5118259ed3aBBa5;
address private constant STAKING = 0x2666951A62d82860E8e1385581E2FB7669097647;
address private constant POOL_ADDRESS_PROVIDER = 0xC44827C51d00381ed4C52646aeAB45b455d200eB;
bytes32 private constant INCENTIVE_CONTROLLER_ID = 0x703c2c8634bed68d98c029c18f310e7f7ec0e5d6342c590190b3cb8b3ba54532;

IPoolAddressProvider poolAddressProvider;
RewardsController rewardsControllerImpl;

constructor() {
poolAddressProvider = IPoolAddressProvider(POOL_ADDRESS_PROVIDER);
rewardsControllerImpl = new RewardsController(EMISSIONS_MANAGER, STAKING);
}

function execute() public {
poolAddressProvider.setAddressAsProxy(INCENTIVE_CONTROLLER_ID, address(rewardsControllerImpl));
}
}
3 changes: 3 additions & 0 deletions src/p002/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Proposal 002

Proposal 002 helps in upgrading the IncentivesController proxy with the fixed boosted-rewards code, and some getters.
59 changes: 59 additions & 0 deletions src/p003/P003_UpdateCliffForAirdrops.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.12;

// ███████╗███████╗██████╗ ██████╗
// ╚══███╔╝██╔════╝██╔══██╗██╔═══██╗
// ███╔╝ █████╗ ██████╔╝██║ ██║
// ███╔╝ ██╔══╝ ██╔══██╗██║ ██║
// ███████╗███████╗██║ ██║╚██████╔╝
// ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═════╝

// Website: https://zerolend.xyz
// Discord: https://discord.gg/zerolend
// Twitter: https://twitter.com/zerolendxyz
// Telegram: https://t.me/zerolendxyz

// visit https://github.com/zerolend/proposals for information about tests and deployment scripts

import { IVestedZeroNFT } from "lib/governance/contracts/interfaces/IVestedZeroNFT.sol";
import { VestedZeroNFT } from "lib/governance/contracts/vesting/VestedZeroNFT.sol";

contract P003_UpdateCliffForAirdrops {
uint256 public constant LINEAR_DURATION = 86400 * 91;
uint256 public constant CLIFF_DURATION = 86400 * 90;
address public constant VESTED_ZERO_NFT_PROXY_ADDRESS = 0x9FA72ea96591e486FF065E7C8A89282dEDfA6C12;
uint256[] public tokenIds;
VestedZeroNFT public vestedZeroNFT;

constructor() {
vestedZeroNFT = IVestedZeroNFT(VESTED_ZERO_NFT_PROXY_ADDRESS);
}

function execute() public {

uint256 lastTokenId = vestedZeroNFT.lastTokenId();

for (uint256 i = 0; i < lastTokenId; i++) {
getAirdropTokenId(i);
}

uint256[] memory linearDuration = new uint256[](tokenIds.length);
uint256[] memory cliffDuration = new uint256[](tokenIds.length);

for (uint256 i = 0; i < tokenIds.length; i++) {
linearDuration[i] = LINEAR_DURATION;
cliffDuration[i] = CLIFF_DURATION;
}

vestedZeroNFT.updateCliffDuration(tokenIds, linearDuration, cliffDuration);
}

function getAirdropTokenId(uint256 i) public {
(uint256 category,, uint256 cliffDuration) = vestedZeroNFT.tokenIdToLockDetails(i);
if (category == IVestedZeroNFT.Category.AIRDROP) {
if (cliffDuration > 86400 * 90) {
tokenIds.push(i);
}
}
}
}
3 changes: 3 additions & 0 deletions src/p003/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Proposal 003

Proposal 003 helps in updating the cliff duration from 6 months to 3 months for all airdrop vests.
30 changes: 30 additions & 0 deletions src/p004/P004_UpgradePythOracles.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.12;

// ███████╗███████╗██████╗ ██████╗
// ╚══███╔╝██╔════╝██╔══██╗██╔═══██╗
// ███╔╝ █████╗ ██████╔╝██║ ██║
// ███╔╝ ██╔══╝ ██╔══██╗██║ ██║
// ███████╗███████╗██║ ██║╚██████╔╝
// ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═════╝

// Website: https://zerolend.xyz
// Discord: https://discord.gg/zerolend
// Twitter: https://twitter.com/zerolendxyz
// Telegram: https://t.me/zerolendxyz

// visit https://github.com/zerolend/proposals for information about tests and deployment scripts
import { PythAggregatorV3 } from "lib/pyth-oracles/contracts/PythAggregatorV3.sol";

contract P004_UpgradePythOracles {
PythAggregatorV3 pythOracle;

event PythOracleDeployed(address indexed deployer, address indexed pythOracleAddress);

constructor() {}

function execute(address pyth, bytes32 priceId, uint64 maxStalePeriod) public {
pythOracle = new PythAggregatorV3(pyth, priceId, maxStalePeriod);
emit PythOracleDeployed(msg.sender, address(pythOracle));
}
}
3 changes: 3 additions & 0 deletions src/p004/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Proposal P004

Proposal P004 helps in updating the Pyth Oracle implementation in order to avoid stale prices.
2 changes: 1 addition & 1 deletion test/Test_P001.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
pragma solidity ^0.8.12;

import {Test, console} from "../lib/forge-std/src/Test.sol";
import {P001_LineaIsoModeAssests, IPoolConfigurator, IACLManager} from "../src/p001/P001_LineaIsoModeAssests.sol";
Expand Down
Loading