Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@gelatonetwork/aave-protection-lib

Package Overview
Dependencies
Maintainers
6
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gelatonetwork/aave-protection-lib - npm Package Compare versions

Comparing version 1.11.1 to 2.0.0

2

dist/constants/index.d.ts
import { Addresses } from "../types";
export declare const addresses: (chainId: number) => Addresses;
export declare const subgraphUrl = "https://api.thegraph.com/subgraphs/name/gelatodigital/aave-protection-subgraph";
export declare const getSubgraphUrl: (chainId: number) => string;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.subgraphUrl = exports.addresses = void 0;
exports.getSubgraphUrl = exports.addresses = void 0;
const maticAddresses = {

@@ -11,4 +11,12 @@ Gelato: "0x7598e84B2E114AB62CAB288CE5f7d5f6bad35BbA",

};
const mainnetAddresses = {
Gelato: "0x3CACa7b48D0573D793d3b0279b5F0029180E83b6",
AaveServices: "0xE3d373c78803C1d22cE96bdC43d47542835bBF42",
ProtectionAction: "0x83c403eCC6393036d8e4e059fF18FabBc7C68c8F",
LendingPool: "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9",
};
const addresses = (chainId) => {
switch (chainId) {
case 1:
return mainnetAddresses;
case 137:

@@ -21,2 +29,12 @@ return maticAddresses;

exports.addresses = addresses;
exports.subgraphUrl = "https://api.thegraph.com/subgraphs/name/gelatodigital/aave-protection-subgraph";
const getSubgraphUrl = (chainId) => {
switch (chainId) {
case 1:
return "https://api.thegraph.com/subgraphs/name/gelatodigital/aave-protection-subgraph-mainnet";
case 137:
return "https://api.thegraph.com/subgraphs/name/gelatodigital/aave-protection-subgraph";
default:
throw new Error(`CHAIN_ID ${chainId} NOT SUPPORTED`);
}
};
exports.getSubgraphUrl = getSubgraphUrl;

@@ -5,12 +5,12 @@ import { BigNumber, ContractTransaction, ethers } from "ethers";

export declare const cancelProtection: (provider: ethers.providers.Web3Provider) => Promise<ContractTransaction>;
export declare const cancelOldProtection: (provider: ethers.providers.Web3Provider) => Promise<ContractTransaction>;
export declare const cancelOldProtection: (provider: ethers.providers.Web3Provider) => Promise<ContractTransaction | undefined>;
export declare const updateProtection: (provider: ethers.providers.Web3Provider, colToken: string, debtToken: string, rateMode: BigNumber, wantedHealthFactor: BigNumber, minimumHealthFactor: BigNumber, isPermanent: boolean) => Promise<ContractTransaction>;
export declare const isProtectionDeprecated: (user: string) => Promise<boolean>;
export declare const hasUserUpgraded: (user: string) => Promise<boolean>;
export declare const upgradedUserStillHasDeprecatedProtection: (user: string) => Promise<boolean>;
export declare const getSubmittedProtection: (user: string) => Promise<Protection | undefined>;
export declare const getSubmittedOldProtection: (user: string) => Promise<Protection | undefined>;
export declare const getCancelledProtection: (user: string) => Promise<Protection[]>;
export declare const getCancelledOldProtection: (user: string) => Promise<Protection[]>;
export declare const getExecutedProtection: (user: string) => Promise<Protection[]>;
export declare const getExecutedOldProtection: (user: string) => Promise<Protection[]>;
export declare const isProtectionDeprecated: (provider: ethers.providers.Web3Provider) => Promise<boolean | undefined>;
export declare const hasUserUpgraded: (provider: ethers.providers.Web3Provider) => Promise<boolean | undefined>;
export declare const upgradedUserStillHasDeprecatedProtection: (provider: ethers.providers.Web3Provider) => Promise<boolean | undefined>;
export declare const getSubmittedProtection: (provider: ethers.providers.Web3Provider) => Promise<Protection | undefined>;
export declare const getSubmittedOldProtection: (provider: ethers.providers.Web3Provider) => Promise<Protection | undefined>;
export declare const getCancelledProtection: (provider: ethers.providers.Web3Provider) => Promise<Protection[]>;
export declare const getCancelledOldProtection: (provider: ethers.providers.Web3Provider) => Promise<Protection[] | undefined>;
export declare const getExecutedProtection: (provider: ethers.providers.Web3Provider) => Promise<Protection[]>;
export declare const getExecutedOldProtection: (provider: ethers.providers.Web3Provider) => Promise<Protection[] | undefined>;

@@ -28,3 +28,5 @@ "use strict";

const cancelOldProtection = (provider) => __awaiter(void 0, void 0, void 0, function* () {
return contracts_1.getAaveServices(provider).cancelTask(constants_1.addresses(provider.network.chainId).OldProtectionAction);
if (provider.network.chainId !== 137)
return undefined;
return contracts_1.getAaveServices(provider).cancelTask(constants_1.addresses(137).OldProtectionAction);
});

@@ -40,43 +42,55 @@ exports.cancelOldProtection = cancelOldProtection;

exports.updateProtection = updateProtection;
const isProtectionDeprecated = (user) => __awaiter(void 0, void 0, void 0, function* () {
return ((yield exports.getSubmittedOldProtection(user)) !== undefined &&
(yield exports.getSubmittedProtection(user)) === undefined &&
(yield exports.getCancelledProtection(user)).length === 0 &&
(yield exports.getExecutedProtection(user)).length === 0);
const isProtectionDeprecated = (provider) => __awaiter(void 0, void 0, void 0, function* () {
if (provider.network.chainId !== 137)
return undefined;
return ((yield exports.getSubmittedOldProtection(provider)) !== undefined &&
(yield exports.getSubmittedProtection(provider)) === undefined &&
(yield exports.getCancelledProtection(provider)).length === 0 &&
(yield exports.getExecutedProtection(provider)).length === 0);
});
exports.isProtectionDeprecated = isProtectionDeprecated;
const hasUserUpgraded = (user) => __awaiter(void 0, void 0, void 0, function* () {
return ((yield exports.getSubmittedProtection(user)) !== undefined ||
(yield exports.getCancelledProtection(user)).length > 0 ||
(yield exports.getExecutedProtection(user)).length > 0);
const hasUserUpgraded = (provider) => __awaiter(void 0, void 0, void 0, function* () {
if (provider.network.chainId !== 137)
return undefined;
return ((yield exports.getSubmittedProtection(provider)) !== undefined ||
(yield exports.getCancelledProtection(provider)).length > 0 ||
(yield exports.getExecutedProtection(provider)).length > 0);
});
exports.hasUserUpgraded = hasUserUpgraded;
const upgradedUserStillHasDeprecatedProtection = (user) => __awaiter(void 0, void 0, void 0, function* () {
return ((yield exports.hasUserUpgraded(user)) &&
(yield exports.getSubmittedOldProtection(user)) !== undefined);
const upgradedUserStillHasDeprecatedProtection = (provider) => __awaiter(void 0, void 0, void 0, function* () {
if (provider.network.chainId !== 137)
return undefined;
return ((yield exports.hasUserUpgraded(provider)) &&
(yield exports.getSubmittedOldProtection(provider)) !== undefined);
});
exports.upgradedUserStillHasDeprecatedProtection = upgradedUserStillHasDeprecatedProtection;
const getSubmittedProtection = (user) => __awaiter(void 0, void 0, void 0, function* () {
return yield protections_1.getSubmittedProtectionByUserAndAction(user, constants_1.addresses(137).ProtectionAction);
const getSubmittedProtection = (provider) => __awaiter(void 0, void 0, void 0, function* () {
return yield protections_1.getSubmittedProtectionByUserAndAction(provider.network.chainId, yield provider.getSigner().getAddress(), constants_1.addresses(provider.network.chainId).ProtectionAction);
});
exports.getSubmittedProtection = getSubmittedProtection;
const getSubmittedOldProtection = (user) => __awaiter(void 0, void 0, void 0, function* () {
return protections_1.getSubmittedProtectionByUserAndAction(user, constants_1.addresses(137).OldProtectionAction);
const getSubmittedOldProtection = (provider) => __awaiter(void 0, void 0, void 0, function* () {
if (provider.network.chainId !== 137)
return undefined;
return protections_1.getSubmittedProtectionByUserAndAction(137, yield provider.getSigner().getAddress(), constants_1.addresses(137).OldProtectionAction);
});
exports.getSubmittedOldProtection = getSubmittedOldProtection;
const getCancelledProtection = (user) => __awaiter(void 0, void 0, void 0, function* () {
return protections_1.getCancelledProtectionByUserAndAction(user, constants_1.addresses(137).ProtectionAction);
const getCancelledProtection = (provider) => __awaiter(void 0, void 0, void 0, function* () {
return protections_1.getCancelledProtectionByUserAndAction(provider.network.chainId, yield provider.getSigner().getAddress(), constants_1.addresses(provider.network.chainId).ProtectionAction);
});
exports.getCancelledProtection = getCancelledProtection;
const getCancelledOldProtection = (user) => __awaiter(void 0, void 0, void 0, function* () {
return protections_1.getCancelledProtectionByUserAndAction(user, constants_1.addresses(137).OldProtectionAction);
const getCancelledOldProtection = (provider) => __awaiter(void 0, void 0, void 0, function* () {
if (provider.network.chainId !== 137)
return undefined;
return protections_1.getCancelledProtectionByUserAndAction(137, yield provider.getSigner().getAddress(), constants_1.addresses(137).OldProtectionAction);
});
exports.getCancelledOldProtection = getCancelledOldProtection;
const getExecutedProtection = (user) => __awaiter(void 0, void 0, void 0, function* () {
return protections_1.getExecutedProtectionByUserAndAction(user, constants_1.addresses(137).ProtectionAction);
const getExecutedProtection = (provider) => __awaiter(void 0, void 0, void 0, function* () {
return protections_1.getExecutedProtectionByUserAndAction(provider.network.chainId, yield provider.getSigner().getAddress(), constants_1.addresses(provider.network.chainId).ProtectionAction);
});
exports.getExecutedProtection = getExecutedProtection;
const getExecutedOldProtection = (user) => __awaiter(void 0, void 0, void 0, function* () {
return protections_1.getExecutedProtectionByUserAndAction(user, constants_1.addresses(137).OldProtectionAction);
const getExecutedOldProtection = (provider) => __awaiter(void 0, void 0, void 0, function* () {
if (provider.network.chainId !== 137)
return undefined;
return protections_1.getExecutedProtectionByUserAndAction(137, yield provider.getSigner().getAddress(), constants_1.addresses(137).OldProtectionAction);
});
exports.getExecutedOldProtection = getExecutedOldProtection;
import { Protection } from "../types";
export declare const getSubmittedProtectionByUserAndAction: (user: string, action: string) => Promise<Protection | undefined>;
export declare const getCancelledProtectionByUserAndAction: (user: string, action: string) => Promise<Protection[]>;
export declare const getExecutedProtectionByUserAndAction: (user: string, action: string) => Promise<Protection[]>;
export declare const getSubmittedProtectionByUserAndAction: (chainId: number, user: string, action: string) => Promise<Protection | undefined>;
export declare const getCancelledProtectionByUserAndAction: (chainId: number, user: string, action: string) => Promise<Protection[]>;
export declare const getExecutedProtectionByUserAndAction: (chainId: number, user: string, action: string) => Promise<Protection[]>;

@@ -16,4 +16,4 @@ "use strict";

const constants_1 = require("../constants");
const getSubmittedProtectionByUserAndAction = (user, action) => __awaiter(void 0, void 0, void 0, function* () {
const data = yield graphql_request_1.request(constants_1.subgraphUrl, graphql_1.GET_ALL_SUBMITTED_PROTECTION_BY_USER_AND_ACTION, {
const getSubmittedProtectionByUserAndAction = (chainId, user, action) => __awaiter(void 0, void 0, void 0, function* () {
const data = yield graphql_request_1.request(constants_1.getSubgraphUrl(chainId), graphql_1.GET_ALL_SUBMITTED_PROTECTION_BY_USER_AND_ACTION, {
user: user.toLowerCase(),

@@ -29,4 +29,4 @@ action: action.toLowerCase(),

exports.getSubmittedProtectionByUserAndAction = getSubmittedProtectionByUserAndAction;
const getCancelledProtectionByUserAndAction = (user, action) => __awaiter(void 0, void 0, void 0, function* () {
const data = yield graphql_request_1.request(constants_1.subgraphUrl, graphql_1.GET_ALL_CANCELLED_PROTECTION_BY_USER_AND_ACTION, {
const getCancelledProtectionByUserAndAction = (chainId, user, action) => __awaiter(void 0, void 0, void 0, function* () {
const data = yield graphql_request_1.request(constants_1.getSubgraphUrl(chainId), graphql_1.GET_ALL_CANCELLED_PROTECTION_BY_USER_AND_ACTION, {
user: user.toLowerCase(),

@@ -42,4 +42,4 @@ action: action.toLowerCase(),

exports.getCancelledProtectionByUserAndAction = getCancelledProtectionByUserAndAction;
const getExecutedProtectionByUserAndAction = (user, action) => __awaiter(void 0, void 0, void 0, function* () {
const data = yield graphql_request_1.request(constants_1.subgraphUrl, graphql_1.GET_ALL_EXECUTED_PROTECTION_BY_USER_AND_ACTION, {
const getExecutedProtectionByUserAndAction = (chainId, user, action) => __awaiter(void 0, void 0, void 0, function* () {
const data = yield graphql_request_1.request(constants_1.getSubgraphUrl(chainId), graphql_1.GET_ALL_EXECUTED_PROTECTION_BY_USER_AND_ACTION, {
user: user.toLowerCase(),

@@ -46,0 +46,0 @@ action: action.toLowerCase(),

@@ -44,4 +44,4 @@ import { BigNumber } from "@ethersproject/bignumber";

ProtectionAction: string;
OldProtectionAction: string;
OldProtectionAction?: string;
LendingPool: string;
}
{
"name": "@gelatonetwork/aave-protection-lib",
"version": "1.11.1",
"version": "2.0.0",
"description": "Aave Automated protection library for submitting and reading task.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc