@verified-network/verified-sdk 2.4.0 → 2.4.1
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.
|
@@ -11,29 +11,36 @@ export default class Compound extends VerifiedContract {
|
|
|
11
11
|
chainId: number;
|
|
12
12
|
functionName: string;
|
|
13
13
|
}>;
|
|
14
|
-
setSigner(_address: string): any;
|
|
14
|
+
setSigner(_address: string, options?: Options): any;
|
|
15
15
|
/**
|
|
16
16
|
* Submits new RWA to Compound
|
|
17
|
-
* @params (address asset, address bond, uint256 apy, string memory issuingDocs, uint256
|
|
17
|
+
* @params (address asset, address bond, uint256 apy, string memory issuingDocs, uint256 frequency, address factory)
|
|
18
18
|
* @returns
|
|
19
19
|
*/
|
|
20
|
-
submitNewRWA(asset: string, bond: string, apy: string, issuingDocs: string,
|
|
20
|
+
submitNewRWA(asset: string, bond: string, apy: string, issuingDocs: string, frequency: string, factory: string, options?: Options): any;
|
|
21
21
|
/**
|
|
22
22
|
* Posts collateral to Compound
|
|
23
|
-
* @params (address
|
|
23
|
+
* @params (address bond, address issuer, address factory)
|
|
24
24
|
* @returns
|
|
25
25
|
*/
|
|
26
|
-
postCollateral(
|
|
26
|
+
postCollateral(bond: string, issuer: string, factory: string, options?: Options): any;
|
|
27
27
|
/**
|
|
28
28
|
* Borrows from Compound
|
|
29
|
-
* @params (address
|
|
29
|
+
* @params (address asset, uint256 amount)
|
|
30
30
|
* @returns
|
|
31
31
|
*/
|
|
32
|
-
borrowBase(
|
|
32
|
+
borrowBase(asset: string, options?: Options): any;
|
|
33
33
|
/**
|
|
34
34
|
* Repays to Compound
|
|
35
|
-
* @params (address
|
|
35
|
+
* @params (address asset, uint256 amount)
|
|
36
36
|
* @returns
|
|
37
37
|
*/
|
|
38
|
-
repayBase(
|
|
38
|
+
repayBase(asset: string, amount: string, options?: Options): any;
|
|
39
|
+
/**
|
|
40
|
+
* Withdraws collateral
|
|
41
|
+
* @params (address bond, address issuer, address factory)
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
withdrawCollateral(bond: string, issuer: string, factory: string, options?: Options): any;
|
|
45
|
+
repayLenders(asset: string, collateral: string, options?: Options): any;
|
|
39
46
|
}
|
|
@@ -6,10 +6,12 @@ const index_1 = require("../../index");
|
|
|
6
6
|
const VerifiedMarkets_json_1 = require("../../../abi/loans/compound/VerifiedMarkets.json");
|
|
7
7
|
var FUNCTIONS;
|
|
8
8
|
(function (FUNCTIONS) {
|
|
9
|
-
FUNCTIONS["
|
|
9
|
+
FUNCTIONS["SUBMITNEWRWA"] = "submitNewRWA";
|
|
10
10
|
FUNCTIONS["POSTCOLLATERAL"] = "postCollateral";
|
|
11
|
-
FUNCTIONS["
|
|
12
|
-
FUNCTIONS["
|
|
11
|
+
FUNCTIONS["BORROWBASE"] = "borrowBase";
|
|
12
|
+
FUNCTIONS["REPAYBASE"] = "repayBase";
|
|
13
|
+
FUNCTIONS["WITHDRAWCOLLATERAL"] = "withdrawCollateral";
|
|
14
|
+
FUNCTIONS["REPAYLENDERS"] = "repayLenders";
|
|
13
15
|
})(FUNCTIONS || (FUNCTIONS = {}));
|
|
14
16
|
class Compound extends index_1.VerifiedContract {
|
|
15
17
|
constructor(signer, contractNetworkAddress) {
|
|
@@ -20,52 +22,69 @@ class Compound extends index_1.VerifiedContract {
|
|
|
20
22
|
async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
|
|
21
23
|
return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
|
|
22
24
|
}
|
|
23
|
-
setSigner(_address) {
|
|
24
|
-
|
|
25
|
+
setSigner(_address, options) {
|
|
26
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, _address);
|
|
27
|
+
return this.callContract(FUNCTIONS.SETSIGNER, _address, options);
|
|
25
28
|
}
|
|
26
29
|
/**
|
|
27
30
|
* Submits new RWA to Compound
|
|
28
|
-
* @params (address asset, address bond, uint256 apy, string memory issuingDocs, uint256
|
|
31
|
+
* @params (address asset, address bond, uint256 apy, string memory issuingDocs, uint256 frequency, address factory)
|
|
29
32
|
* @returns
|
|
30
33
|
*/
|
|
31
|
-
async submitNewRWA(asset, bond, apy, issuingDocs,
|
|
34
|
+
async submitNewRWA(asset, bond, apy, issuingDocs, frequency, factory, options) {
|
|
32
35
|
await this.validateInput(index_1.DATATYPES.ADDRESS, asset);
|
|
33
36
|
await this.validateInput(index_1.DATATYPES.ADDRESS, bond);
|
|
34
37
|
await this.validateInput(index_1.DATATYPES.NUMBER, apy);
|
|
35
38
|
await this.validateInput(index_1.DATATYPES.STRING, issuingDocs);
|
|
36
39
|
await this.validateInput(index_1.DATATYPES.NUMBER, faceValue);
|
|
37
|
-
|
|
40
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, factory);
|
|
41
|
+
return this.callContract(FUNCTIONS.SUBMITNEWRWA, asset, bond, apy, issuingDocs, frequency, factory, options);
|
|
38
42
|
}
|
|
39
43
|
/**
|
|
40
44
|
* Posts collateral to Compound
|
|
41
|
-
* @params (address
|
|
45
|
+
* @params (address bond, address issuer, address factory)
|
|
42
46
|
* @returns
|
|
43
47
|
*/
|
|
44
|
-
async postCollateral(
|
|
45
|
-
await this.validateInput(index_1.DATATYPES.ADDRESS,
|
|
46
|
-
await this.validateInput(index_1.DATATYPES.ADDRESS,
|
|
47
|
-
await this.validateInput(index_1.DATATYPES.
|
|
48
|
-
return this.callContract(FUNCTIONS.POSTCOLLATERAL,
|
|
48
|
+
async postCollateral(bond, issuer, factory, options) {
|
|
49
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, bond);
|
|
50
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, issuer);
|
|
51
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, factory);
|
|
52
|
+
return this.callContract(FUNCTIONS.POSTCOLLATERAL, bond, issuer, factory, options);
|
|
49
53
|
}
|
|
50
54
|
/**
|
|
51
55
|
* Borrows from Compound
|
|
52
|
-
* @params (address
|
|
56
|
+
* @params (address asset, uint256 amount)
|
|
53
57
|
* @returns
|
|
54
58
|
*/
|
|
55
|
-
async borrowBase(
|
|
56
|
-
await this.validateInput(index_1.DATATYPES.ADDRESS,
|
|
57
|
-
|
|
58
|
-
return this.callContract(FUNCTIONS.BORROW, base, amount, options);
|
|
59
|
+
async borrowBase(asset, options) {
|
|
60
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, asset);
|
|
61
|
+
return this.callContract(FUNCTIONS.BORROWBASE, asset, options);
|
|
59
62
|
}
|
|
60
63
|
/**
|
|
61
64
|
* Repays to Compound
|
|
62
|
-
* @params (address
|
|
65
|
+
* @params (address asset, uint256 amount)
|
|
63
66
|
* @returns
|
|
64
67
|
*/
|
|
65
|
-
async repayBase(
|
|
66
|
-
await this.validateInput(index_1.DATATYPES.ADDRESS,
|
|
68
|
+
async repayBase(asset, amount, options) {
|
|
69
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, asset);
|
|
67
70
|
await this.validateInput(index_1.DATATYPES.NUMBER, amount);
|
|
68
|
-
return this.callContract(FUNCTIONS.
|
|
71
|
+
return this.callContract(FUNCTIONS.REPAYBASE, asset, amount, options);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Withdraws collateral
|
|
75
|
+
* @params (address bond, address issuer, address factory)
|
|
76
|
+
* @returns
|
|
77
|
+
*/
|
|
78
|
+
async withdrawCollateral(bond, issuer, factory, options) {
|
|
79
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, bond);
|
|
80
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, issuer);
|
|
81
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, factory);
|
|
82
|
+
return this.callContract(FUNCTIONS.WITHDRAWCOLLATERAL, bond, issuer, factory, options);
|
|
83
|
+
}
|
|
84
|
+
async repayLenders(asset, collateral, options) {
|
|
85
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, asset);
|
|
86
|
+
await this.validateInput(index_1.DATATYPES.ADDRESS, collateral);
|
|
87
|
+
return this.callContract(FUNCTIONS.REPAYLENDERS, asset, collateral, options);
|
|
69
88
|
}
|
|
70
89
|
}
|
|
71
90
|
exports.default = Compound;
|