@gearbox-protocol/sdk 3.0.0-next.166 → 3.0.0-next.168
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core/bot.d.ts +11 -0
- package/lib/core/bot.js +23 -0
- package/lib/core/creditAccount.d.ts +1 -1
- package/lib/core/creditAccount.js +1 -1
- package/lib/core/transactions.d.ts +19 -1
- package/lib/core/transactions.js +43 -1
- package/lib/gearboxRewards/abi.d.ts +2 -0
- package/lib/gearboxRewards/abi.js +54 -0
- package/lib/gearboxRewards/api.d.ts +83 -0
- package/lib/gearboxRewards/api.js +250 -0
- package/lib/gearboxRewards/apy.d.ts +37 -0
- package/lib/gearboxRewards/apy.js +65 -0
- package/lib/gearboxRewards/extraAPY.d.ts +36 -0
- package/lib/gearboxRewards/extraAPY.js +133 -0
- package/lib/gearboxRewards/index.d.ts +4 -0
- package/lib/gearboxRewards/index.js +20 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +3 -0
- package/lib/payload/bot.d.ts +13 -0
- package/lib/payload/bot.js +2 -0
- package/lib/types/SafeERC20.d.ts +27 -0
- package/lib/types/SafeERC20.js +2 -0
- package/lib/types/factories/SafeERC20__factory.d.ts +49 -0
- package/lib/types/factories/SafeERC20__factory.js +77 -0
- package/lib/types/factories/index.d.ts +1 -0
- package/lib/types/factories/index.js +3 -1
- package/lib/types/index.d.ts +2 -0
- package/lib/types/index.js +3 -1
- package/package.json +5 -5
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BotBaseType, BotDataPayload, BotDetailedType } from "../payload/bot";
|
|
2
|
+
export declare class BotData {
|
|
3
|
+
readonly address: string;
|
|
4
|
+
readonly baseType: BotBaseType;
|
|
5
|
+
readonly detailedType: BotDetailedType;
|
|
6
|
+
readonly minHealthFactor: bigint;
|
|
7
|
+
readonly maxHealthFactor: bigint;
|
|
8
|
+
readonly premiumScaleFactor: bigint;
|
|
9
|
+
readonly feeScaleFactor: bigint;
|
|
10
|
+
constructor(payload: BotDataPayload);
|
|
11
|
+
}
|
package/lib/core/bot.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BotData = void 0;
|
|
4
|
+
const sdk_gov_1 = require("@gearbox-protocol/sdk-gov");
|
|
5
|
+
class BotData {
|
|
6
|
+
address;
|
|
7
|
+
baseType;
|
|
8
|
+
detailedType;
|
|
9
|
+
minHealthFactor;
|
|
10
|
+
maxHealthFactor;
|
|
11
|
+
premiumScaleFactor;
|
|
12
|
+
feeScaleFactor;
|
|
13
|
+
constructor(payload) {
|
|
14
|
+
this.address = payload.address.toLowerCase();
|
|
15
|
+
this.baseType = payload.baseType;
|
|
16
|
+
this.detailedType = payload.detailedType;
|
|
17
|
+
this.minHealthFactor = (0, sdk_gov_1.toBigInt)(payload.minHealthFactor);
|
|
18
|
+
this.maxHealthFactor = (0, sdk_gov_1.toBigInt)(payload.maxHealthFactor);
|
|
19
|
+
this.premiumScaleFactor = (0, sdk_gov_1.toBigInt)(payload.premiumScaleFactor);
|
|
20
|
+
this.feeScaleFactor = (0, sdk_gov_1.toBigInt)(payload.feeScaleFactor);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.BotData = BotData;
|
|
@@ -101,7 +101,7 @@ export declare class CreditAccountData {
|
|
|
101
101
|
readonly twvUSD: bigint;
|
|
102
102
|
readonly cumulativeIndexLastUpdate: bigint;
|
|
103
103
|
readonly cumulativeQuotaInterest: bigint;
|
|
104
|
-
readonly activeBots: string
|
|
104
|
+
readonly activeBots: Record<string, true>;
|
|
105
105
|
readonly balances: Record<string, bigint>;
|
|
106
106
|
readonly collateralTokens: Array<string>;
|
|
107
107
|
readonly allBalances: Record<string, CaTokenBalance>;
|
|
@@ -73,7 +73,7 @@ class CreditAccountData {
|
|
|
73
73
|
sdk_gov_1.PERCENTAGE_FACTOR);
|
|
74
74
|
this.cumulativeIndexLastUpdate = (0, sdk_gov_1.toBigInt)(payload.cumulativeIndexLastUpdate);
|
|
75
75
|
this.cumulativeQuotaInterest = (0, sdk_gov_1.toBigInt)(payload.cumulativeQuotaInterest);
|
|
76
|
-
this.activeBots = payload.activeBots.map(b => b.toLowerCase());
|
|
76
|
+
this.activeBots = Object.fromEntries(payload.activeBots.map(b => [b.toLowerCase(), true]));
|
|
77
77
|
payload.balances.forEach(b => {
|
|
78
78
|
const token = b.token.toLowerCase();
|
|
79
79
|
const balance = {
|
|
@@ -10,7 +10,7 @@ interface PoolEvent {
|
|
|
10
10
|
readonly poolName?: string;
|
|
11
11
|
}
|
|
12
12
|
export interface TxSerialized {
|
|
13
|
-
type: "TxAddLiquidity" | "TxRemoveLiquidity" | "TxSwap" | "TxAddCollateral" | "TxIncreaseBorrowAmount" | "TxDecreaseBorrowAmount" | "TxOpenAccount" | "TxRepayAccount" | "TxCloseAccount" | "TxApprove" | "TxOpenMultitokenAccount" | "TxClaimReward" | "TxClaimNFT" | "TxClaimRewards" | "TxEnableTokens" | "TxUpdateQuota" | "TxGaugeStake" | "TxGaugeUnstake" | "TxGaugeClaim" | "TxGaugeVote" | "TxWithdrawCollateral";
|
|
13
|
+
type: "TxAddLiquidity" | "TxRemoveLiquidity" | "TxSwap" | "TxAddCollateral" | "TxIncreaseBorrowAmount" | "TxDecreaseBorrowAmount" | "TxOpenAccount" | "TxRepayAccount" | "TxCloseAccount" | "TxApprove" | "TxOpenMultitokenAccount" | "TxClaimReward" | "TxClaimNFT" | "TxClaimRewards" | "TxEnableTokens" | "TxUpdateQuota" | "TxGaugeStake" | "TxGaugeUnstake" | "TxGaugeClaim" | "TxGaugeVote" | "TxWithdrawCollateral" | "TxAddBot" | "TxRemoveBot";
|
|
14
14
|
content: string;
|
|
15
15
|
}
|
|
16
16
|
export declare class TxSerializer {
|
|
@@ -286,4 +286,22 @@ export declare class TxWithdrawCollateral extends EVMTx implements CMEvent {
|
|
|
286
286
|
toString(): string;
|
|
287
287
|
serialize(): TxSerialized;
|
|
288
288
|
}
|
|
289
|
+
interface TxAddBotProps extends EVMTxProps {
|
|
290
|
+
creditManager: string;
|
|
291
|
+
creditManagerName?: string;
|
|
292
|
+
}
|
|
293
|
+
export declare class TxAddBot extends EVMTx implements CMEvent {
|
|
294
|
+
readonly creditManager: string;
|
|
295
|
+
readonly creditManagerName?: string;
|
|
296
|
+
constructor(opts: TxAddBotProps);
|
|
297
|
+
toString(): string;
|
|
298
|
+
serialize(): TxSerialized;
|
|
299
|
+
}
|
|
300
|
+
export declare class TxRemoveBot extends EVMTx implements CMEvent {
|
|
301
|
+
readonly creditManager: string;
|
|
302
|
+
readonly creditManagerName?: string;
|
|
303
|
+
constructor(opts: TxAddBotProps);
|
|
304
|
+
toString(): string;
|
|
305
|
+
serialize(): TxSerialized;
|
|
306
|
+
}
|
|
289
307
|
export {};
|
package/lib/core/transactions.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TxWithdrawCollateral = exports.TxGaugeVote = exports.TxGaugeClaim = exports.TxGaugeUnstake = exports.TxGaugeStake = exports.TxUpdateQuota = exports.TxEnableTokens = exports.TxApprove = exports.TxCloseAccount = exports.TxRepayAccount = exports.TxClaimRewards = exports.TxClaimNFT = exports.TxClaimReward = exports.TxOpenMultitokenAccount = exports.TxOpenAccount = exports.TxDecreaseBorrowAmount = exports.TxIncreaseBorrowAmount = exports.TxAddCollateral = exports.TXSwap = exports.TxRemoveLiquidity = exports.TxAddLiquidity = exports.TxSerializer = void 0;
|
|
3
|
+
exports.TxRemoveBot = exports.TxAddBot = exports.TxWithdrawCollateral = exports.TxGaugeVote = exports.TxGaugeClaim = exports.TxGaugeUnstake = exports.TxGaugeStake = exports.TxUpdateQuota = exports.TxEnableTokens = exports.TxApprove = exports.TxCloseAccount = exports.TxRepayAccount = exports.TxClaimRewards = exports.TxClaimNFT = exports.TxClaimReward = exports.TxOpenMultitokenAccount = exports.TxOpenAccount = exports.TxDecreaseBorrowAmount = exports.TxIncreaseBorrowAmount = exports.TxAddCollateral = exports.TXSwap = exports.TxRemoveLiquidity = exports.TxAddLiquidity = exports.TxSerializer = void 0;
|
|
4
4
|
const sdk_gov_1 = require("@gearbox-protocol/sdk-gov");
|
|
5
5
|
const contractsRegister_1 = require("../contracts/contractsRegister");
|
|
6
6
|
const math_1 = require("../utils/math");
|
|
@@ -55,6 +55,10 @@ class TxSerializer {
|
|
|
55
55
|
return new TxGaugeVote(params);
|
|
56
56
|
case "TxWithdrawCollateral":
|
|
57
57
|
return new TxWithdrawCollateral(params);
|
|
58
|
+
case "TxAddBot":
|
|
59
|
+
return new TxAddBot(params);
|
|
60
|
+
case "TxRemoveBot":
|
|
61
|
+
return new TxRemoveBot(params);
|
|
58
62
|
default:
|
|
59
63
|
throw new Error(`Unknown transaction for parsing: ${e.type}`);
|
|
60
64
|
}
|
|
@@ -553,3 +557,41 @@ class TxWithdrawCollateral extends eventOrTx_1.EVMTx {
|
|
|
553
557
|
}
|
|
554
558
|
}
|
|
555
559
|
exports.TxWithdrawCollateral = TxWithdrawCollateral;
|
|
560
|
+
class TxAddBot extends eventOrTx_1.EVMTx {
|
|
561
|
+
creditManager;
|
|
562
|
+
creditManagerName;
|
|
563
|
+
constructor(opts) {
|
|
564
|
+
super(opts);
|
|
565
|
+
this.creditManager = opts.creditManager;
|
|
566
|
+
this.creditManagerName = opts.creditManagerName;
|
|
567
|
+
}
|
|
568
|
+
toString() {
|
|
569
|
+
return `Credit Account ${this.creditManagerName || (0, contractsRegister_1.getContractName)(this.creditManager)}: bot enabled`;
|
|
570
|
+
}
|
|
571
|
+
serialize() {
|
|
572
|
+
return {
|
|
573
|
+
type: "TxAddBot",
|
|
574
|
+
content: JSON.stringify(this),
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
exports.TxAddBot = TxAddBot;
|
|
579
|
+
class TxRemoveBot extends eventOrTx_1.EVMTx {
|
|
580
|
+
creditManager;
|
|
581
|
+
creditManagerName;
|
|
582
|
+
constructor(opts) {
|
|
583
|
+
super(opts);
|
|
584
|
+
this.creditManager = opts.creditManager;
|
|
585
|
+
this.creditManagerName = opts.creditManagerName;
|
|
586
|
+
}
|
|
587
|
+
toString() {
|
|
588
|
+
return `Credit Account ${this.creditManagerName || (0, contractsRegister_1.getContractName)(this.creditManager)}: bot disabled`;
|
|
589
|
+
}
|
|
590
|
+
serialize() {
|
|
591
|
+
return {
|
|
592
|
+
type: "TxAddBot",
|
|
593
|
+
content: JSON.stringify(this),
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
exports.TxRemoveBot = TxRemoveBot;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MULTICALL_EXTENDED_INTERFACE = void 0;
|
|
4
|
+
const sdk_gov_1 = require("@gearbox-protocol/sdk-gov");
|
|
5
|
+
const utils_1 = require("ethers/lib/utils");
|
|
6
|
+
const MULTICALL_GET_ABI = [
|
|
7
|
+
...sdk_gov_1.multicallInterface.fragments,
|
|
8
|
+
{
|
|
9
|
+
inputs: [
|
|
10
|
+
{
|
|
11
|
+
internalType: "address",
|
|
12
|
+
name: "addr",
|
|
13
|
+
type: "address",
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
name: "getEthBalance",
|
|
17
|
+
outputs: [
|
|
18
|
+
{
|
|
19
|
+
internalType: "uint256",
|
|
20
|
+
name: "balance",
|
|
21
|
+
type: "uint256",
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
stateMutability: "view",
|
|
25
|
+
type: "function",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
inputs: [],
|
|
29
|
+
name: "getBlockNumber",
|
|
30
|
+
outputs: [
|
|
31
|
+
{
|
|
32
|
+
internalType: "uint256",
|
|
33
|
+
name: "blockNumber",
|
|
34
|
+
type: "uint256",
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
stateMutability: "view",
|
|
38
|
+
type: "function",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
inputs: [],
|
|
42
|
+
name: "getCurrentBlockTimestamp",
|
|
43
|
+
outputs: [
|
|
44
|
+
{
|
|
45
|
+
internalType: "uint256",
|
|
46
|
+
name: "timestamp",
|
|
47
|
+
type: "uint256",
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
stateMutability: "view",
|
|
51
|
+
type: "function",
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
exports.MULTICALL_EXTENDED_INTERFACE = new utils_1.Interface(MULTICALL_GET_ABI);
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { ExcludeArrayProps, NetworkType, SupportedToken } from "@gearbox-protocol/sdk-gov";
|
|
2
|
+
import { ethers, providers, Signer } from "ethers";
|
|
3
|
+
import { FarmAccounting } from "../types/IFarmingPool";
|
|
4
|
+
import { BigintifyProps } from "../utils/types";
|
|
5
|
+
export interface GearboxExtraMerkleLmReward {
|
|
6
|
+
poolToken: string;
|
|
7
|
+
rewardToken: string;
|
|
8
|
+
amount: bigint;
|
|
9
|
+
type: "extraMerkle";
|
|
10
|
+
}
|
|
11
|
+
export interface GearboxStakedV3LmReward {
|
|
12
|
+
poolToken: string;
|
|
13
|
+
rewardToken: string;
|
|
14
|
+
amount: bigint;
|
|
15
|
+
type: "stakedV3";
|
|
16
|
+
}
|
|
17
|
+
export interface GearboxMerkleV2LmReward {
|
|
18
|
+
poolToken?: string;
|
|
19
|
+
rewardToken: string;
|
|
20
|
+
amount: bigint;
|
|
21
|
+
type: "merkleV2";
|
|
22
|
+
}
|
|
23
|
+
export type GearboxLmReward = GearboxStakedV3LmReward | GearboxMerkleV2LmReward | GearboxExtraMerkleLmReward;
|
|
24
|
+
export interface MerkleDistributorInfo {
|
|
25
|
+
merkleRoot: string;
|
|
26
|
+
tokenTotal: string;
|
|
27
|
+
claims: Record<string, {
|
|
28
|
+
index: number;
|
|
29
|
+
amount: string;
|
|
30
|
+
proof: Array<ethers.utils.BytesLike>;
|
|
31
|
+
}>;
|
|
32
|
+
}
|
|
33
|
+
type FarmInfoOutput = ExcludeArrayProps<FarmAccounting.InfoStructOutput>;
|
|
34
|
+
export type FarmInfo = BigintifyProps<FarmInfoOutput> & {
|
|
35
|
+
symbol: SupportedToken;
|
|
36
|
+
};
|
|
37
|
+
export interface GetLmRewardsInfoProps {
|
|
38
|
+
currentTokenData: Record<SupportedToken, string>;
|
|
39
|
+
provider: providers.Provider | Signer;
|
|
40
|
+
multicallAddress: string;
|
|
41
|
+
}
|
|
42
|
+
export interface GetLmRewardsProps {
|
|
43
|
+
baseRewardPoolsInfo: Record<string, FarmInfo>;
|
|
44
|
+
currentTokenData: Record<SupportedToken, string>;
|
|
45
|
+
account: string;
|
|
46
|
+
provider: providers.Provider | Signer;
|
|
47
|
+
airdropDistributorAddress: string | undefined;
|
|
48
|
+
network: NetworkType;
|
|
49
|
+
}
|
|
50
|
+
export interface ClaimLmRewardsV2Props {
|
|
51
|
+
signer: Signer;
|
|
52
|
+
account: string;
|
|
53
|
+
provider: providers.Provider;
|
|
54
|
+
airdropDistributorAddress: string | undefined;
|
|
55
|
+
network: NetworkType;
|
|
56
|
+
}
|
|
57
|
+
export interface ClaimLmRewardsV3Props {
|
|
58
|
+
reward: GearboxStakedV3LmReward;
|
|
59
|
+
signer: Signer;
|
|
60
|
+
}
|
|
61
|
+
export declare class GearboxRewardsApi {
|
|
62
|
+
static getLmRewardsInfo({ currentTokenData, provider, multicallAddress, }: GetLmRewardsInfoProps): Promise<{
|
|
63
|
+
rewardPoolsInfo: Record<string, FarmInfo[]>;
|
|
64
|
+
baseRewardPoolsInfo: Record<string, FarmInfo>;
|
|
65
|
+
rewardPoolsSupply: {
|
|
66
|
+
[k: string]: bigint;
|
|
67
|
+
};
|
|
68
|
+
}>;
|
|
69
|
+
static getLmRewardsV2({ provider, account, currentTokenData, network, airdropDistributorAddress, }: GetLmRewardsProps): Promise<{
|
|
70
|
+
rewards: GearboxLmReward[][];
|
|
71
|
+
totalAvailable: bigint;
|
|
72
|
+
}>;
|
|
73
|
+
static getLmRewardsV3({ baseRewardPoolsInfo, currentTokenData, provider, account, network, }: GetLmRewardsProps): Promise<{
|
|
74
|
+
rewards: GearboxLmReward[][];
|
|
75
|
+
totalAvailable: bigint;
|
|
76
|
+
}>;
|
|
77
|
+
static claimLmRewardsV2({ signer, account, provider, network, airdropDistributorAddress, }: ClaimLmRewardsV2Props): Promise<ethers.ContractTransaction>;
|
|
78
|
+
static claimLmRewardsV3({ reward, signer }: ClaimLmRewardsV3Props): Promise<ethers.ContractTransaction>;
|
|
79
|
+
private static getMerkle;
|
|
80
|
+
private static getClaimed;
|
|
81
|
+
private static getAmountOnContract;
|
|
82
|
+
}
|
|
83
|
+
export {};
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.GearboxRewardsApi = void 0;
|
|
7
|
+
const sdk_gov_1 = require("@gearbox-protocol/sdk-gov");
|
|
8
|
+
const axios_1 = __importDefault(require("axios"));
|
|
9
|
+
const utils_1 = require("ethers/lib/utils");
|
|
10
|
+
const endpoint_1 = require("../core/endpoint");
|
|
11
|
+
const types_1 = require("../types");
|
|
12
|
+
const formatter_1 = require("../utils/formatter");
|
|
13
|
+
const math_1 = require("../utils/math");
|
|
14
|
+
const abi_1 = require("./abi");
|
|
15
|
+
const EXTRA_LM_MINING = {
|
|
16
|
+
[sdk_gov_1.tokenDataByNetwork.Mainnet.sdGHOV3.toLowerCase()]: (timestamp) => {
|
|
17
|
+
const REWARD_PERIOD = 14 * 24 * 60 * 60;
|
|
18
|
+
// const REWARDS_FIRST_START = 1711641600;
|
|
19
|
+
const REWARDS_FIRST_END = 1712844000;
|
|
20
|
+
const REWARDS_SECOND_END = 1714150800;
|
|
21
|
+
const REWARD_FIRST_PART = (0, formatter_1.toBN)("15000", sdk_gov_1.decimals.GHO);
|
|
22
|
+
const REWARD_SECOND_PART = (0, formatter_1.toBN)("15000", sdk_gov_1.decimals.GHO);
|
|
23
|
+
const reward = timestamp >= REWARDS_FIRST_END ? REWARD_SECOND_PART : REWARD_FIRST_PART;
|
|
24
|
+
const finished = timestamp >= REWARDS_FIRST_END ? REWARDS_SECOND_END : REWARDS_FIRST_END;
|
|
25
|
+
return {
|
|
26
|
+
balance: 0n,
|
|
27
|
+
duration: REWARD_PERIOD,
|
|
28
|
+
finished,
|
|
29
|
+
reward: reward,
|
|
30
|
+
symbol: "GHO",
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
class GearboxRewardsApi {
|
|
35
|
+
static async getLmRewardsInfo({ currentTokenData, provider, multicallAddress, }) {
|
|
36
|
+
const poolTokens = sdk_gov_1.TypedObjectUtils.entries(currentTokenData).filter(([symbol]) => (0, sdk_gov_1.isDieselStakedToken)(symbol));
|
|
37
|
+
const farmInfoCalls = poolTokens.map(([, address]) => ({
|
|
38
|
+
address: address,
|
|
39
|
+
interface: types_1.IFarmingPool__factory.createInterface(),
|
|
40
|
+
method: "farmInfo()",
|
|
41
|
+
}));
|
|
42
|
+
const rewardTokenCalls = poolTokens.map(([, address]) => ({
|
|
43
|
+
address: address,
|
|
44
|
+
interface: POOL_REWARD_INTERFACE,
|
|
45
|
+
method: "rewardsToken()",
|
|
46
|
+
}));
|
|
47
|
+
const farmSupplyCalls = poolTokens.map(([, address]) => ({
|
|
48
|
+
address: address,
|
|
49
|
+
interface: types_1.IFarmingPool__factory.createInterface(),
|
|
50
|
+
method: "totalSupply()",
|
|
51
|
+
params: [],
|
|
52
|
+
}));
|
|
53
|
+
const blockTimestampCall = {
|
|
54
|
+
address: multicallAddress,
|
|
55
|
+
interface: abi_1.MULTICALL_EXTENDED_INTERFACE,
|
|
56
|
+
method: "getCurrentBlockTimestamp()",
|
|
57
|
+
};
|
|
58
|
+
const [blockTimestamp, ...mcResponse] = await (0, sdk_gov_1.multicall)([
|
|
59
|
+
blockTimestampCall,
|
|
60
|
+
...farmInfoCalls,
|
|
61
|
+
...farmSupplyCalls,
|
|
62
|
+
...rewardTokenCalls,
|
|
63
|
+
], provider);
|
|
64
|
+
const farmInfoCallsEnd = farmInfoCalls.length;
|
|
65
|
+
const farmInfo = mcResponse.slice(0, farmInfoCallsEnd);
|
|
66
|
+
const farmSupplyCallsEnd = farmInfoCallsEnd + farmSupplyCalls.length;
|
|
67
|
+
const farmSupply = mcResponse.slice(farmInfoCallsEnd, farmSupplyCallsEnd);
|
|
68
|
+
const rewardTokenCallsEnd = farmSupplyCallsEnd + rewardTokenCalls.length;
|
|
69
|
+
const rewardTokens = mcResponse.slice(farmSupplyCallsEnd, rewardTokenCallsEnd);
|
|
70
|
+
const rewardPoolsInfo = poolTokens.reduce((acc, [, address], i) => {
|
|
71
|
+
const currentInfo = farmInfo[i];
|
|
72
|
+
const [symbol] = (0, sdk_gov_1.extractTokenData)(rewardTokens[i] || "");
|
|
73
|
+
if (!symbol)
|
|
74
|
+
throw new Error(`Can't get reward token for: ${(0, sdk_gov_1.extractTokenData)(address)[0]} [${address}]`);
|
|
75
|
+
const otherRewards = EXTRA_LM_MINING[address];
|
|
76
|
+
const baseReward = {
|
|
77
|
+
duration: currentInfo.duration,
|
|
78
|
+
finished: currentInfo.finished,
|
|
79
|
+
reward: (0, sdk_gov_1.toBigInt)(currentInfo.reward),
|
|
80
|
+
balance: (0, sdk_gov_1.toBigInt)(currentInfo.balance),
|
|
81
|
+
symbol: symbol,
|
|
82
|
+
};
|
|
83
|
+
const extraReward = otherRewards
|
|
84
|
+
? [otherRewards(Number(blockTimestamp))]
|
|
85
|
+
: [];
|
|
86
|
+
acc.base[address] = baseReward;
|
|
87
|
+
acc.all[address] = [baseReward, ...extraReward];
|
|
88
|
+
return acc;
|
|
89
|
+
}, { base: {}, all: {} });
|
|
90
|
+
const rewardPoolsSupply = Object.fromEntries(poolTokens.map(([, address], i) => [
|
|
91
|
+
address,
|
|
92
|
+
(0, sdk_gov_1.toBigInt)(farmSupply[i] || 0),
|
|
93
|
+
]));
|
|
94
|
+
return {
|
|
95
|
+
rewardPoolsInfo: rewardPoolsInfo.all,
|
|
96
|
+
baseRewardPoolsInfo: rewardPoolsInfo.base,
|
|
97
|
+
rewardPoolsSupply,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
static async getLmRewardsV2({ provider, account, currentTokenData, network, airdropDistributorAddress, }) {
|
|
101
|
+
if (!airdropDistributorAddress)
|
|
102
|
+
return { rewards: [], totalAvailable: 0n };
|
|
103
|
+
const distributor = types_1.IAirdropDistributor__factory.connect(airdropDistributorAddress, provider);
|
|
104
|
+
const [claimed, merkleData] = await Promise.all([
|
|
105
|
+
this.getClaimed({ distributor, account }),
|
|
106
|
+
this.getMerkle(provider, airdropDistributorAddress, network, account),
|
|
107
|
+
]);
|
|
108
|
+
const amountOnContract = this.getAmountOnContract({ account, merkleData });
|
|
109
|
+
const diff = amountOnContract - claimed;
|
|
110
|
+
const availableToClaimV2 = math_1.BigIntMath.max(0n, diff);
|
|
111
|
+
const rewards = [
|
|
112
|
+
{
|
|
113
|
+
amount: availableToClaimV2,
|
|
114
|
+
type: "merkleV2",
|
|
115
|
+
rewardToken: currentTokenData.GEAR,
|
|
116
|
+
},
|
|
117
|
+
];
|
|
118
|
+
const totalAvailable = rewards.reduce((sum, r) => sum + (r.amount || 0n), 0n);
|
|
119
|
+
return { rewards: [rewards], totalAvailable };
|
|
120
|
+
}
|
|
121
|
+
static async getLmRewardsV3({ baseRewardPoolsInfo, currentTokenData, provider, account, network, }) {
|
|
122
|
+
const poolTokens = Object.keys(baseRewardPoolsInfo);
|
|
123
|
+
const farmedCalls = poolTokens.map(address => ({
|
|
124
|
+
address: address,
|
|
125
|
+
interface: types_1.IFarmingPool__factory.createInterface(),
|
|
126
|
+
method: "farmed(address)",
|
|
127
|
+
params: [account],
|
|
128
|
+
}));
|
|
129
|
+
const hasGHOReward = network === "Mainnet" && EXTRA_LM_MINING[currentTokenData.sdGHOV3];
|
|
130
|
+
const [gearboxLmResponse, merkleXYZLMResponse] = await Promise.allSettled([
|
|
131
|
+
(0, sdk_gov_1.multicall)(farmedCalls, provider),
|
|
132
|
+
hasGHOReward
|
|
133
|
+
? axios_1.default.get(MerkleXYZApi.getRewardsUrl({
|
|
134
|
+
params: {
|
|
135
|
+
chainId: 1,
|
|
136
|
+
user: (0, utils_1.getAddress)(account),
|
|
137
|
+
mainParameter: (0, utils_1.getAddress)(currentTokenData.sdGHOV3),
|
|
138
|
+
rewardToken: (0, utils_1.getAddress)(currentTokenData.GHO),
|
|
139
|
+
},
|
|
140
|
+
}))
|
|
141
|
+
: undefined,
|
|
142
|
+
]);
|
|
143
|
+
const gearboxLm = gearboxLmResponse.status === "fulfilled" ? gearboxLmResponse.value : [];
|
|
144
|
+
const merkleXYZLM = merkleXYZLMResponse.status === "fulfilled"
|
|
145
|
+
? merkleXYZLMResponse.value?.data
|
|
146
|
+
: undefined;
|
|
147
|
+
const merkleXYZLMLc = Object.fromEntries(Object.entries(merkleXYZLM || {}).map(([k, v]) => [k.toLowerCase(), v]));
|
|
148
|
+
const ghoLM = merkleXYZLMLc[currentTokenData.GHO];
|
|
149
|
+
const gearboxLmRewards = poolTokens.map((address, i) => {
|
|
150
|
+
return {
|
|
151
|
+
poolToken: address,
|
|
152
|
+
rewardToken: currentTokenData[baseRewardPoolsInfo[address].symbol],
|
|
153
|
+
amount: (0, sdk_gov_1.toBigInt)(gearboxLm[i] || 0n),
|
|
154
|
+
type: "stakedV3",
|
|
155
|
+
};
|
|
156
|
+
});
|
|
157
|
+
const { zero, nonZero, total } = gearboxLmRewards.reduce((acc, r) => {
|
|
158
|
+
const amount = r.amount || 0n;
|
|
159
|
+
if (amount > 0n) {
|
|
160
|
+
acc.nonZero.push([r]);
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
acc.zero.push(r);
|
|
164
|
+
}
|
|
165
|
+
acc.total = acc.total + amount;
|
|
166
|
+
return acc;
|
|
167
|
+
}, { total: 0n, nonZero: [], zero: [] });
|
|
168
|
+
const extraRewards = ghoLM
|
|
169
|
+
? [
|
|
170
|
+
[
|
|
171
|
+
{
|
|
172
|
+
poolToken: currentTokenData.sdGHOV3,
|
|
173
|
+
rewardToken: currentTokenData.GHO,
|
|
174
|
+
amount: (0, sdk_gov_1.toBigInt)(ghoLM.unclaimed),
|
|
175
|
+
type: "extraMerkle",
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
]
|
|
179
|
+
: [];
|
|
180
|
+
const extraTotal = extraRewards.reduce((sum, group) => {
|
|
181
|
+
const groupTotal = group.reduce((groupSum, reward) => {
|
|
182
|
+
return groupSum + (reward.amount || 0n);
|
|
183
|
+
}, 0n);
|
|
184
|
+
return sum + groupTotal;
|
|
185
|
+
}, 0n);
|
|
186
|
+
return {
|
|
187
|
+
rewards: [...nonZero, ...extraRewards, zero],
|
|
188
|
+
totalAvailable: total + extraTotal,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
static async claimLmRewardsV2({ signer, account, provider, network, airdropDistributorAddress, }) {
|
|
192
|
+
if (!airdropDistributorAddress)
|
|
193
|
+
throw new Error(`V2 rewards are not supported on chain: ${network}`);
|
|
194
|
+
const distributor = types_1.IAirdropDistributor__factory.connect(airdropDistributorAddress, signer);
|
|
195
|
+
const merkleData = await this.getMerkle(provider, airdropDistributorAddress, network, account);
|
|
196
|
+
const rewardFromMerkle = merkleData?.claims[account];
|
|
197
|
+
if (!rewardFromMerkle)
|
|
198
|
+
throw new Error("No rewards found");
|
|
199
|
+
return distributor.claim(rewardFromMerkle.index, account, (0, sdk_gov_1.toBigInt)(rewardFromMerkle.amount), rewardFromMerkle.proof);
|
|
200
|
+
}
|
|
201
|
+
static async claimLmRewardsV3({ reward, signer }) {
|
|
202
|
+
const pool = types_1.IFarmingPool__factory.connect(reward.poolToken, signer);
|
|
203
|
+
return pool.claim();
|
|
204
|
+
}
|
|
205
|
+
static async getMerkle(provider, distributorAddress, network, account) {
|
|
206
|
+
const distributor = types_1.IAirdropDistributor__factory.connect(distributorAddress, provider);
|
|
207
|
+
const root = await distributor.merkleRoot();
|
|
208
|
+
const path = `${network}_${root.slice(2)}/${account.slice(2, 4)}`;
|
|
209
|
+
const url = `https://am.gearbox.finance/${path.toLowerCase()}.json`;
|
|
210
|
+
try {
|
|
211
|
+
const result = await axios_1.default.get(url);
|
|
212
|
+
return result.data;
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
console.error("core/gearboxRewards/lmRewards/getMerkle", error);
|
|
216
|
+
return undefined;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
static async getClaimed({ distributor, account, }) {
|
|
220
|
+
const claimedRewardsResponse = await distributor.queryFilter(distributor.filters.Claimed(account, undefined, false));
|
|
221
|
+
const claimedRewards = (claimedRewardsResponse || []).reduce((acc, r) => acc + (0, sdk_gov_1.toBigInt)(r.args.amount), 0n);
|
|
222
|
+
return claimedRewards;
|
|
223
|
+
}
|
|
224
|
+
static getAmountOnContract({ account, merkleData, }) {
|
|
225
|
+
const { claims = {} } = merkleData || {};
|
|
226
|
+
const { amount } = claims[account] || {};
|
|
227
|
+
return BigInt(amount || 0);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
exports.GearboxRewardsApi = GearboxRewardsApi;
|
|
231
|
+
class MerkleXYZApi {
|
|
232
|
+
static domain = "https://api.merkl.xyz/v3";
|
|
233
|
+
static getRewardsUrl = (options) => endpoint_1.ChartsApi.getRelativeUrl([this.domain, "userRewards"].join("/"), options);
|
|
234
|
+
}
|
|
235
|
+
const POOL_REWARDS_ABI = [
|
|
236
|
+
{
|
|
237
|
+
inputs: [],
|
|
238
|
+
name: "rewardsToken",
|
|
239
|
+
outputs: [
|
|
240
|
+
{
|
|
241
|
+
internalType: "contract IERC20",
|
|
242
|
+
name: "",
|
|
243
|
+
type: "address",
|
|
244
|
+
},
|
|
245
|
+
],
|
|
246
|
+
stateMutability: "view",
|
|
247
|
+
type: "function",
|
|
248
|
+
},
|
|
249
|
+
];
|
|
250
|
+
const POOL_REWARD_INTERFACE = new utils_1.Interface(POOL_REWARDS_ABI);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SupportedToken } from "@gearbox-protocol/sdk-gov";
|
|
2
|
+
import { PoolData } from "../core/pool";
|
|
3
|
+
import { TokenData } from "../tokens/tokenData";
|
|
4
|
+
import { FarmInfo } from "./api";
|
|
5
|
+
interface CalculateV3PoolLmAPYProps {
|
|
6
|
+
currentTimestamp: number;
|
|
7
|
+
info: FarmInfo;
|
|
8
|
+
supply: {
|
|
9
|
+
decimals: number;
|
|
10
|
+
amount: bigint;
|
|
11
|
+
price: bigint;
|
|
12
|
+
};
|
|
13
|
+
reward: {
|
|
14
|
+
decimals: number;
|
|
15
|
+
price: bigint;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface PoolExtraRewardApy {
|
|
19
|
+
symbol: SupportedToken;
|
|
20
|
+
apy: number;
|
|
21
|
+
}
|
|
22
|
+
interface GetPoolExtraAPY_V3Props {
|
|
23
|
+
stakedDieselToken: string | undefined;
|
|
24
|
+
pool: PoolData;
|
|
25
|
+
prices: Record<string, bigint>;
|
|
26
|
+
rewardPoolsInfo: Record<string, Array<FarmInfo>>;
|
|
27
|
+
rewardPoolsSupply: Record<string, bigint>;
|
|
28
|
+
tokensList: Record<string, TokenData>;
|
|
29
|
+
currentTokenData: Record<SupportedToken, string>;
|
|
30
|
+
currentTimestamp: number;
|
|
31
|
+
}
|
|
32
|
+
export declare class GearboxRewardsApy {
|
|
33
|
+
static getPoolExtraAPY_V3({ rewardPoolsInfo, stakedDieselToken, ...restProps }: GetPoolExtraAPY_V3Props): Array<PoolExtraRewardApy>;
|
|
34
|
+
private static getPoolSingleExtraLmAPY_V3;
|
|
35
|
+
static calculateAPY_V3({ info, supply, reward, currentTimestamp, }: CalculateV3PoolLmAPYProps): number;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GearboxRewardsApy = void 0;
|
|
4
|
+
const sdk_gov_1 = require("@gearbox-protocol/sdk-gov");
|
|
5
|
+
const price_1 = require("../utils/price");
|
|
6
|
+
const PERCENTAGE_FACTOR_1KK = sdk_gov_1.PERCENTAGE_DECIMALS * sdk_gov_1.PERCENTAGE_FACTOR;
|
|
7
|
+
const ONE = PERCENTAGE_FACTOR_1KK * 10n;
|
|
8
|
+
class GearboxRewardsApy {
|
|
9
|
+
static getPoolExtraAPY_V3({ rewardPoolsInfo, stakedDieselToken, ...restProps }) {
|
|
10
|
+
const { version } = restProps.pool;
|
|
11
|
+
const isV3 = version >= 300 && version < 400;
|
|
12
|
+
if (!isV3 || !stakedDieselToken)
|
|
13
|
+
return [];
|
|
14
|
+
const info = rewardPoolsInfo[stakedDieselToken];
|
|
15
|
+
if (!info)
|
|
16
|
+
return [];
|
|
17
|
+
const extra = info.map(inf => this.getPoolSingleExtraLmAPY_V3({
|
|
18
|
+
...restProps,
|
|
19
|
+
stakedDieselToken,
|
|
20
|
+
rewardPoolsInfo: inf,
|
|
21
|
+
}));
|
|
22
|
+
return extra;
|
|
23
|
+
}
|
|
24
|
+
static getPoolSingleExtraLmAPY_V3({ stakedDieselToken, pool, prices, rewardPoolsInfo, rewardPoolsSupply, tokensList, currentTokenData, currentTimestamp, }) {
|
|
25
|
+
const { underlyingToken, dieselRateRay } = pool;
|
|
26
|
+
const safeSupply = rewardPoolsSupply[stakedDieselToken] ?? 0n;
|
|
27
|
+
const { decimals: underlyingDecimals = 18 } = tokensList[underlyingToken] || {};
|
|
28
|
+
const underlyingPrice = prices[underlyingToken] ?? 0n;
|
|
29
|
+
const dieselPrice = (underlyingPrice * dieselRateRay) / sdk_gov_1.RAY;
|
|
30
|
+
const rewardAddress = currentTokenData[rewardPoolsInfo.symbol];
|
|
31
|
+
const { decimals: rewardDecimals = 18 } = tokensList[rewardAddress] || {};
|
|
32
|
+
const rewardPrice = prices[rewardAddress] ?? 0n;
|
|
33
|
+
const r = this.calculateAPY_V3({
|
|
34
|
+
currentTimestamp,
|
|
35
|
+
info: rewardPoolsInfo,
|
|
36
|
+
supply: {
|
|
37
|
+
amount: safeSupply,
|
|
38
|
+
decimals: underlyingDecimals,
|
|
39
|
+
price: dieselPrice,
|
|
40
|
+
},
|
|
41
|
+
reward: {
|
|
42
|
+
price: rewardPrice,
|
|
43
|
+
decimals: rewardDecimals,
|
|
44
|
+
},
|
|
45
|
+
}) / Number(sdk_gov_1.PERCENTAGE_FACTOR);
|
|
46
|
+
return { symbol: rewardPoolsInfo.symbol, apy: r };
|
|
47
|
+
}
|
|
48
|
+
static calculateAPY_V3({ info, supply, reward, currentTimestamp, }) {
|
|
49
|
+
const finished = info.finished <= currentTimestamp;
|
|
50
|
+
if (finished)
|
|
51
|
+
return 0;
|
|
52
|
+
if (supply.amount <= 0n)
|
|
53
|
+
return 0;
|
|
54
|
+
if (supply.price === 0n || reward.price === 0n)
|
|
55
|
+
return 0;
|
|
56
|
+
if (info.duration === 0)
|
|
57
|
+
return 0;
|
|
58
|
+
const supplyMoney = price_1.PriceUtils.calcTotalPrice(supply.price, supply.amount, supply.decimals);
|
|
59
|
+
const rewardMoney = price_1.PriceUtils.calcTotalPrice(reward.price, info.reward, reward.decimals);
|
|
60
|
+
const durationRatio = ((0, sdk_gov_1.toBigInt)(sdk_gov_1.SECONDS_PER_YEAR) * sdk_gov_1.WAD) / (0, sdk_gov_1.toBigInt)(info.duration);
|
|
61
|
+
const apyBn = (((rewardMoney * ONE) / supplyMoney) * durationRatio) / sdk_gov_1.WAD;
|
|
62
|
+
return Math.round(Number(apyBn) / 10);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.GearboxRewardsApy = GearboxRewardsApy;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { NetworkType, SupportedToken } from "@gearbox-protocol/sdk-gov";
|
|
2
|
+
import { Asset } from "../core/assets";
|
|
3
|
+
import { PoolData } from "../core/pool";
|
|
4
|
+
import { TokenData } from "../tokens/tokenData";
|
|
5
|
+
export interface GetPointsByPoolProps {
|
|
6
|
+
totalTokenBalances: Record<string, Asset>;
|
|
7
|
+
pools: Array<PoolData>;
|
|
8
|
+
currentTokenData: Record<SupportedToken, string>;
|
|
9
|
+
tokensList: Record<string, TokenData>;
|
|
10
|
+
network: NetworkType;
|
|
11
|
+
}
|
|
12
|
+
export interface GetTotalTokensOnProtocolProps {
|
|
13
|
+
currentTokenData: Record<SupportedToken, string>;
|
|
14
|
+
tokensList: Record<string, TokenData>;
|
|
15
|
+
chainId: number;
|
|
16
|
+
network: NetworkType;
|
|
17
|
+
}
|
|
18
|
+
interface PoolPointsInfo {
|
|
19
|
+
amount: bigint;
|
|
20
|
+
symbol: SupportedToken;
|
|
21
|
+
duration: string;
|
|
22
|
+
name: string;
|
|
23
|
+
}
|
|
24
|
+
export declare class GearboxRewardsExtraApy {
|
|
25
|
+
static getTotalTokensOnProtocol({ currentTokenData, chainId, tokensList, network, }: GetTotalTokensOnProtocolProps): Promise<{
|
|
26
|
+
[k: string]: Asset;
|
|
27
|
+
}>;
|
|
28
|
+
private static getTokenTotal;
|
|
29
|
+
static getPointsByPool({ totalTokenBalances, pools, tokensList, currentTokenData, network, }: GetPointsByPoolProps): {
|
|
30
|
+
[k: string]: Asset[];
|
|
31
|
+
};
|
|
32
|
+
private static getPoolTokenPoints;
|
|
33
|
+
static getPoolPointsTip(network: NetworkType, pool: string, token: SupportedToken): PoolPointsInfo | undefined;
|
|
34
|
+
static getExtraLidoAPY: (supply: bigint, supplyPrice: bigint, rewardPrice: bigint, currentTimestamp: number) => number;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.GearboxRewardsExtraApy = void 0;
|
|
7
|
+
const sdk_gov_1 = require("@gearbox-protocol/sdk-gov");
|
|
8
|
+
const axios_1 = __importDefault(require("axios"));
|
|
9
|
+
const contractsRegister_1 = require("../contracts/contractsRegister");
|
|
10
|
+
const endpoint_1 = require("../core/endpoint");
|
|
11
|
+
const formatter_1 = require("../utils/formatter");
|
|
12
|
+
const math_1 = require("../utils/math");
|
|
13
|
+
const apy_1 = require("./apy");
|
|
14
|
+
const POOL_POINTS = {
|
|
15
|
+
Mainnet: {
|
|
16
|
+
[contractsRegister_1.poolByNetwork.Mainnet.WETH_V3_TRADE]: {
|
|
17
|
+
ezETH: {
|
|
18
|
+
amount: sdk_gov_1.PERCENTAGE_FACTOR,
|
|
19
|
+
symbol: "ezETH",
|
|
20
|
+
duration: "hour",
|
|
21
|
+
name: "ezPoint",
|
|
22
|
+
},
|
|
23
|
+
rsETH: {
|
|
24
|
+
amount: 7500n * 10000n,
|
|
25
|
+
symbol: "rsETH",
|
|
26
|
+
duration: "hour",
|
|
27
|
+
name: "Kelp Mile",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
Arbitrum: {
|
|
32
|
+
[contractsRegister_1.poolByNetwork.Arbitrum.WETH_V3]: {
|
|
33
|
+
ezETH: {
|
|
34
|
+
amount: sdk_gov_1.PERCENTAGE_FACTOR,
|
|
35
|
+
symbol: "ezETH",
|
|
36
|
+
duration: "hour",
|
|
37
|
+
name: "ezPoint",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
Optimism: {},
|
|
42
|
+
Base: {},
|
|
43
|
+
};
|
|
44
|
+
// !& + STETH
|
|
45
|
+
const TOKENS = sdk_gov_1.TypedObjectUtils.fromEntries(sdk_gov_1.TypedObjectUtils.entries(POOL_POINTS).map(([network, pools]) => {
|
|
46
|
+
const r = Object.values(pools)
|
|
47
|
+
.map(tokens => {
|
|
48
|
+
const l = Object.keys(tokens);
|
|
49
|
+
return l;
|
|
50
|
+
})
|
|
51
|
+
.flat(1);
|
|
52
|
+
return [network, r];
|
|
53
|
+
}));
|
|
54
|
+
const REWARD = (0, formatter_1.toBN)("7.7", sdk_gov_1.decimals.wstETH);
|
|
55
|
+
const REWARD_PERIOD = 30 * 24 * 60 * 60;
|
|
56
|
+
class GearboxRewardsExtraApy {
|
|
57
|
+
static async getTotalTokensOnProtocol({ currentTokenData, chainId, tokensList, network, }) {
|
|
58
|
+
const currTokens = TOKENS[network];
|
|
59
|
+
const res = await Promise.all(currTokens.map(s => this.getTokenTotal(currentTokenData[s], chainId, tokensList)));
|
|
60
|
+
return Object.fromEntries(res.filter(r => r).map(r => [r.token, r]));
|
|
61
|
+
}
|
|
62
|
+
static async getTokenTotal(token, chainId, tokensList) {
|
|
63
|
+
try {
|
|
64
|
+
const url = endpoint_1.ChartsApi.getUrl("getBalanceAt", chainId, {
|
|
65
|
+
params: {
|
|
66
|
+
asset: token,
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
const result = await axios_1.default.get(url);
|
|
70
|
+
const balance = result.data.result.reduce((sum, r) => r.effective_balance + sum, 0);
|
|
71
|
+
const { decimals = 18 } = tokensList[token] || {};
|
|
72
|
+
return { token, balance: (0, formatter_1.toBN)(String(balance), decimals) };
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
console.error("core/apy/extraAPYApi/getTokenTotal", error);
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
static getPointsByPool({ totalTokenBalances, pools, tokensList, currentTokenData, network, }) {
|
|
80
|
+
const r = Object.fromEntries(pools.map(p => {
|
|
81
|
+
const poolPointsInfo = Object.values(POOL_POINTS[network]?.[p.address] || []);
|
|
82
|
+
const poolPointsList = poolPointsInfo.reduce((acc, pointsInfo) => {
|
|
83
|
+
const tokenBalance = totalTokenBalances[currentTokenData[pointsInfo.symbol] || ""];
|
|
84
|
+
const points = this.getPoolTokenPoints(tokenBalance, p, tokensList, pointsInfo);
|
|
85
|
+
if (points !== null) {
|
|
86
|
+
acc.push({ balance: points, token: tokenBalance.token });
|
|
87
|
+
}
|
|
88
|
+
return acc;
|
|
89
|
+
}, []);
|
|
90
|
+
return [p.address, poolPointsList];
|
|
91
|
+
}));
|
|
92
|
+
return r;
|
|
93
|
+
}
|
|
94
|
+
static getPoolTokenPoints(tokenBalanceInPool, pool, tokensList, pointsInfo) {
|
|
95
|
+
if (!tokenBalanceInPool)
|
|
96
|
+
return null;
|
|
97
|
+
if (pool.expectedLiquidity <= 0)
|
|
98
|
+
return 0n;
|
|
99
|
+
const { decimals = 18 } = tokensList[tokenBalanceInPool.token] || {};
|
|
100
|
+
const targetFactor = 10n ** BigInt(decimals);
|
|
101
|
+
const { decimals: underlyingDecimals = 18 } = tokensList[pool.underlyingToken] || {};
|
|
102
|
+
const underlyingFactor = 10n ** BigInt(underlyingDecimals);
|
|
103
|
+
const defaultPoints = (pointsInfo.amount * targetFactor) / sdk_gov_1.PERCENTAGE_FACTOR;
|
|
104
|
+
const points = (tokenBalanceInPool.balance * defaultPoints) /
|
|
105
|
+
((pool.expectedLiquidity * targetFactor) / underlyingFactor);
|
|
106
|
+
return math_1.BigIntMath.min(points, defaultPoints);
|
|
107
|
+
}
|
|
108
|
+
static getPoolPointsTip(network, pool, token) {
|
|
109
|
+
const p = POOL_POINTS[network]?.[pool]?.[token];
|
|
110
|
+
return p;
|
|
111
|
+
}
|
|
112
|
+
static getExtraLidoAPY = (supply, supplyPrice, rewardPrice, currentTimestamp) => apy_1.GearboxRewardsApy.calculateAPY_V3({
|
|
113
|
+
info: {
|
|
114
|
+
balance: 0n,
|
|
115
|
+
duration: REWARD_PERIOD,
|
|
116
|
+
// !& + STETH
|
|
117
|
+
finished: Math.floor(Date.now() / 1000) + 10000,
|
|
118
|
+
reward: REWARD,
|
|
119
|
+
symbol: "STETH",
|
|
120
|
+
},
|
|
121
|
+
supply: {
|
|
122
|
+
amount: supply,
|
|
123
|
+
decimals: sdk_gov_1.decimals.wstETH,
|
|
124
|
+
price: supplyPrice,
|
|
125
|
+
},
|
|
126
|
+
reward: {
|
|
127
|
+
price: rewardPrice,
|
|
128
|
+
decimals: sdk_gov_1.decimals.wstETH,
|
|
129
|
+
},
|
|
130
|
+
currentTimestamp,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
exports.GearboxRewardsExtraApy = GearboxRewardsExtraApy;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./abi"), exports);
|
|
18
|
+
__exportStar(require("./api"), exports);
|
|
19
|
+
__exportStar(require("./apy"), exports);
|
|
20
|
+
__exportStar(require("./extraAPY"), exports);
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./apy";
|
|
2
2
|
export * from "./contracts/contractsRegister";
|
|
3
3
|
export * from "./core/assets";
|
|
4
|
+
export * from "./core/bot";
|
|
4
5
|
export * from "./core/creditAccount";
|
|
5
6
|
export * from "./core/creditManager";
|
|
6
7
|
export * from "./core/creditSession";
|
|
@@ -16,8 +17,10 @@ export * from "./core/strategy";
|
|
|
16
17
|
export * from "./core/tokenDistributor";
|
|
17
18
|
export * from "./core/trade";
|
|
18
19
|
export * from "./core/transactions";
|
|
20
|
+
export * from "./gearboxRewards";
|
|
19
21
|
export * from "./parsers/txParser";
|
|
20
22
|
export * from "./pathfinder";
|
|
23
|
+
export * from "./payload/bot";
|
|
21
24
|
export * from "./payload/creditAccount";
|
|
22
25
|
export * from "./payload/creditManager";
|
|
23
26
|
export * from "./payload/creditSession";
|
package/lib/index.js
CHANGED
|
@@ -18,6 +18,7 @@ exports.callRepeater = void 0;
|
|
|
18
18
|
__exportStar(require("./apy"), exports);
|
|
19
19
|
__exportStar(require("./contracts/contractsRegister"), exports);
|
|
20
20
|
__exportStar(require("./core/assets"), exports);
|
|
21
|
+
__exportStar(require("./core/bot"), exports);
|
|
21
22
|
__exportStar(require("./core/creditAccount"), exports);
|
|
22
23
|
__exportStar(require("./core/creditManager"), exports);
|
|
23
24
|
__exportStar(require("./core/creditSession"), exports);
|
|
@@ -33,8 +34,10 @@ __exportStar(require("./core/strategy"), exports);
|
|
|
33
34
|
__exportStar(require("./core/tokenDistributor"), exports);
|
|
34
35
|
__exportStar(require("./core/trade"), exports);
|
|
35
36
|
__exportStar(require("./core/transactions"), exports);
|
|
37
|
+
__exportStar(require("./gearboxRewards"), exports);
|
|
36
38
|
__exportStar(require("./parsers/txParser"), exports);
|
|
37
39
|
__exportStar(require("./pathfinder"), exports);
|
|
40
|
+
__exportStar(require("./payload/bot"), exports);
|
|
38
41
|
__exportStar(require("./payload/creditAccount"), exports);
|
|
39
42
|
__exportStar(require("./payload/creditManager"), exports);
|
|
40
43
|
__exportStar(require("./payload/creditSession"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BigNumberish } from "ethers";
|
|
2
|
+
export type BotBaseType = "liquidationProtection";
|
|
3
|
+
export type LiquidationBotType = "deleverageBotPegged" | "deleverageBotLV" | "deleverageBotHV";
|
|
4
|
+
export type BotDetailedType = LiquidationBotType;
|
|
5
|
+
export interface BotDataPayload {
|
|
6
|
+
baseType: BotBaseType;
|
|
7
|
+
detailedType: BotDetailedType;
|
|
8
|
+
address: string;
|
|
9
|
+
minHealthFactor: BigNumberish;
|
|
10
|
+
maxHealthFactor: BigNumberish;
|
|
11
|
+
premiumScaleFactor: BigNumberish;
|
|
12
|
+
feeScaleFactor: BigNumberish;
|
|
13
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { BaseContract, Signer, utils } from "ethers";
|
|
2
|
+
import type { Listener, Provider } from "@ethersproject/providers";
|
|
3
|
+
import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from "./common";
|
|
4
|
+
export interface SafeERC20Interface extends utils.Interface {
|
|
5
|
+
functions: {};
|
|
6
|
+
events: {};
|
|
7
|
+
}
|
|
8
|
+
export interface SafeERC20 extends BaseContract {
|
|
9
|
+
connect(signerOrProvider: Signer | Provider | string): this;
|
|
10
|
+
attach(addressOrName: string): this;
|
|
11
|
+
deployed(): Promise<this>;
|
|
12
|
+
interface: SafeERC20Interface;
|
|
13
|
+
queryFilter<TEvent extends TypedEvent>(event: TypedEventFilter<TEvent>, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise<Array<TEvent>>;
|
|
14
|
+
listeners<TEvent extends TypedEvent>(eventFilter?: TypedEventFilter<TEvent>): Array<TypedListener<TEvent>>;
|
|
15
|
+
listeners(eventName?: string): Array<Listener>;
|
|
16
|
+
removeAllListeners<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>): this;
|
|
17
|
+
removeAllListeners(eventName?: string): this;
|
|
18
|
+
off: OnEvent<this>;
|
|
19
|
+
on: OnEvent<this>;
|
|
20
|
+
once: OnEvent<this>;
|
|
21
|
+
removeListener: OnEvent<this>;
|
|
22
|
+
functions: {};
|
|
23
|
+
callStatic: {};
|
|
24
|
+
filters: {};
|
|
25
|
+
estimateGas: {};
|
|
26
|
+
populateTransaction: {};
|
|
27
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Signer, ContractFactory, Overrides } from "ethers";
|
|
2
|
+
import type { Provider, TransactionRequest } from "@ethersproject/providers";
|
|
3
|
+
import type { PromiseOrValue } from "../common";
|
|
4
|
+
import type { SafeERC20, SafeERC20Interface } from "../SafeERC20";
|
|
5
|
+
type SafeERC20ConstructorParams = [signer?: Signer] | ConstructorParameters<typeof ContractFactory>;
|
|
6
|
+
export declare class SafeERC20__factory extends ContractFactory {
|
|
7
|
+
constructor(...args: SafeERC20ConstructorParams);
|
|
8
|
+
deploy(overrides?: Overrides & {
|
|
9
|
+
from?: PromiseOrValue<string>;
|
|
10
|
+
}): Promise<SafeERC20>;
|
|
11
|
+
getDeployTransaction(overrides?: Overrides & {
|
|
12
|
+
from?: PromiseOrValue<string>;
|
|
13
|
+
}): TransactionRequest;
|
|
14
|
+
attach(address: string): SafeERC20;
|
|
15
|
+
connect(signer: Signer): SafeERC20__factory;
|
|
16
|
+
static readonly bytecode = "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122010ed61e36afc365f1eded6e9c818de6f0f1b5628720ffe04dc70323ec79eb82964736f6c63430008110033";
|
|
17
|
+
static readonly abi: readonly [{
|
|
18
|
+
readonly type: "error";
|
|
19
|
+
readonly name: "ForceApproveFailed";
|
|
20
|
+
readonly inputs: readonly [];
|
|
21
|
+
}, {
|
|
22
|
+
readonly type: "error";
|
|
23
|
+
readonly name: "Permit2TransferAmountTooHigh";
|
|
24
|
+
readonly inputs: readonly [];
|
|
25
|
+
}, {
|
|
26
|
+
readonly type: "error";
|
|
27
|
+
readonly name: "SafeDecreaseAllowanceFailed";
|
|
28
|
+
readonly inputs: readonly [];
|
|
29
|
+
}, {
|
|
30
|
+
readonly type: "error";
|
|
31
|
+
readonly name: "SafeIncreaseAllowanceFailed";
|
|
32
|
+
readonly inputs: readonly [];
|
|
33
|
+
}, {
|
|
34
|
+
readonly type: "error";
|
|
35
|
+
readonly name: "SafePermitBadLength";
|
|
36
|
+
readonly inputs: readonly [];
|
|
37
|
+
}, {
|
|
38
|
+
readonly type: "error";
|
|
39
|
+
readonly name: "SafeTransferFailed";
|
|
40
|
+
readonly inputs: readonly [];
|
|
41
|
+
}, {
|
|
42
|
+
readonly type: "error";
|
|
43
|
+
readonly name: "SafeTransferFromFailed";
|
|
44
|
+
readonly inputs: readonly [];
|
|
45
|
+
}];
|
|
46
|
+
static createInterface(): SafeERC20Interface;
|
|
47
|
+
static connect(address: string, signerOrProvider: Signer | Provider): SafeERC20;
|
|
48
|
+
}
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SafeERC20__factory = void 0;
|
|
4
|
+
/* Autogenerated file. Do not edit manually. */
|
|
5
|
+
/* tslint:disable */
|
|
6
|
+
/* eslint-disable */
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const _abi = [
|
|
9
|
+
{
|
|
10
|
+
type: "error",
|
|
11
|
+
name: "ForceApproveFailed",
|
|
12
|
+
inputs: [],
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
type: "error",
|
|
16
|
+
name: "Permit2TransferAmountTooHigh",
|
|
17
|
+
inputs: [],
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
type: "error",
|
|
21
|
+
name: "SafeDecreaseAllowanceFailed",
|
|
22
|
+
inputs: [],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
type: "error",
|
|
26
|
+
name: "SafeIncreaseAllowanceFailed",
|
|
27
|
+
inputs: [],
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
type: "error",
|
|
31
|
+
name: "SafePermitBadLength",
|
|
32
|
+
inputs: [],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: "error",
|
|
36
|
+
name: "SafeTransferFailed",
|
|
37
|
+
inputs: [],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
type: "error",
|
|
41
|
+
name: "SafeTransferFromFailed",
|
|
42
|
+
inputs: [],
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
const _bytecode = "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122010ed61e36afc365f1eded6e9c818de6f0f1b5628720ffe04dc70323ec79eb82964736f6c63430008110033";
|
|
46
|
+
const isSuperArgs = (xs) => xs.length > 1;
|
|
47
|
+
class SafeERC20__factory extends ethers_1.ContractFactory {
|
|
48
|
+
constructor(...args) {
|
|
49
|
+
if (isSuperArgs(args)) {
|
|
50
|
+
super(...args);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
super(_abi, _bytecode, args[0]);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
deploy(overrides) {
|
|
57
|
+
return super.deploy(overrides || {});
|
|
58
|
+
}
|
|
59
|
+
getDeployTransaction(overrides) {
|
|
60
|
+
return super.getDeployTransaction(overrides || {});
|
|
61
|
+
}
|
|
62
|
+
attach(address) {
|
|
63
|
+
return super.attach(address);
|
|
64
|
+
}
|
|
65
|
+
connect(signer) {
|
|
66
|
+
return super.connect(signer);
|
|
67
|
+
}
|
|
68
|
+
static bytecode = _bytecode;
|
|
69
|
+
static abi = _abi;
|
|
70
|
+
static createInterface() {
|
|
71
|
+
return new ethers_1.utils.Interface(_abi);
|
|
72
|
+
}
|
|
73
|
+
static connect(address, signerOrProvider) {
|
|
74
|
+
return new ethers_1.Contract(address, _abi, signerOrProvider);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.SafeERC20__factory = SafeERC20__factory;
|
|
@@ -97,3 +97,4 @@ export { RedstoneConstants__factory } from "./RedstoneConstants__factory";
|
|
|
97
97
|
export { RedstoneConsumerBase__factory } from "./RedstoneConsumerBase__factory";
|
|
98
98
|
export { RedstoneConsumerNumericBase__factory } from "./RedstoneConsumerNumericBase__factory";
|
|
99
99
|
export { RedstoneDefaultsLib__factory } from "./RedstoneDefaultsLib__factory";
|
|
100
|
+
export { SafeERC20__factory } from "./SafeERC20__factory";
|
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.IAaveV2_WrappedATokenAdapter__factory = exports.IAaveV2_LendingPoolAdapter__factory = exports.FarmAccounting__factory = exports.Errors__factory = exports.ERC20__factory = exports.ContractsRegisterTrait__factory = exports.CompositePriceFeed__factory = exports.Claimable__factory = exports.CalldataExtractor__factory = exports.AddressProvider__factory = exports.contracts = exports.redstonePriceFeedSol = exports.iwstEthGatewaySol = exports.iwstEthSol = exports.istEthSol = exports.iUniswapV3AdapterSol = exports.iUniswapV3Sol = exports.iUniswapV2AdapterSol = exports.iPriceOracleV3Sol = exports.iPriceOracleSol = exports.iPriceFeedSol = exports.iPoolV3Sol = exports.iPoolServiceSol = exports.iPoolQuotaKeeperV3Sol = exports.ilpPriceFeedSol = exports.iGearStakingV3Sol = exports.iGaugeV3Sol = exports.iDegenNftv2Sol = exports.iDegenDistributorSol = exports.iCurvePool4Sol = exports.iCurvePool3Sol = exports.iCurvePool2Sol = exports.iCreditManagerV3Sol = exports.iCreditManagerV2Sol = exports.iCreditFacadeV3Sol = exports.iCreditFacadeV2Sol = exports.iCreditConfiguratorV3Sol = exports.iCreditConfiguratorV2Sol = exports.iCreditAccountV3Sol = exports.iConvexV1BoosterAdapterSol = exports.iControllerTimelockV3Sol = exports.iContractsRegisterSol = exports.iCompoundV2CTokenAdapterSol = exports.iBotListV3Sol = exports.iBalancerV2VaultAdapterSol = exports.iBalancerV2VaultSol = exports.iAirdropDistributorSol = exports.iAddressProviderV3Sol = exports.iAddressProviderSol = exports.balancesSol = void 0;
|
|
27
|
-
exports.RedstoneDefaultsLib__factory = exports.RedstoneConsumerNumericBase__factory = exports.RedstoneConsumerBase__factory = exports.RedstoneConstants__factory = exports.PartialLiquidationBotV3__factory = exports.Ownable__factory = exports.NumericArrayLib__factory = exports.IwstETHV1Adapter__factory = exports.IZapperRegister__factory = exports.IZapper__factory = exports.IYearnV2Adapter__factory = exports.IYVault__factory = exports.IWETHGateway__factory = exports.IWETH__factory = exports.IVotingContractV3__factory = exports.IVersion__factory = exports.IRouterV3__factory = exports.IRouter__factory = exports.IPriceOracleBase__factory = exports.IPermit2__factory = exports.IPartialLiquidationBotV3__factory = exports.IOffchainOracle__factory = exports.ILinearInterestRateModelV3__factory = exports.ILidoV1Adapter__factory = exports.IInterestRateModel__factory = exports.IFarmingPool__factory = exports.IETHZapperDeposits__factory = exports.IERC721Metadata__factory = exports.IERC721__factory = exports.IERC4626Adapter__factory = exports.IERC4626__factory = exports.IERC20ZapperDeposits__factory = exports.IERC20Permit__factory = exports.IERC20Metadata__factory = exports.IERC20__factory = exports.IERC165__factory = exports.IDataCompressorV3__factory = exports.IDataCompressorV2_1__factory = exports.IDaiLikePermit__factory = exports.ICurveV1_4AssetsAdapter__factory = exports.ICurveV1_3AssetsAdapter__factory = exports.ICurveV1_2AssetsAdapter__factory = exports.ICurveV1Adapter__factory = exports.ICurvePool__factory = exports.ICreditFacadeV3Multicall__factory = exports.IConvexV1BaseRewardPoolAdapter__factory = exports.IConvexToken__factory = exports.IBaseRewardPool__factory = exports.IAdapter__factory = void 0;
|
|
27
|
+
exports.SafeERC20__factory = exports.RedstoneDefaultsLib__factory = exports.RedstoneConsumerNumericBase__factory = exports.RedstoneConsumerBase__factory = exports.RedstoneConstants__factory = exports.PartialLiquidationBotV3__factory = exports.Ownable__factory = exports.NumericArrayLib__factory = exports.IwstETHV1Adapter__factory = exports.IZapperRegister__factory = exports.IZapper__factory = exports.IYearnV2Adapter__factory = exports.IYVault__factory = exports.IWETHGateway__factory = exports.IWETH__factory = exports.IVotingContractV3__factory = exports.IVersion__factory = exports.IRouterV3__factory = exports.IRouter__factory = exports.IPriceOracleBase__factory = exports.IPermit2__factory = exports.IPartialLiquidationBotV3__factory = exports.IOffchainOracle__factory = exports.ILinearInterestRateModelV3__factory = exports.ILidoV1Adapter__factory = exports.IInterestRateModel__factory = exports.IFarmingPool__factory = exports.IETHZapperDeposits__factory = exports.IERC721Metadata__factory = exports.IERC721__factory = exports.IERC4626Adapter__factory = exports.IERC4626__factory = exports.IERC20ZapperDeposits__factory = exports.IERC20Permit__factory = exports.IERC20Metadata__factory = exports.IERC20__factory = exports.IERC165__factory = exports.IDataCompressorV3__factory = exports.IDataCompressorV2_1__factory = exports.IDaiLikePermit__factory = exports.ICurveV1_4AssetsAdapter__factory = exports.ICurveV1_3AssetsAdapter__factory = exports.ICurveV1_2AssetsAdapter__factory = exports.ICurveV1Adapter__factory = exports.ICurvePool__factory = exports.ICreditFacadeV3Multicall__factory = exports.IConvexV1BaseRewardPoolAdapter__factory = exports.IConvexToken__factory = exports.IBaseRewardPool__factory = exports.IAdapter__factory = void 0;
|
|
28
28
|
/* Autogenerated file. Do not edit manually. */
|
|
29
29
|
/* tslint:disable */
|
|
30
30
|
/* eslint-disable */
|
|
@@ -186,3 +186,5 @@ var RedstoneConsumerNumericBase__factory_1 = require("./RedstoneConsumerNumericB
|
|
|
186
186
|
Object.defineProperty(exports, "RedstoneConsumerNumericBase__factory", { enumerable: true, get: function () { return RedstoneConsumerNumericBase__factory_1.RedstoneConsumerNumericBase__factory; } });
|
|
187
187
|
var RedstoneDefaultsLib__factory_1 = require("./RedstoneDefaultsLib__factory");
|
|
188
188
|
Object.defineProperty(exports, "RedstoneDefaultsLib__factory", { enumerable: true, get: function () { return RedstoneDefaultsLib__factory_1.RedstoneDefaultsLib__factory; } });
|
|
189
|
+
var SafeERC20__factory_1 = require("./SafeERC20__factory");
|
|
190
|
+
Object.defineProperty(exports, "SafeERC20__factory", { enumerable: true, get: function () { return SafeERC20__factory_1.SafeERC20__factory; } });
|
package/lib/types/index.d.ts
CHANGED
|
@@ -137,6 +137,7 @@ export type { RedstoneConstants } from "./RedstoneConstants";
|
|
|
137
137
|
export type { RedstoneConsumerBase } from "./RedstoneConsumerBase";
|
|
138
138
|
export type { RedstoneConsumerNumericBase } from "./RedstoneConsumerNumericBase";
|
|
139
139
|
export type { RedstoneDefaultsLib } from "./RedstoneDefaultsLib";
|
|
140
|
+
export type { SafeERC20 } from "./SafeERC20";
|
|
140
141
|
export * as factories from "./factories";
|
|
141
142
|
export { AddressProvider__factory } from "./factories/AddressProvider__factory";
|
|
142
143
|
export type { BalanceOps } from "./Balances.sol/BalanceOps";
|
|
@@ -369,3 +370,4 @@ export type { IRedstonePriceFeedExceptions } from "./RedstonePriceFeed.sol/IReds
|
|
|
369
370
|
export { IRedstonePriceFeedExceptions__factory } from "./factories/RedstonePriceFeed.sol/IRedstonePriceFeedExceptions__factory";
|
|
370
371
|
export type { RedstonePriceFeed } from "./RedstonePriceFeed.sol/RedstonePriceFeed";
|
|
371
372
|
export { RedstonePriceFeed__factory } from "./factories/RedstonePriceFeed.sol/RedstonePriceFeed__factory";
|
|
373
|
+
export { SafeERC20__factory } from "./factories/SafeERC20__factory";
|
package/lib/types/index.js
CHANGED
|
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.ICreditFacadeV2V2__factory = exports.ICreditFacadeV2Extended__factory = exports.ICreditFacadeV2Exceptions__factory = exports.ICreditFacadeV2Events__factory = exports.ICreditFacadeV2__factory = exports.ICreditConfiguratorV3Events__factory = exports.ICreditConfiguratorV3__factory = exports.ICreditConfiguratorV2Exceptions__factory = exports.ICreditConfiguratorV2Events__factory = exports.ICreditConfiguratorV2__factory = exports.ICreditAccountV3__factory = exports.ICreditAccountBase__factory = exports.IConvexV1BoosterAdapterEvents__factory = exports.IConvexV1BoosterAdapter__factory = exports.IConvexV1BaseRewardPoolAdapter__factory = exports.IConvexToken__factory = exports.IControllerTimelockV3Events__factory = exports.IControllerTimelockV3__factory = exports.IContractsRegisterEvents__factory = exports.IContractsRegister__factory = exports.ICompoundV2_Exceptions__factory = exports.ICompoundV2_CTokenAdapter__factory = exports.IBotListV3Events__factory = exports.IBotListV3__factory = exports.IBaseRewardPool__factory = exports.IBalancerV2VaultAdapterExceptions__factory = exports.IBalancerV2VaultAdapterEvents__factory = exports.IBalancerV2VaultAdapter__factory = exports.IBalancerV2VaultGetters__factory = exports.IBalancerV2Vault__factory = exports.IAirdropDistributorEvents__factory = exports.IAirdropDistributor__factory = exports.IAddressProviderV3Events__factory = exports.IAddressProviderV3__factory = exports.IAddressProviderEvents__factory = exports.IAddressProvider__factory = exports.IAdapter__factory = exports.IAaveV2_WrappedATokenAdapter__factory = exports.IAaveV2_LendingPoolAdapter__factory = exports.FarmAccounting__factory = exports.Errors__factory = exports.ERC20__factory = exports.ContractsRegisterTrait__factory = exports.IGasPricer__factory = exports.CompositePriceFeed__factory = exports.Claimable__factory = exports.CalldataExtractor__factory = exports.BalanceOps__factory = exports.AddressProvider__factory = exports.factories = void 0;
|
|
27
27
|
exports.IPoolQuotaKeeperV3Events__factory = exports.IPoolQuotaKeeperV3__factory = exports.IPermit2__factory = exports.IPartialLiquidationBotV3__factory = exports.IOffchainOracle__factory = exports.ILPPriceFeedExceptions__factory = exports.ILPPriceFeedEvents__factory = exports.ILPPriceFeed__factory = exports.ILinearInterestRateModelV3__factory = exports.ILidoV1Adapter__factory = exports.IInterestRateModel__factory = exports.IGearStakingV3Events__factory = exports.IGearStakingV3__factory = exports.IGaugeV3Events__factory = exports.IGaugeV3__factory = exports.IFarmingPool__factory = exports.IETHZapperDeposits__factory = exports.IERC721Metadata__factory = exports.IERC721__factory = exports.IERC4626Adapter__factory = exports.IERC4626__factory = exports.IERC20ZapperDeposits__factory = exports.IERC20Permit__factory = exports.IERC20Metadata__factory = exports.IERC20__factory = exports.IERC165__factory = exports.IDegenNFTV2Exceptions__factory = exports.IDegenNFTV2Events__factory = exports.IDegenNFTV2__factory = exports.IDegenDistributorEvents__factory = exports.IDegenDistributor__factory = exports.IDataCompressorV3__factory = exports.IDataCompressorV2_1__factory = exports.IDaiLikePermit__factory = exports.ICurveV1Adapter__factory = exports.ICurveV1_4AssetsAdapter__factory = exports.ICurveV1_3AssetsAdapter__factory = exports.ICurveV1_2AssetsAdapter__factory = exports.ICurvePool__factory = exports.ICurvePool4Assets__factory = exports.ICurvePool3Assets__factory = exports.ICurvePool2Assets__factory = exports.ICreditManagerV3Events__factory = exports.ICreditManagerV3__factory = exports.ICreditManagerV2Exceptions__factory = exports.ICreditManagerV2Events__factory = exports.ICreditManagerV2__factory = exports.ICreditFacadeV3Multicall__factory = exports.ICreditFacadeV3Events__factory = exports.ICreditFacadeV3__factory = void 0;
|
|
28
|
-
exports.RedstonePriceFeed__factory = exports.IRedstonePriceFeedExceptions__factory = exports.IRedstonePriceFeedEvents__factory = exports.RedstoneDefaultsLib__factory = exports.RedstoneConsumerNumericBase__factory = exports.RedstoneConsumerBase__factory = exports.RedstoneConstants__factory = exports.PartialLiquidationBotV3__factory = exports.Ownable__factory = exports.NumericArrayLib__factory = exports.IZapperRegister__factory = exports.IZapper__factory = exports.IYVault__factory = exports.IYearnV2Adapter__factory = exports.IwstETHV1Adapter__factory = exports.IwstETHGateWay__factory = exports.IwstETHGetters__factory = exports.IwstETH__factory = exports.IWETHGateway__factory = exports.IWETH__factory = exports.IVotingContractV3__factory = exports.IVersion__factory = exports.IUniswapV3AdapterExceptions__factory = exports.IUniswapV3AdapterEvents__factory = exports.IUniswapV3Adapter__factory = exports.ISwapRouter__factory = exports.IUniswapV2AdapterExceptions__factory = exports.IUniswapV2AdapterEvents__factory = exports.IUniswapV2Adapter__factory = exports.IstETHGetters__factory = exports.IstETH__factory = exports.IRouterV3__factory = exports.IRouter__factory = exports.IPriceOracleV3Events__factory = exports.IPriceOracleV3__factory = exports.IPriceOracleBase__factory = exports.IPriceOracleV2Ext__factory = exports.IPriceOracleV2Exceptions__factory = exports.IPriceOracleV2Events__factory = exports.IPriceOracleV2__factory = exports.IUpdatablePriceFeed__factory = exports.IPriceFeed__factory = exports.IPoolV3Events__factory = exports.IPoolV3__factory = exports.IPoolServiceEvents__factory = exports.IPoolService__factory = void 0;
|
|
28
|
+
exports.SafeERC20__factory = exports.RedstonePriceFeed__factory = exports.IRedstonePriceFeedExceptions__factory = exports.IRedstonePriceFeedEvents__factory = exports.RedstoneDefaultsLib__factory = exports.RedstoneConsumerNumericBase__factory = exports.RedstoneConsumerBase__factory = exports.RedstoneConstants__factory = exports.PartialLiquidationBotV3__factory = exports.Ownable__factory = exports.NumericArrayLib__factory = exports.IZapperRegister__factory = exports.IZapper__factory = exports.IYVault__factory = exports.IYearnV2Adapter__factory = exports.IwstETHV1Adapter__factory = exports.IwstETHGateWay__factory = exports.IwstETHGetters__factory = exports.IwstETH__factory = exports.IWETHGateway__factory = exports.IWETH__factory = exports.IVotingContractV3__factory = exports.IVersion__factory = exports.IUniswapV3AdapterExceptions__factory = exports.IUniswapV3AdapterEvents__factory = exports.IUniswapV3Adapter__factory = exports.ISwapRouter__factory = exports.IUniswapV2AdapterExceptions__factory = exports.IUniswapV2AdapterEvents__factory = exports.IUniswapV2Adapter__factory = exports.IstETHGetters__factory = exports.IstETH__factory = exports.IRouterV3__factory = exports.IRouter__factory = exports.IPriceOracleV3Events__factory = exports.IPriceOracleV3__factory = exports.IPriceOracleBase__factory = exports.IPriceOracleV2Ext__factory = exports.IPriceOracleV2Exceptions__factory = exports.IPriceOracleV2Events__factory = exports.IPriceOracleV2__factory = exports.IUpdatablePriceFeed__factory = exports.IPriceFeed__factory = exports.IPoolV3Events__factory = exports.IPoolV3__factory = exports.IPoolServiceEvents__factory = exports.IPoolService__factory = void 0;
|
|
29
29
|
exports.factories = __importStar(require("./factories"));
|
|
30
30
|
var AddressProvider__factory_1 = require("./factories/AddressProvider__factory");
|
|
31
31
|
Object.defineProperty(exports, "AddressProvider__factory", { enumerable: true, get: function () { return AddressProvider__factory_1.AddressProvider__factory; } });
|
|
@@ -317,3 +317,5 @@ var IRedstonePriceFeedExceptions__factory_1 = require("./factories/RedstonePrice
|
|
|
317
317
|
Object.defineProperty(exports, "IRedstonePriceFeedExceptions__factory", { enumerable: true, get: function () { return IRedstonePriceFeedExceptions__factory_1.IRedstonePriceFeedExceptions__factory; } });
|
|
318
318
|
var RedstonePriceFeed__factory_1 = require("./factories/RedstonePriceFeed.sol/RedstonePriceFeed__factory");
|
|
319
319
|
Object.defineProperty(exports, "RedstonePriceFeed__factory", { enumerable: true, get: function () { return RedstonePriceFeed__factory_1.RedstonePriceFeed__factory; } });
|
|
320
|
+
var SafeERC20__factory_1 = require("./factories/SafeERC20__factory");
|
|
321
|
+
Object.defineProperty(exports, "SafeERC20__factory", { enumerable: true, get: function () { return SafeERC20__factory_1.SafeERC20__factory; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/sdk",
|
|
3
|
-
"version": "3.0.0-next.
|
|
3
|
+
"version": "3.0.0-next.168",
|
|
4
4
|
"description": "Gearbox SDK",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@gearbox-protocol/bots-v3": "^1.5.1",
|
|
34
|
-
"@gearbox-protocol/sdk-gov": "^1.
|
|
34
|
+
"@gearbox-protocol/sdk-gov": "^1.62.2",
|
|
35
35
|
"axios": "^1.2.6",
|
|
36
36
|
"decimal.js-light": "^2.5.1",
|
|
37
37
|
"deep-eql": "^4.1.0",
|
|
@@ -43,14 +43,14 @@
|
|
|
43
43
|
"@commitlint/cli": "^17.6.3",
|
|
44
44
|
"@commitlint/config-conventional": "^17.0.3",
|
|
45
45
|
"@gearbox-protocol/core-v2": "1.19.0-base.17",
|
|
46
|
-
"@gearbox-protocol/core-v3": "^1.49.
|
|
46
|
+
"@gearbox-protocol/core-v3": "^1.49.6",
|
|
47
47
|
"@gearbox-protocol/eslint-config": "^1.4.1",
|
|
48
|
-
"@gearbox-protocol/integrations-v3": "^1.40.
|
|
48
|
+
"@gearbox-protocol/integrations-v3": "^1.40.3",
|
|
49
49
|
"@gearbox-protocol/oracles-v3": "^1.10.3",
|
|
50
50
|
"@gearbox-protocol/periphery-v3": "^1.6.1",
|
|
51
51
|
"@gearbox-protocol/prettier-config": "^1.4.1",
|
|
52
52
|
"@gearbox-protocol/router": "^1.5.5",
|
|
53
|
-
"@gearbox-protocol/router-v3": "^1.
|
|
53
|
+
"@gearbox-protocol/router-v3": "^1.22.0",
|
|
54
54
|
"@openzeppelin/contracts": "^4.9.3",
|
|
55
55
|
"@redstone-finance/evm-connector": "^0.3.6",
|
|
56
56
|
"@typechain/ethers-v5": "^10.1.0",
|