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

@gearbox-protocol/airdrop

Package Overview
Dependencies
Maintainers
7
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gearbox-protocol/airdrop - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

12

dist/rewards/creditRewards.d.ts

@@ -9,2 +9,14 @@ import { TypedEvent } from "@gearbox-protocol/sdk/lib/types/common";

static parseEvents(events: Array<TypedEvent>, rewardPerBlock: RangedValue, toBlock: number): Array<Reward>;
static parseCMEvents(events: Array<TypedEvent>): {
borrowedRange: Record<string, RangedValue>;
totalBorrowedRange: RangedValue;
borrowed: Record<string, BigNumber>;
totalBorrowed: BigNumber;
};
static computeCMStats(creditManager: string, provider: providers.Provider, toBlock?: number): Promise<{
borrowedRange: Record<string, RangedValue>;
totalBorrowedRange: RangedValue;
borrowed: Record<string, BigNumber>;
totalBorrowed: BigNumber;
}>;
static computeRewardInt(toBlock: number, balance: RangedValue, totalSupply: RangedValue, rewardPerBlock: RangedValue): BigNumber;

@@ -11,0 +23,0 @@ protected static query(creditFacade: string, provider: providers.Provider, toBlock: number): Promise<Array<TypedEvent>>;

29

dist/rewards/creditRewards.js

@@ -30,2 +30,9 @@ "use strict";

static parseEvents(events, rewardPerBlock, toBlock) {
const { borrowedRange, totalBorrowedRange, borrowed } = CreditRewards.parseCMEvents(events);
return Object.keys(borrowed).map(address => ({
address: address.toLowerCase(),
amount: CreditRewards.computeRewardInt(toBlock, borrowedRange[address], totalBorrowedRange, rewardPerBlock),
}));
}
static parseCMEvents(events) {
const borrowedRange = {};

@@ -91,7 +98,21 @@ const totalBorrowedRange = new range_1.RangedValue();

});
return Object.keys(borrowed).map(address => ({
address: address.toLowerCase(),
amount: CreditRewards.computeRewardInt(toBlock, borrowedRange[address], totalBorrowedRange, rewardPerBlock),
}));
return {
borrowedRange,
totalBorrowedRange,
borrowed,
totalBorrowed,
};
}
static async computeCMStats(creditManager, provider, toBlock) {
const toBlockQuery = toBlock || (await provider.getBlockNumber());
const cm = sdk_1.ICreditManagerV2__factory.connect(creditManager, provider);
const cc = sdk_1.ICreditConfigurator__factory.connect(await cm.creditConfigurator(), provider);
const creditFacadesEvents = await cc.queryFilter(cc.filters.CreditFacadeUpgraded());
const events = [];
for (const cfe of creditFacadesEvents) {
const query = await CreditRewards.query(cfe.args.newCreditFacade, provider, toBlockQuery);
events.push(...query);
}
return CreditRewards.parseCMEvents(events);
}
static computeRewardInt(toBlock, balance, totalSupply, rewardPerBlock) {

@@ -98,0 +119,0 @@ const keys = Array.from(new Set([

6

package.json
{
"name": "@gearbox-protocol/airdrop",
"description": "Airdrop center for Gearbox protocol",
"version": "1.0.1",
"version": "1.0.2",
"homepage": "https://gearbox.fi",

@@ -32,4 +32,4 @@ "keywords": [

"test": "npx mocha --require ts-node/register core/**/*.spec.ts",
"update": "npx hardhat run scripts/updateRewards.ts -- network mainnet",
"update-goerli": "npx hardhat run scripts/updateRewards.ts -- network goerli"
"update": "npx hardhat run scripts/updateRewards.ts --network mainnet",
"update-goerli": "npx hardhat run scripts/updateRewards.ts --network goerli"
},

@@ -36,0 +36,0 @@ "dependencies": {},

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