@gearbox-protocol/sdk 0.0.39 → 0.0.40
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/contracts.d.ts +1 -0
- package/lib/core/contracts.js +2 -1
- package/lib/core/pathfinder.js +1 -1
- package/lib/devops/loggedDeployer.d.ts +7 -0
- package/lib/devops/loggedDeployer.js +22 -0
- package/lib/devops/verifierDeployer.d.ts +13 -0
- package/lib/devops/verifierDeployer.js +160 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/package.json +6 -2
- package/src/core/contracts.ts +3 -0
- package/src/core/pathfinder.ts +1 -1
- package/src/devops/loggedDeployer.ts +22 -0
- package/src/devops/verifierDeployer.ts +74 -0
- package/src/index.ts +1 -0
package/lib/core/contracts.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export declare const SUSHISWAP_MAINNET = "0xd9e1cE17f2641f24aE83637ab66a2cca9C37
|
|
|
26
26
|
export declare const SUSHISWAP_KOVAN = "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506";
|
|
27
27
|
export declare const CONVEX_BOOSTER_KOVAN_ADDRESS = "0x78A9261965F048b9FF055699569be4400EEC7005";
|
|
28
28
|
export declare const CONVEX_3CRV_KOVAN_POOL_ADDRESS = "0x90D9E8ecc406cd7363C08fAdb4ac0f3994b4cA71";
|
|
29
|
+
export declare const CONVEX_STECRV_POOL_ADDRESS = "0x0A760466E1B4621579a82a39CB56Dda2F4E70f03";
|
|
29
30
|
export declare const CONVEX_STECRV_KOVAN_POOL_ADDRESS = "0x0f64e188BFF97e09C71FF85f30509f5596D420dD";
|
|
30
31
|
export declare const CONVEX_BOOSTER_ADDRESS = "0xF403C135812408BFbE8713b5A23a04b3D48AAE31";
|
|
31
32
|
export declare const CONVEX_3POOL_REWARD_POOL_ADDRESS = "0x689440f2Ff927E1f24c72F1087E1FAF471eCe1c8";
|
package/lib/core/contracts.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
var _a;
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.knownContracts = exports.AdapterInterface = exports.LIDO_STETH_ADDRESS = exports.CONVEX_CLAIM_ZAP_ADDRESS = exports.CONVEX_FRAX3CRV_REWARD_POOL_ADDRESS = exports.CONVEX_3POOL_REWARD_POOL_ADDRESS = exports.CONVEX_BOOSTER_ADDRESS = exports.CONVEX_STECRV_KOVAN_POOL_ADDRESS = exports.CONVEX_3CRV_KOVAN_POOL_ADDRESS = exports.CONVEX_BOOSTER_KOVAN_ADDRESS = exports.SUSHISWAP_KOVAN = exports.SUSHISWAP_MAINNET = exports.YEARN_3POOL_KOVAN_MOCK = exports.YEARN_WBTC_KOVAN_MOCK = exports.YEARN_WETH_KOVAN_MOCK = exports.YEARN_USDC_KOVAN_MOCK = exports.YEARN_DAI_KOVAN_MOCK = exports.YEARN_CURVE_STETH_ADDRESS = exports.YEARN_CURVE_FRAX_ADDRESS = exports.YEARN_WBTC_ADDRESS = exports.YEARN_WETH_ADDRESS = exports.YEARN_USDC_ADDRESS = exports.YEARN_DAI_ADDRESS = exports.CURVE_SUSD_KOVAN_MOCK = exports.CURVE_STE_CRV_KOVAN_MOCK = exports.CURVE_3POOL_KOVAN_MOCK = exports.CURVE_GUSD_ADDRESS = exports.CURVE_SUSD_ADDRESS = exports.CURVE_LUSD_ADDRESS = exports.CURVE_FRAX_ADDRESS = exports.CURVE_STETH_GATEWAY_ADDRESS = exports.CURVE_STETH_ADDRESS = exports.CURVE_3POOL_ADDRESS = exports.UNISWAP_V3_QUOTER = exports.UNISWAP_V3_ROUTER = exports.UNISWAP_V2_ROUTER = void 0;
|
|
9
|
+
exports.knownContracts = exports.AdapterInterface = exports.LIDO_STETH_ADDRESS = exports.CONVEX_CLAIM_ZAP_ADDRESS = exports.CONVEX_FRAX3CRV_REWARD_POOL_ADDRESS = exports.CONVEX_3POOL_REWARD_POOL_ADDRESS = exports.CONVEX_BOOSTER_ADDRESS = exports.CONVEX_STECRV_KOVAN_POOL_ADDRESS = exports.CONVEX_STECRV_POOL_ADDRESS = exports.CONVEX_3CRV_KOVAN_POOL_ADDRESS = exports.CONVEX_BOOSTER_KOVAN_ADDRESS = exports.SUSHISWAP_KOVAN = exports.SUSHISWAP_MAINNET = exports.YEARN_3POOL_KOVAN_MOCK = exports.YEARN_WBTC_KOVAN_MOCK = exports.YEARN_WETH_KOVAN_MOCK = exports.YEARN_USDC_KOVAN_MOCK = exports.YEARN_DAI_KOVAN_MOCK = exports.YEARN_CURVE_STETH_ADDRESS = exports.YEARN_CURVE_FRAX_ADDRESS = exports.YEARN_WBTC_ADDRESS = exports.YEARN_WETH_ADDRESS = exports.YEARN_USDC_ADDRESS = exports.YEARN_DAI_ADDRESS = exports.CURVE_SUSD_KOVAN_MOCK = exports.CURVE_STE_CRV_KOVAN_MOCK = exports.CURVE_3POOL_KOVAN_MOCK = exports.CURVE_GUSD_ADDRESS = exports.CURVE_SUSD_ADDRESS = exports.CURVE_LUSD_ADDRESS = exports.CURVE_FRAX_ADDRESS = exports.CURVE_STETH_GATEWAY_ADDRESS = exports.CURVE_STETH_ADDRESS = exports.CURVE_3POOL_ADDRESS = exports.UNISWAP_V3_QUOTER = exports.UNISWAP_V3_ROUTER = exports.UNISWAP_V2_ROUTER = void 0;
|
|
10
10
|
var token_1 = require("./token");
|
|
11
11
|
exports.UNISWAP_V2_ROUTER = "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D";
|
|
12
12
|
exports.UNISWAP_V3_ROUTER = "0xE592427A0AEce92De3Edee1F18E0157C05861564";
|
|
@@ -37,6 +37,7 @@ exports.SUSHISWAP_MAINNET = "0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F";
|
|
|
37
37
|
exports.SUSHISWAP_KOVAN = "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506";
|
|
38
38
|
exports.CONVEX_BOOSTER_KOVAN_ADDRESS = "0x78A9261965F048b9FF055699569be4400EEC7005";
|
|
39
39
|
exports.CONVEX_3CRV_KOVAN_POOL_ADDRESS = "0x90D9E8ecc406cd7363C08fAdb4ac0f3994b4cA71";
|
|
40
|
+
exports.CONVEX_STECRV_POOL_ADDRESS = "0x0A760466E1B4621579a82a39CB56Dda2F4E70f03";
|
|
40
41
|
exports.CONVEX_STECRV_KOVAN_POOL_ADDRESS = "0x0f64e188BFF97e09C71FF85f30509f5596D420dD";
|
|
41
42
|
exports.CONVEX_BOOSTER_ADDRESS = "0xF403C135812408BFbE8713b5A23a04b3D48AAE31";
|
|
42
43
|
exports.CONVEX_3POOL_REWARD_POOL_ADDRESS = "0x689440f2Ff927E1f24c72F1087E1FAF471eCe1c8";
|
package/lib/core/pathfinder.js
CHANGED
|
@@ -64,7 +64,7 @@ var Path = /** @class */ (function () {
|
|
|
64
64
|
// Get token type of this token
|
|
65
65
|
// switch (type) {
|
|
66
66
|
// case TokenType.YearnValut:
|
|
67
|
-
// const assetPathClass = new
|
|
67
|
+
// const assetPathClass = new YearnPathAsset();
|
|
68
68
|
// return assetPathClass.getBestPath(this);
|
|
69
69
|
// ...
|
|
70
70
|
//}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LoggedDeployer = void 0;
|
|
4
|
+
var tslog_1 = require("tslog");
|
|
5
|
+
var LoggedDeployer = /** @class */ (function () {
|
|
6
|
+
function LoggedDeployer() {
|
|
7
|
+
this._logger = new tslog_1.Logger({
|
|
8
|
+
minLevel: "error",
|
|
9
|
+
displayFunctionName: false,
|
|
10
|
+
displayLoggerName: false,
|
|
11
|
+
displayFilePath: "hidden",
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
LoggedDeployer.prototype.enableLogs = function () {
|
|
15
|
+
this._logger.setSettings({ minLevel: "debug" });
|
|
16
|
+
};
|
|
17
|
+
LoggedDeployer.prototype.disableLogs = function () {
|
|
18
|
+
this._logger.setSettings({ minLevel: "error" });
|
|
19
|
+
};
|
|
20
|
+
return LoggedDeployer;
|
|
21
|
+
}());
|
|
22
|
+
exports.LoggedDeployer = LoggedDeployer;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LoggedDeployer } from "./loggedDeployer";
|
|
2
|
+
export interface VerifyRequest {
|
|
3
|
+
address: string;
|
|
4
|
+
constructorArguments: Array<any>;
|
|
5
|
+
}
|
|
6
|
+
export declare class Verifier extends LoggedDeployer {
|
|
7
|
+
protected verifier: Array<VerifyRequest>;
|
|
8
|
+
protected apiKey: string;
|
|
9
|
+
constructor();
|
|
10
|
+
addContract(c: VerifyRequest): void;
|
|
11
|
+
deploy(): Promise<void>;
|
|
12
|
+
protected _saveVerifier(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
24
|
+
}) : (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
o[k2] = m[k];
|
|
27
|
+
}));
|
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
+
}) : function(o, v) {
|
|
31
|
+
o["default"] = v;
|
|
32
|
+
});
|
|
33
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
41
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
42
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
43
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
44
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
45
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
46
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
50
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
51
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
52
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
53
|
+
function step(op) {
|
|
54
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
55
|
+
while (_) try {
|
|
56
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
57
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
58
|
+
switch (op[0]) {
|
|
59
|
+
case 0: case 1: t = op; break;
|
|
60
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
61
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
62
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
63
|
+
default:
|
|
64
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
65
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
66
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
67
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
68
|
+
if (t[2]) _.ops.pop();
|
|
69
|
+
_.trys.pop(); continue;
|
|
70
|
+
}
|
|
71
|
+
op = body.call(thisArg, _);
|
|
72
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
73
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
77
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
78
|
+
};
|
|
79
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
80
|
+
exports.Verifier = void 0;
|
|
81
|
+
/*
|
|
82
|
+
* Copyright (c) 2021. Gearbox
|
|
83
|
+
*/
|
|
84
|
+
// import verifierJson from "../.verifier.json";
|
|
85
|
+
var loggedDeployer_1 = require("./loggedDeployer");
|
|
86
|
+
var fs = __importStar(require("fs"));
|
|
87
|
+
var dotenv_1 = require("dotenv");
|
|
88
|
+
var axios_1 = __importDefault(require("axios"));
|
|
89
|
+
var hre = require("hardhat");
|
|
90
|
+
(0, dotenv_1.config)({ path: ".env" });
|
|
91
|
+
var Verifier = /** @class */ (function (_super) {
|
|
92
|
+
__extends(Verifier, _super);
|
|
93
|
+
function Verifier() {
|
|
94
|
+
var _this = _super.call(this) || this;
|
|
95
|
+
_this.verifier = [];
|
|
96
|
+
// this.verifier = verifierJson;
|
|
97
|
+
// JSON.parse("")
|
|
98
|
+
_this.apiKey = process.env.ETHERSCAN_API_KEY || "";
|
|
99
|
+
if (_this.apiKey === "")
|
|
100
|
+
throw new Error("No etherscan API provided");
|
|
101
|
+
return _this;
|
|
102
|
+
}
|
|
103
|
+
Verifier.prototype.addContract = function (c) {
|
|
104
|
+
this.verifier.push(c);
|
|
105
|
+
this._saveVerifier();
|
|
106
|
+
};
|
|
107
|
+
Verifier.prototype.deploy = function () {
|
|
108
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
109
|
+
var i, params, url, isVerified;
|
|
110
|
+
return __generator(this, function (_a) {
|
|
111
|
+
switch (_a.label) {
|
|
112
|
+
case 0:
|
|
113
|
+
this.enableLogs();
|
|
114
|
+
i = 0;
|
|
115
|
+
_a.label = 1;
|
|
116
|
+
case 1:
|
|
117
|
+
if (!(i < this.verifier.length)) return [3 /*break*/, 7];
|
|
118
|
+
params = this.verifier.shift();
|
|
119
|
+
url = "https://api-kovan.etherscan.io/api?module=contract&action=getabi&address=".concat(params === null || params === void 0 ? void 0 : params.address, "&apikey=").concat(this.apiKey);
|
|
120
|
+
return [4 /*yield*/, axios_1.default.get(url)];
|
|
121
|
+
case 2:
|
|
122
|
+
isVerified = _a.sent();
|
|
123
|
+
console.log(isVerified.data);
|
|
124
|
+
if (!(isVerified.data.status === '1')) return [3 /*break*/, 3];
|
|
125
|
+
this._logger.debug("".concat(params === null || params === void 0 ? void 0 : params.address, " is already verified"));
|
|
126
|
+
return [3 /*break*/, 5];
|
|
127
|
+
case 3:
|
|
128
|
+
this._logger.info("Verifing: ".concat(params === null || params === void 0 ? void 0 : params.address));
|
|
129
|
+
return [4 /*yield*/, hre.run("verify:verify", params)];
|
|
130
|
+
case 4:
|
|
131
|
+
_a.sent();
|
|
132
|
+
_a.label = 5;
|
|
133
|
+
case 5:
|
|
134
|
+
this._saveVerifier();
|
|
135
|
+
_a.label = 6;
|
|
136
|
+
case 6:
|
|
137
|
+
i++;
|
|
138
|
+
return [3 /*break*/, 1];
|
|
139
|
+
case 7: return [2 /*return*/];
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
Verifier.prototype._saveVerifier = function () {
|
|
145
|
+
fs.writeFileSync("./.verifier.json", JSON.stringify(this.verifier));
|
|
146
|
+
this._logger.debug("Deploy progress was saved into .verifier.json");
|
|
147
|
+
};
|
|
148
|
+
return Verifier;
|
|
149
|
+
}(loggedDeployer_1.LoggedDeployer));
|
|
150
|
+
exports.Verifier = Verifier;
|
|
151
|
+
var verifier = new Verifier();
|
|
152
|
+
verifier
|
|
153
|
+
.deploy()
|
|
154
|
+
.then(function () {
|
|
155
|
+
process.exit(0);
|
|
156
|
+
})
|
|
157
|
+
.catch(function (error) {
|
|
158
|
+
console.error(error);
|
|
159
|
+
process.exit(1);
|
|
160
|
+
});
|
package/lib/index.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export * from "./utils/math";
|
|
|
28
28
|
export * from "./core/creditCard";
|
|
29
29
|
export * from "./payload/graphPayload";
|
|
30
30
|
export * from "./types/index";
|
|
31
|
+
export * from "./devops/verifierDeployer";
|
|
31
32
|
export type { IAppPoolService, IAppCreditManager, IAppERC20, IAppAddressProvider, IDataCompressor, IWETHGateway } from "./types";
|
|
32
33
|
export * from "./core/history";
|
|
33
34
|
export { MultiCallContract } from "./utils/multicall";
|
package/lib/index.js
CHANGED
|
@@ -45,6 +45,7 @@ __exportStar(require("./utils/math"), exports);
|
|
|
45
45
|
__exportStar(require("./core/creditCard"), exports);
|
|
46
46
|
__exportStar(require("./payload/graphPayload"), exports);
|
|
47
47
|
__exportStar(require("./types/index"), exports);
|
|
48
|
+
__exportStar(require("./devops/verifierDeployer"), exports);
|
|
48
49
|
__exportStar(require("./core/history"), exports);
|
|
49
50
|
var multicall_1 = require("./utils/multicall");
|
|
50
51
|
Object.defineProperty(exports, "MultiCallContract", { enumerable: true, get: function () { return multicall_1.MultiCallContract; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.40",
|
|
4
4
|
"description": "Gearbox SDK",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -16,12 +16,16 @@
|
|
|
16
16
|
"moment": "^2.29.1"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
+
"@types/axios": "^0.14.0",
|
|
19
20
|
"@types/jest": "^26.0.4",
|
|
20
21
|
"@types/node": "^14.0.23",
|
|
21
|
-
"
|
|
22
|
+
"axios": "^0.27.2",
|
|
23
|
+
"dotenv": "^16.0.1",
|
|
24
|
+
"ethers": "^5.6.5",
|
|
22
25
|
"jest": "^26.1.0",
|
|
23
26
|
"prettier": "^2.3.0",
|
|
24
27
|
"ts-node": "^10.1.0",
|
|
28
|
+
"tslog": "^3.3.3",
|
|
25
29
|
"typescript": "^4.2.4"
|
|
26
30
|
}
|
|
27
31
|
}
|
package/src/core/contracts.ts
CHANGED
|
@@ -52,6 +52,9 @@ export const CONVEX_BOOSTER_KOVAN_ADDRESS =
|
|
|
52
52
|
export const CONVEX_3CRV_KOVAN_POOL_ADDRESS =
|
|
53
53
|
"0x90D9E8ecc406cd7363C08fAdb4ac0f3994b4cA71";
|
|
54
54
|
|
|
55
|
+
export const CONVEX_STECRV_POOL_ADDRESS =
|
|
56
|
+
"0x0A760466E1B4621579a82a39CB56Dda2F4E70f03";
|
|
57
|
+
|
|
55
58
|
export const CONVEX_STECRV_KOVAN_POOL_ADDRESS =
|
|
56
59
|
"0x0f64e188BFF97e09C71FF85f30509f5596D420dD";
|
|
57
60
|
|
package/src/core/pathfinder.ts
CHANGED
|
@@ -44,7 +44,7 @@ export class Path {
|
|
|
44
44
|
// Get token type of this token
|
|
45
45
|
// switch (type) {
|
|
46
46
|
// case TokenType.YearnValut:
|
|
47
|
-
// const assetPathClass = new
|
|
47
|
+
// const assetPathClass = new YearnPathAsset();
|
|
48
48
|
// return assetPathClass.getBestPath(this);
|
|
49
49
|
// ...
|
|
50
50
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Logger } from "tslog";
|
|
2
|
+
|
|
3
|
+
export abstract class LoggedDeployer {
|
|
4
|
+
protected readonly _logger: Logger;
|
|
5
|
+
|
|
6
|
+
protected constructor() {
|
|
7
|
+
this._logger = new Logger({
|
|
8
|
+
minLevel: "error",
|
|
9
|
+
displayFunctionName: false,
|
|
10
|
+
displayLoggerName: false,
|
|
11
|
+
displayFilePath: "hidden",
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
enableLogs() {
|
|
16
|
+
this._logger.setSettings({ minLevel: "debug" });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
disableLogs() {
|
|
20
|
+
this._logger.setSettings({ minLevel: "error" });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2021. Gearbox
|
|
3
|
+
*/
|
|
4
|
+
// import verifierJson from "../.verifier.json";
|
|
5
|
+
import { LoggedDeployer } from "./loggedDeployer";
|
|
6
|
+
import * as fs from "fs";
|
|
7
|
+
import { config as dotEnvConfig } from "dotenv";
|
|
8
|
+
import axios from "axios";
|
|
9
|
+
const hre = require("hardhat");
|
|
10
|
+
|
|
11
|
+
dotEnvConfig({ path: ".env" });
|
|
12
|
+
|
|
13
|
+
export interface VerifyRequest {
|
|
14
|
+
address: string;
|
|
15
|
+
constructorArguments: Array<any>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export class Verifier extends LoggedDeployer {
|
|
19
|
+
protected verifier: Array<VerifyRequest> = [];
|
|
20
|
+
protected apiKey: string;
|
|
21
|
+
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
// this.verifier = verifierJson;
|
|
25
|
+
// JSON.parse("")
|
|
26
|
+
this.apiKey = process.env.ETHERSCAN_API_KEY || "";
|
|
27
|
+
if (this.apiKey === "") throw new Error("No etherscan API provided");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
addContract(c: VerifyRequest) {
|
|
31
|
+
this.verifier.push(c);
|
|
32
|
+
this._saveVerifier();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async deploy() {
|
|
36
|
+
this.enableLogs();
|
|
37
|
+
|
|
38
|
+
for (let i = 0; i < this.verifier.length; i++) {
|
|
39
|
+
const params = this.verifier.shift();
|
|
40
|
+
|
|
41
|
+
const url = `https://api-kovan.etherscan.io/api?module=contract&action=getabi&address=${params?.address}&apikey=${this.apiKey}`;
|
|
42
|
+
|
|
43
|
+
const isVerified = await axios.get(url);
|
|
44
|
+
|
|
45
|
+
console.log(isVerified.data)
|
|
46
|
+
|
|
47
|
+
if (isVerified.data.status === '1') {
|
|
48
|
+
this._logger.debug(`${params?.address} is already verified`);
|
|
49
|
+
} else {
|
|
50
|
+
this._logger.info(`Verifing: ${params?.address}`);
|
|
51
|
+
await hre.run("verify:verify", params);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
this._saveVerifier();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
protected _saveVerifier() {
|
|
59
|
+
fs.writeFileSync("./.verifier.json", JSON.stringify(this.verifier));
|
|
60
|
+
this._logger.debug("Deploy progress was saved into .verifier.json");
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const verifier = new Verifier();
|
|
65
|
+
|
|
66
|
+
verifier
|
|
67
|
+
.deploy()
|
|
68
|
+
.then(() => {
|
|
69
|
+
process.exit(0);
|
|
70
|
+
})
|
|
71
|
+
.catch((error) => {
|
|
72
|
+
console.error(error);
|
|
73
|
+
process.exit(1);
|
|
74
|
+
});
|