@gearbox-protocol/sdk 1.15.10 → 1.15.12
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/pathfinder/pathfinder.js +14 -6
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IAirdropDistributor.sol/IAirdropDistributor.d.ts +36 -26
- package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/IAirdropDistributor.sol/IAirdropDistributorEvents.d.ts +14 -9
- package/lib/types/common.d.ts +1 -0
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IAirdropDistributor.sol/IAirdropDistributorEvents__factory.js +7 -1
- package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/IAirdropDistributor.sol/IAirdropDistributor__factory.js +7 -6
- package/package.json +1 -1
|
@@ -42,8 +42,8 @@ var constants_1 = require("../core/constants");
|
|
|
42
42
|
var token_1 = require("../tokens/token");
|
|
43
43
|
var types_1 = require("../types");
|
|
44
44
|
var pathOptions_1 = require("./pathOptions");
|
|
45
|
-
var MAX_GAS_PER_ROUTE =
|
|
46
|
-
var GAS_PER_BLOCK =
|
|
45
|
+
var MAX_GAS_PER_ROUTE = 200e6;
|
|
46
|
+
var GAS_PER_BLOCK = 400e6;
|
|
47
47
|
var PathFinder = /** @class */ (function () {
|
|
48
48
|
function PathFinder(address, provider, network, connectors) {
|
|
49
49
|
if (network === void 0) { network = "Mainnet"; }
|
|
@@ -69,7 +69,9 @@ var PathFinder = /** @class */ (function () {
|
|
|
69
69
|
slippage: slippage,
|
|
70
70
|
externalSlippage: false,
|
|
71
71
|
};
|
|
72
|
-
return [4 /*yield*/, this.pathFinder.callStatic.findAllSwaps(swapTask
|
|
72
|
+
return [4 /*yield*/, this.pathFinder.callStatic.findAllSwaps(swapTask, {
|
|
73
|
+
gasLimit: GAS_PER_BLOCK,
|
|
74
|
+
})];
|
|
73
75
|
case 1:
|
|
74
76
|
results = _a.sent();
|
|
75
77
|
unique = {};
|
|
@@ -94,7 +96,9 @@ var PathFinder = /** @class */ (function () {
|
|
|
94
96
|
switch (_a.label) {
|
|
95
97
|
case 0:
|
|
96
98
|
tokenInAddr = token_1.tokenDataByNetwork[this.network][tokenIn] || tokenIn;
|
|
97
|
-
return [4 /*yield*/, this.pathFinder.callStatic.findOneTokenPath(tokenInAddr, amount, token_1.tokenDataByNetwork[this.network][tokenOut] || tokenOut, creditAccount.addr, this._connectors, slippage
|
|
99
|
+
return [4 /*yield*/, this.pathFinder.callStatic.findOneTokenPath(tokenInAddr, amount, token_1.tokenDataByNetwork[this.network][tokenOut] || tokenOut, creditAccount.addr, this._connectors, slippage, {
|
|
100
|
+
gasLimit: GAS_PER_BLOCK,
|
|
101
|
+
})];
|
|
98
102
|
case 1:
|
|
99
103
|
result = _a.sent();
|
|
100
104
|
return [2 /*return*/, {
|
|
@@ -134,7 +138,9 @@ var PathFinder = /** @class */ (function () {
|
|
|
134
138
|
token: token,
|
|
135
139
|
balance: expectedBalancesAddr[token] || 0,
|
|
136
140
|
}); });
|
|
137
|
-
return [4 /*yield*/, this.pathFinder.callStatic.findOpenStrategyPath(cm.address, balances, targetAddr, this._connectors, slippage
|
|
141
|
+
return [4 /*yield*/, this.pathFinder.callStatic.findOpenStrategyPath(cm.address, balances, targetAddr, this._connectors, slippage, {
|
|
142
|
+
gasLimit: GAS_PER_BLOCK,
|
|
143
|
+
})];
|
|
138
144
|
case 1:
|
|
139
145
|
result = _a.sent();
|
|
140
146
|
balancesAfter = result[0].reduce(function (acc, b) {
|
|
@@ -168,7 +174,9 @@ var PathFinder = /** @class */ (function () {
|
|
|
168
174
|
loopsPerTx = Math.floor(GAS_PER_BLOCK / MAX_GAS_PER_ROUTE);
|
|
169
175
|
pathOptions = pathOptions_1.PathOptionFactory.generatePathOptions(creditAccount.allBalances, loopsPerTx);
|
|
170
176
|
requests = pathOptions.map(function (po) {
|
|
171
|
-
return _this.pathFinder.callStatic.findBestClosePath(creditAccount.addr, _this._connectors, slippage, po, loopsPerTx, false
|
|
177
|
+
return _this.pathFinder.callStatic.findBestClosePath(creditAccount.addr, _this._connectors, slippage, po, loopsPerTx, false, {
|
|
178
|
+
gasLimit: GAS_PER_BLOCK,
|
|
179
|
+
});
|
|
172
180
|
});
|
|
173
181
|
return [4 /*yield*/, Promise.all(requests)];
|
|
174
182
|
case 1:
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import type { BaseContract, BigNumber, BigNumberish, BytesLike, CallOverrides, ContractTransaction, Overrides, PopulatedTransaction, Signer, utils } from "ethers";
|
|
2
2
|
import type { FunctionFragment, Result, EventFragment } from "@ethersproject/abi";
|
|
3
3
|
import type { Listener, Provider } from "@ethersproject/providers";
|
|
4
|
-
import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from "../../../../../common";
|
|
4
|
+
import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent, PromiseOrValue } from "../../../../../common";
|
|
5
5
|
export interface IAirdropDistributorInterface extends utils.Interface {
|
|
6
6
|
functions: {
|
|
7
|
-
"claim(uint256,address,uint256,
|
|
7
|
+
"claim(uint256,address,uint256,bytes32[])": FunctionFragment;
|
|
8
8
|
"claimed(address)": FunctionFragment;
|
|
9
9
|
"merkleRoot()": FunctionFragment;
|
|
10
10
|
"token()": FunctionFragment;
|
|
11
11
|
};
|
|
12
12
|
getFunction(nameOrSignatureOrTopic: "claim" | "claimed" | "merkleRoot" | "token"): FunctionFragment;
|
|
13
|
-
encodeFunctionData(functionFragment: "claim", values: [
|
|
14
|
-
|
|
13
|
+
encodeFunctionData(functionFragment: "claim", values: [
|
|
14
|
+
PromiseOrValue<BigNumberish>,
|
|
15
|
+
PromiseOrValue<string>,
|
|
16
|
+
PromiseOrValue<BigNumberish>,
|
|
17
|
+
PromiseOrValue<BytesLike>[]
|
|
18
|
+
]): string;
|
|
19
|
+
encodeFunctionData(functionFragment: "claimed", values: [PromiseOrValue<string>]): string;
|
|
15
20
|
encodeFunctionData(functionFragment: "merkleRoot", values?: undefined): string;
|
|
16
21
|
encodeFunctionData(functionFragment: "token", values?: undefined): string;
|
|
17
22
|
decodeFunctionResult(functionFragment: "claim", data: BytesLike): Result;
|
|
@@ -19,7 +24,7 @@ export interface IAirdropDistributorInterface extends utils.Interface {
|
|
|
19
24
|
decodeFunctionResult(functionFragment: "merkleRoot", data: BytesLike): Result;
|
|
20
25
|
decodeFunctionResult(functionFragment: "token", data: BytesLike): Result;
|
|
21
26
|
events: {
|
|
22
|
-
"Claimed(address,uint256)": EventFragment;
|
|
27
|
+
"Claimed(address,uint256,bool)": EventFragment;
|
|
23
28
|
"RootUpdated(bytes32,bytes32)": EventFragment;
|
|
24
29
|
"TokenAllocated(address,uint8,uint256)": EventFragment;
|
|
25
30
|
};
|
|
@@ -30,8 +35,13 @@ export interface IAirdropDistributorInterface extends utils.Interface {
|
|
|
30
35
|
export interface ClaimedEventObject {
|
|
31
36
|
account: string;
|
|
32
37
|
amount: BigNumber;
|
|
38
|
+
historic: boolean;
|
|
33
39
|
}
|
|
34
|
-
export declare type ClaimedEvent = TypedEvent<[
|
|
40
|
+
export declare type ClaimedEvent = TypedEvent<[
|
|
41
|
+
string,
|
|
42
|
+
BigNumber,
|
|
43
|
+
boolean
|
|
44
|
+
], ClaimedEventObject>;
|
|
35
45
|
export declare type ClaimedEventFilter = TypedEventFilter<ClaimedEvent>;
|
|
36
46
|
export interface RootUpdatedEventObject {
|
|
37
47
|
oldRoot: string;
|
|
@@ -68,46 +78,46 @@ export interface IAirdropDistributor extends BaseContract {
|
|
|
68
78
|
once: OnEvent<this>;
|
|
69
79
|
removeListener: OnEvent<this>;
|
|
70
80
|
functions: {
|
|
71
|
-
claim(index: BigNumberish
|
|
72
|
-
from?:
|
|
81
|
+
claim(index: PromiseOrValue<BigNumberish>, account: PromiseOrValue<string>, totalAmount: PromiseOrValue<BigNumberish>, merkleProof: PromiseOrValue<BytesLike>[], overrides?: Overrides & {
|
|
82
|
+
from?: PromiseOrValue<string>;
|
|
73
83
|
}): Promise<ContractTransaction>;
|
|
74
|
-
claimed(user: string
|
|
84
|
+
claimed(user: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[BigNumber]>;
|
|
75
85
|
merkleRoot(overrides?: CallOverrides): Promise<[string]>;
|
|
76
86
|
token(overrides?: CallOverrides): Promise<[string]>;
|
|
77
87
|
};
|
|
78
|
-
claim(index: BigNumberish
|
|
79
|
-
from?:
|
|
88
|
+
claim(index: PromiseOrValue<BigNumberish>, account: PromiseOrValue<string>, totalAmount: PromiseOrValue<BigNumberish>, merkleProof: PromiseOrValue<BytesLike>[], overrides?: Overrides & {
|
|
89
|
+
from?: PromiseOrValue<string>;
|
|
80
90
|
}): Promise<ContractTransaction>;
|
|
81
|
-
claimed(user: string
|
|
91
|
+
claimed(user: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
|
|
82
92
|
merkleRoot(overrides?: CallOverrides): Promise<string>;
|
|
83
93
|
token(overrides?: CallOverrides): Promise<string>;
|
|
84
94
|
callStatic: {
|
|
85
|
-
claim(index: BigNumberish
|
|
86
|
-
claimed(user: string
|
|
95
|
+
claim(index: PromiseOrValue<BigNumberish>, account: PromiseOrValue<string>, totalAmount: PromiseOrValue<BigNumberish>, merkleProof: PromiseOrValue<BytesLike>[], overrides?: CallOverrides): Promise<void>;
|
|
96
|
+
claimed(user: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
|
|
87
97
|
merkleRoot(overrides?: CallOverrides): Promise<string>;
|
|
88
98
|
token(overrides?: CallOverrides): Promise<string>;
|
|
89
99
|
};
|
|
90
100
|
filters: {
|
|
91
|
-
"Claimed(address,uint256)"(account?: string | null, amount?:
|
|
92
|
-
Claimed(account?: string | null, amount?:
|
|
93
|
-
"RootUpdated(bytes32,bytes32)"(oldRoot?: null, newRoot?: BytesLike | null): RootUpdatedEventFilter;
|
|
94
|
-
RootUpdated(oldRoot?: null, newRoot?: BytesLike | null): RootUpdatedEventFilter;
|
|
95
|
-
"TokenAllocated(address,uint8,uint256)"(account?: string | null, campaignId?: BigNumberish | null, amount?: null): TokenAllocatedEventFilter;
|
|
96
|
-
TokenAllocated(account?: string | null, campaignId?: BigNumberish | null, amount?: null): TokenAllocatedEventFilter;
|
|
101
|
+
"Claimed(address,uint256,bool)"(account?: PromiseOrValue<string> | null, amount?: null, historic?: PromiseOrValue<boolean> | null): ClaimedEventFilter;
|
|
102
|
+
Claimed(account?: PromiseOrValue<string> | null, amount?: null, historic?: PromiseOrValue<boolean> | null): ClaimedEventFilter;
|
|
103
|
+
"RootUpdated(bytes32,bytes32)"(oldRoot?: null, newRoot?: PromiseOrValue<BytesLike> | null): RootUpdatedEventFilter;
|
|
104
|
+
RootUpdated(oldRoot?: null, newRoot?: PromiseOrValue<BytesLike> | null): RootUpdatedEventFilter;
|
|
105
|
+
"TokenAllocated(address,uint8,uint256)"(account?: PromiseOrValue<string> | null, campaignId?: PromiseOrValue<BigNumberish> | null, amount?: null): TokenAllocatedEventFilter;
|
|
106
|
+
TokenAllocated(account?: PromiseOrValue<string> | null, campaignId?: PromiseOrValue<BigNumberish> | null, amount?: null): TokenAllocatedEventFilter;
|
|
97
107
|
};
|
|
98
108
|
estimateGas: {
|
|
99
|
-
claim(index: BigNumberish
|
|
100
|
-
from?:
|
|
109
|
+
claim(index: PromiseOrValue<BigNumberish>, account: PromiseOrValue<string>, totalAmount: PromiseOrValue<BigNumberish>, merkleProof: PromiseOrValue<BytesLike>[], overrides?: Overrides & {
|
|
110
|
+
from?: PromiseOrValue<string>;
|
|
101
111
|
}): Promise<BigNumber>;
|
|
102
|
-
claimed(user: string
|
|
112
|
+
claimed(user: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
|
|
103
113
|
merkleRoot(overrides?: CallOverrides): Promise<BigNumber>;
|
|
104
114
|
token(overrides?: CallOverrides): Promise<BigNumber>;
|
|
105
115
|
};
|
|
106
116
|
populateTransaction: {
|
|
107
|
-
claim(index: BigNumberish
|
|
108
|
-
from?:
|
|
117
|
+
claim(index: PromiseOrValue<BigNumberish>, account: PromiseOrValue<string>, totalAmount: PromiseOrValue<BigNumberish>, merkleProof: PromiseOrValue<BytesLike>[], overrides?: Overrides & {
|
|
118
|
+
from?: PromiseOrValue<string>;
|
|
109
119
|
}): Promise<PopulatedTransaction>;
|
|
110
|
-
claimed(user: string
|
|
120
|
+
claimed(user: PromiseOrValue<string>, overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
111
121
|
merkleRoot(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
112
122
|
token(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
113
123
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { BaseContract, BigNumber, BigNumberish, BytesLike, Signer, utils } from "ethers";
|
|
2
2
|
import type { EventFragment } from "@ethersproject/abi";
|
|
3
3
|
import type { Listener, Provider } from "@ethersproject/providers";
|
|
4
|
-
import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from "../../../../../common";
|
|
4
|
+
import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent, PromiseOrValue } from "../../../../../common";
|
|
5
5
|
export interface IAirdropDistributorEventsInterface extends utils.Interface {
|
|
6
6
|
functions: {};
|
|
7
7
|
events: {
|
|
8
|
-
"Claimed(address,uint256)": EventFragment;
|
|
8
|
+
"Claimed(address,uint256,bool)": EventFragment;
|
|
9
9
|
"RootUpdated(bytes32,bytes32)": EventFragment;
|
|
10
10
|
"TokenAllocated(address,uint8,uint256)": EventFragment;
|
|
11
11
|
};
|
|
@@ -16,8 +16,13 @@ export interface IAirdropDistributorEventsInterface extends utils.Interface {
|
|
|
16
16
|
export interface ClaimedEventObject {
|
|
17
17
|
account: string;
|
|
18
18
|
amount: BigNumber;
|
|
19
|
+
historic: boolean;
|
|
19
20
|
}
|
|
20
|
-
export declare type ClaimedEvent = TypedEvent<[
|
|
21
|
+
export declare type ClaimedEvent = TypedEvent<[
|
|
22
|
+
string,
|
|
23
|
+
BigNumber,
|
|
24
|
+
boolean
|
|
25
|
+
], ClaimedEventObject>;
|
|
21
26
|
export declare type ClaimedEventFilter = TypedEventFilter<ClaimedEvent>;
|
|
22
27
|
export interface RootUpdatedEventObject {
|
|
23
28
|
oldRoot: string;
|
|
@@ -56,12 +61,12 @@ export interface IAirdropDistributorEvents extends BaseContract {
|
|
|
56
61
|
functions: {};
|
|
57
62
|
callStatic: {};
|
|
58
63
|
filters: {
|
|
59
|
-
"Claimed(address,uint256)"(account?: string | null, amount?:
|
|
60
|
-
Claimed(account?: string | null, amount?:
|
|
61
|
-
"RootUpdated(bytes32,bytes32)"(oldRoot?: null, newRoot?: BytesLike | null): RootUpdatedEventFilter;
|
|
62
|
-
RootUpdated(oldRoot?: null, newRoot?: BytesLike | null): RootUpdatedEventFilter;
|
|
63
|
-
"TokenAllocated(address,uint8,uint256)"(account?: string | null, campaignId?: BigNumberish | null, amount?: null): TokenAllocatedEventFilter;
|
|
64
|
-
TokenAllocated(account?: string | null, campaignId?: BigNumberish | null, amount?: null): TokenAllocatedEventFilter;
|
|
64
|
+
"Claimed(address,uint256,bool)"(account?: PromiseOrValue<string> | null, amount?: null, historic?: PromiseOrValue<boolean> | null): ClaimedEventFilter;
|
|
65
|
+
Claimed(account?: PromiseOrValue<string> | null, amount?: null, historic?: PromiseOrValue<boolean> | null): ClaimedEventFilter;
|
|
66
|
+
"RootUpdated(bytes32,bytes32)"(oldRoot?: null, newRoot?: PromiseOrValue<BytesLike> | null): RootUpdatedEventFilter;
|
|
67
|
+
RootUpdated(oldRoot?: null, newRoot?: PromiseOrValue<BytesLike> | null): RootUpdatedEventFilter;
|
|
68
|
+
"TokenAllocated(address,uint8,uint256)"(account?: PromiseOrValue<string> | null, campaignId?: PromiseOrValue<BigNumberish> | null, amount?: null): TokenAllocatedEventFilter;
|
|
69
|
+
TokenAllocated(account?: PromiseOrValue<string> | null, campaignId?: PromiseOrValue<BigNumberish> | null, amount?: null): TokenAllocatedEventFilter;
|
|
65
70
|
};
|
|
66
71
|
estimateGas: {};
|
|
67
72
|
populateTransaction: {};
|
package/lib/types/common.d.ts
CHANGED
|
@@ -18,4 +18,5 @@ export declare type MinEthersFactory<C, ARGS> = {
|
|
|
18
18
|
};
|
|
19
19
|
export declare type GetContractTypeFromFactory<F> = F extends MinEthersFactory<infer C, any> ? C : never;
|
|
20
20
|
export declare type GetARGsTypeFromFactory<F> = F extends MinEthersFactory<any, any> ? Parameters<F["deploy"]> : never;
|
|
21
|
+
export declare type PromiseOrValue<T> = T | Promise<T>;
|
|
21
22
|
export {};
|
|
@@ -16,11 +16,17 @@ var _abi = [
|
|
|
16
16
|
type: "address",
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
|
-
indexed:
|
|
19
|
+
indexed: false,
|
|
20
20
|
internalType: "uint256",
|
|
21
21
|
name: "amount",
|
|
22
22
|
type: "uint256",
|
|
23
23
|
},
|
|
24
|
+
{
|
|
25
|
+
indexed: true,
|
|
26
|
+
internalType: "bool",
|
|
27
|
+
name: "historic",
|
|
28
|
+
type: "bool",
|
|
29
|
+
},
|
|
24
30
|
],
|
|
25
31
|
name: "Claimed",
|
|
26
32
|
type: "event",
|
|
@@ -16,11 +16,17 @@ var _abi = [
|
|
|
16
16
|
type: "address",
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
|
-
indexed:
|
|
19
|
+
indexed: false,
|
|
20
20
|
internalType: "uint256",
|
|
21
21
|
name: "amount",
|
|
22
22
|
type: "uint256",
|
|
23
23
|
},
|
|
24
|
+
{
|
|
25
|
+
indexed: true,
|
|
26
|
+
internalType: "bool",
|
|
27
|
+
name: "historic",
|
|
28
|
+
type: "bool",
|
|
29
|
+
},
|
|
24
30
|
],
|
|
25
31
|
name: "Claimed",
|
|
26
32
|
type: "event",
|
|
@@ -86,11 +92,6 @@ var _abi = [
|
|
|
86
92
|
name: "totalAmount",
|
|
87
93
|
type: "uint256",
|
|
88
94
|
},
|
|
89
|
-
{
|
|
90
|
-
internalType: "uint256",
|
|
91
|
-
name: "claimedAmount",
|
|
92
|
-
type: "uint256",
|
|
93
|
-
},
|
|
94
95
|
{
|
|
95
96
|
internalType: "bytes32[]",
|
|
96
97
|
name: "merkleProof",
|