Skip to content

Commit

Permalink
Reserve incentives in eUSD vaults and markets
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Camps committed Aug 22, 2024
2 parents a54b7b9 + e3999bc commit bf252e3
Show file tree
Hide file tree
Showing 8 changed files with 367 additions and 113 deletions.
9 changes: 9 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
## Context

Please, provide here any context that could help us to validate the Reward Program(s).

## Merge conditions checklist

- [ ] Ensure there is at least one week between the PR submission and the start of the Program(s).
- [ ] Send funds to the URD; the PR will only be merged after the funds have been received.

**Important**: If the delay between the PR creation and the start of the Program(s) is less than one week, or if we do not see any funds sent to the URD, the PR will not be merged, and the Program(s) will not be created.
16 changes: 8 additions & 8 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export default {
moduleFileExtensions: ["ts", "js"],
transform: {
"^.+\\.tsx?$": "ts-jest",
},
testTimeout: 50_000,
testMatch: ["**/tests/**/*.test.(ts|js)"],
testEnvironment: "node",
};
moduleFileExtensions: ["ts", "js"],
transform: {
"^.+\\.tsx?$": "ts-jest",
},
testTimeout: 50_000,
testMatch: ["**/tests/**/*.test.(ts|js)"],
testEnvironment: "node",
};
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@morpho-org/blue-reward-programs",
"version": "0.0.1",
"version": "1.4.12",
"author": "Morpho Association <contact@morpho.org>",
"license": "MIT",
"main": "lib/index.js",
Expand Down Expand Up @@ -33,7 +33,8 @@
"typescript": "^5.4.5"
},
"dependencies": {
"@morpho-org/blue-rewards-core-sdk": "0.0.5",
"@morpho-org/blue-rewards-core-sdk": "0.0.9",
"@morpho-org/morpho-ts": "^1.4.5",
"viem": "^2.9.31"
},
"lint-staged": {
Expand Down
26 changes: 26 additions & 0 deletions src/airdrop-programs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Address, ChainId } from "@morpho-org/blue-rewards-core-sdk";

export type AirdropRewardProgramArgs = {
claimDate: bigint;
fundsSender: Address;
urdAddress: Address;
tokenAddress: Address;
chainId: ChainId;
cidV0: string;
};

/**
* List of Airdrop programs
* @example
* [
* {
* claimDate: 1717149233n,
* fundsSender: "0xF057afeEc22E220f47AD4220871364e9E828b2e9",
* urdAddress: "0x330eefa8a787552dc5cad3c3ca644844b1e61ddb",
* tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
* cidV0: "QmUSNh34dpKFbX7YMU4fd5JbfkVYzb4e45o3pSqqXvzkKw",
* chainId: ChainId.MAINNET
* }
* ]
*/
export const airdropPrograms: AirdropRewardProgramArgs[] = [];
30 changes: 30 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ import {
RewardMathLib,
UniversalRewardDistributor,
VaultRewardProgram,
AirdropRewardProgram,
RewardProgram,
} from "@morpho-org/blue-rewards-core-sdk";

import { AirdropRewardProgramArgs, airdropPrograms } from "./airdrop-programs";
import { MarketRewardProgramArgs, marketPrograms } from "./market-programs";
import { VaultRewardProgramArgs, vaultPrograms } from "./vault-programs";

Expand All @@ -16,6 +19,12 @@ export const OffchainPrograms = {
getVaultPrograms(): VaultRewardProgram[] {
return vaultPrograms.map((programArgs) => toVaultRewardProgram(programArgs));
},
getAirdropPrograms(): AirdropRewardProgram[] {
return airdropPrograms.map((programArgs) => toAirdropRewardProgram(programArgs));
},
getPrograms(): RewardProgram[] {
return [...this.getMarketPrograms(), ...this.getVaultPrograms(), ...this.getAirdropPrograms()];
},
};

function toMarketRewardProgram(args: MarketRewardProgramArgs): MarketRewardProgram {
Expand Down Expand Up @@ -85,3 +94,24 @@ function toVaultRewardProgram(args: VaultRewardProgramArgs): VaultRewardProgram
amount: args.amount,
});
}

function toAirdropRewardProgram(args: AirdropRewardProgramArgs): AirdropRewardProgram {
const asset = new OnchainAsset({
address: args.tokenAddress,
chainId: args.chainId,
});
const distributor = new UniversalRewardDistributor({
address: args.urdAddress,
chainId: args.chainId,
});

return new AirdropRewardProgram({
createdAt: args.claimDate,
start: args.claimDate,
creator: args.fundsSender,
asset,
distributor,
chainId: args.chainId,
cidV0: args.cidV0,
});
}
142 changes: 131 additions & 11 deletions src/market-programs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [
marketId: "0x104ff0b7c0d67301cb24e3a10b928b0fb0026ee26338e28553b7064fa8b659a9",
rewardAmount: {
supply: 0n,
borrow: parseUnits("1400", 18),
borrow: parseUnits("250", 18),
collateral: 0n,
},
chainId: ChainId.BASE,
Expand All @@ -391,7 +391,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [
marketId: "0x104ff0b7c0d67301cb24e3a10b928b0fb0026ee26338e28553b7064fa8b659a9",
rewardAmount: {
supply: 0n,
borrow: parseUnits("1400", 18),
borrow: parseUnits("250", 18),
collateral: 0n,
},
chainId: ChainId.BASE,
Expand All @@ -405,7 +405,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [
marketId: "0x104ff0b7c0d67301cb24e3a10b928b0fb0026ee26338e28553b7064fa8b659a9",
rewardAmount: {
supply: 0n,
borrow: parseUnits("1400", 18),
borrow: parseUnits("250", 18),
collateral: 0n,
},
chainId: ChainId.BASE,
Expand All @@ -419,7 +419,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [
marketId: "0x104ff0b7c0d67301cb24e3a10b928b0fb0026ee26338e28553b7064fa8b659a9",
rewardAmount: {
supply: 0n,
borrow: parseUnits("1400", 18),
borrow: parseUnits("250", 18),
collateral: 0n,
},
chainId: ChainId.BASE,
Expand All @@ -433,7 +433,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [
marketId: "0x104ff0b7c0d67301cb24e3a10b928b0fb0026ee26338e28553b7064fa8b659a9",
rewardAmount: {
supply: 0n,
borrow: parseUnits("1400", 18),
borrow: parseUnits("250", 18),
collateral: 0n,
},
chainId: ChainId.BASE,
Expand All @@ -447,7 +447,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [
marketId: "0x104ff0b7c0d67301cb24e3a10b928b0fb0026ee26338e28553b7064fa8b659a9",
rewardAmount: {
supply: 0n,
borrow: parseUnits("1400", 18),
borrow: parseUnits("250", 18),
collateral: 0n,
},
chainId: ChainId.BASE,
Expand All @@ -461,7 +461,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [
marketId: "0x104ff0b7c0d67301cb24e3a10b928b0fb0026ee26338e28553b7064fa8b659a9",
rewardAmount: {
supply: 0n,
borrow: parseUnits("1400", 18),
borrow: parseUnits("250", 18),
collateral: 0n,
},
chainId: ChainId.BASE,
Expand All @@ -475,7 +475,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [
marketId: "0x104ff0b7c0d67301cb24e3a10b928b0fb0026ee26338e28553b7064fa8b659a9",
rewardAmount: {
supply: 0n,
borrow: parseUnits("1400", 18),
borrow: parseUnits("250", 18),
collateral: 0n,
},
chainId: ChainId.BASE,
Expand All @@ -489,7 +489,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [
marketId: "0x104ff0b7c0d67301cb24e3a10b928b0fb0026ee26338e28553b7064fa8b659a9",
rewardAmount: {
supply: 0n,
borrow: parseUnits("1400", 18),
borrow: parseUnits("250", 18),
collateral: 0n,
},
chainId: ChainId.BASE,
Expand All @@ -503,7 +503,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [
marketId: "0x104ff0b7c0d67301cb24e3a10b928b0fb0026ee26338e28553b7064fa8b659a9",
rewardAmount: {
supply: 0n,
borrow: parseUnits("1400", 18),
borrow: parseUnits("250", 18),
collateral: 0n,
},
chainId: ChainId.BASE,
Expand All @@ -517,7 +517,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [
marketId: "0x104ff0b7c0d67301cb24e3a10b928b0fb0026ee26338e28553b7064fa8b659a9",
rewardAmount: {
supply: 0n,
borrow: parseUnits("1400", 18),
borrow: parseUnits("250", 18),
collateral: 0n,
},
chainId: ChainId.BASE,
Expand Down Expand Up @@ -657,6 +657,21 @@ export const marketPrograms: MarketRewardProgramArgs[] = [
},
chainId: ChainId.MAINNET,
},
// apxETH/WETH 67000 DINERO
{
start: 1722556800n,
end: 1723766400n,
fundsSender: "0x7f6494D4fBEA1c06daC2250A3FCa81003bF8D20C",
urdAddress: "0x330eefa8a787552DC5cAd3C3cA644844B1E61Ddb",
tokenAddress: "0x6DF0E641FC9847c0c6Fde39bE6253045440c14d3",
marketId: "0x8bbd1763671eb82a75d5f7ca33a0023ffabdd9d1a3d4316f34753685ae988e80",
rewardAmount: {
supply: parseUnits("67000", 18),
borrow: 0n,
collateral: 0n,
},
chainId: ChainId.MAINNET,
},
// bsdETH/ETH Base 600,000 RSR 07/25/2024 08/25/2024 1pm GMT
{
start: 1721912410n,
Expand Down Expand Up @@ -687,4 +702,109 @@ export const marketPrograms: MarketRewardProgramArgs[] = [
},
chainId: ChainId.MAINNET,
},
// UNI/USDC Mainnet 200k PYTH 07/31/2024-10/01/2024 12pm EST
{
start: 1723046400n,
end: 1728316800n,
fundsSender: "0xE64fD4d6f8128A27365Bee615eC9eD33979c782C",
urdAddress: "0x330eefa8a787552DC5cAd3C3cA644844B1E61Ddb",
tokenAddress: "0xeFc0CED4B3D536103e76a1c4c74F0385C8F4Bdd3",
marketId: "0x718af3af39b183758849486340b69466e3e89b84b7884188323416621ee91cb7",
rewardAmount: {
supply: parseUnits("200000", 6),
borrow: 0n,
collateral: 0n,
},
chainId: ChainId.MAINNET,
},
// wstETH / USDT Mainnet 0.62 WETH 08/09/2024 09/07/2024 1pm GMT
{
start: 1723208400n,
end: 1725714000n,
fundsSender: "0x9Cc5b1bc0E1970D44B5Adc7ba51d76a5DD375434",
urdAddress: "0x330eefa8a787552DC5cAd3C3cA644844B1E61Ddb",
tokenAddress: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
marketId: "0x6a6c8e41a6a7ccbea68e1e6a19ece1fdd863b2b6c9e0f71bbcd4dcbe8b1062e8",
rewardAmount: {
supply: 623424419249185042n,
borrow: 0n,
collateral: 0n,
},
chainId: ChainId.MAINNET,
},
// pufETH / USDC Mainnet 0.094 WETH 08/09/2024 09/07/2024 1pm GMT
{
start: 1723208400n,
end: 1725714000n,
fundsSender: "0x9Cc5b1bc0E1970D44B5Adc7ba51d76a5DD375434",
urdAddress: "0x330eefa8a787552DC5cAd3C3cA644844B1E61Ddb",
tokenAddress: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
marketId: "0x7e9c708876fa3816c46aeb08937b51aa0461c2af3865ecb306433db8a80b1d1b",
rewardAmount: {
supply: 94597806657332024n,
borrow: 0n,
collateral: 0n,
},
chainId: ChainId.MAINNET,
},
// apxETH/WETH 250000 DINERO
{
start: 1724410800n,
end: 1726830000n,
fundsSender: "0x7f6494D4fBEA1c06daC2250A3FCa81003bF8D20C",
urdAddress: "0x330eefa8a787552DC5cAd3C3cA644844B1E61Ddb",
tokenAddress: "0x6DF0E641FC9847c0c6Fde39bE6253045440c14d3",
marketId: "0x8bbd1763671eb82a75d5f7ca33a0023ffabdd9d1a3d4316f34753685ae988e80",
rewardAmount: {
supply: parseUnits("250000", 18),
borrow: 0n,
collateral: 0n,
},
chainId: ChainId.MAINNET,
},
// bsdETH/eUSD Base 1,250 eUSD 08/23-09/05 6pm GMT
{
start: 1724436000n,
end: 1725559200n,
fundsSender: "0x03d03A026E71979BE3b08D44B01eAe4C5FF9da99",
urdAddress: "0x5400dBb270c956E8985184335A1C62AcA6Ce1333",
tokenAddress: "0xCfA3Ef56d303AE4fAabA0592388F19d7C3399FB4",
marketId: "0xf9ed1dba3b6ba1ede10e2115a9554e9c52091c9f1b1af21f9e0fecc855ee74bf",
rewardAmount: {
supply: 0n,
borrow: parseUnits("1250", 18),
collateral: 0n,
},
chainId: ChainId.BASE,
},
// hyUSD/eUSD Base 1,250 eUSD 08/23-09/05 6pm GMT
{
start: 1724436000n,
end: 1725559200n,
fundsSender: "0x03d03A026E71979BE3b08D44B01eAe4C5FF9da99",
urdAddress: "0x5400dBb270c956E8985184335A1C62AcA6Ce1333",
tokenAddress: "0xCfA3Ef56d303AE4fAabA0592388F19d7C3399FB4",
marketId: "0x3a5bdf0be8d820c1303654b078b14f8fc6d715efaeca56cec150b934bdcbff31",
rewardAmount: {
supply: 0n,
borrow: parseUnits("1250", 18),
collateral: 0n,
},
chainId: ChainId.BASE,
},
// ETH+/eUSD Mainnet 1,250 eUSD 08/23-09/05 6pm GMT
{
start: 1724436000n,
end: 1725559200n,
fundsSender: "0x03d03A026E71979BE3b08D44B01eAe4C5FF9da99",
urdAddress: "0x330eefa8a787552DC5cAd3C3cA644844B1E61Ddb",
tokenAddress: "0xA0d69E286B938e21CBf7E51D71F6A4c8918f482F",
marketId: "0x3f4d007982a480dd99052c05d811cf6838ce61b2a2be8dc52fca107f783d1f15",
rewardAmount: {
supply: 0n,
borrow: parseUnits("1250", 18),
collateral: 0n,
},
chainId: ChainId.MAINNET,
},
];
Loading

0 comments on commit bf252e3

Please sign in to comment.