@lavarage/sdk 6.7.1 → 6.7.2
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/abi/borrowerOperations.ts +248 -1
- package/abi/tokenHolderAbi.ts +659 -1
- package/dist/index.d.mts +43 -1
- package/dist/index.d.ts +43 -1
- package/dist/index.js +967 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +962 -2
- package/dist/index.mjs.map +1 -1
- package/evm.ts +100 -0
- package/interfaces/evm.ts +2 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2704,10 +2704,915 @@ import {
|
|
|
2704
2704
|
} from "ethers";
|
|
2705
2705
|
|
|
2706
2706
|
// abi/borrowerOperations.ts
|
|
2707
|
-
var borrowerOperationsAbi = [
|
|
2707
|
+
var borrowerOperationsAbi = [
|
|
2708
|
+
{ inputs: [], name: "InvalidInitialization", type: "error" },
|
|
2709
|
+
{ inputs: [], name: "NotInitializing", type: "error" },
|
|
2710
|
+
{ inputs: [], name: "ReentrancyGuardReentrantCall", type: "error" },
|
|
2711
|
+
{
|
|
2712
|
+
anonymous: false,
|
|
2713
|
+
inputs: [
|
|
2714
|
+
{
|
|
2715
|
+
indexed: true,
|
|
2716
|
+
internalType: "address",
|
|
2717
|
+
name: "buyer",
|
|
2718
|
+
type: "address"
|
|
2719
|
+
},
|
|
2720
|
+
{
|
|
2721
|
+
indexed: true,
|
|
2722
|
+
internalType: "address",
|
|
2723
|
+
name: "tokenCollateral",
|
|
2724
|
+
type: "address"
|
|
2725
|
+
},
|
|
2726
|
+
{
|
|
2727
|
+
indexed: true,
|
|
2728
|
+
internalType: "uint256",
|
|
2729
|
+
name: "loanId",
|
|
2730
|
+
type: "uint256"
|
|
2731
|
+
},
|
|
2732
|
+
{
|
|
2733
|
+
indexed: false,
|
|
2734
|
+
internalType: "uint256",
|
|
2735
|
+
name: "openingPositionSize",
|
|
2736
|
+
type: "uint256"
|
|
2737
|
+
},
|
|
2738
|
+
{
|
|
2739
|
+
indexed: false,
|
|
2740
|
+
internalType: "uint256",
|
|
2741
|
+
name: "collateralAmount",
|
|
2742
|
+
type: "uint256"
|
|
2743
|
+
},
|
|
2744
|
+
{
|
|
2745
|
+
indexed: false,
|
|
2746
|
+
internalType: "uint256",
|
|
2747
|
+
name: "initialMargin",
|
|
2748
|
+
type: "uint256"
|
|
2749
|
+
}
|
|
2750
|
+
],
|
|
2751
|
+
name: "Buy",
|
|
2752
|
+
type: "event"
|
|
2753
|
+
},
|
|
2754
|
+
{
|
|
2755
|
+
anonymous: false,
|
|
2756
|
+
inputs: [
|
|
2757
|
+
{
|
|
2758
|
+
indexed: false,
|
|
2759
|
+
internalType: "uint64",
|
|
2760
|
+
name: "version",
|
|
2761
|
+
type: "uint64"
|
|
2762
|
+
}
|
|
2763
|
+
],
|
|
2764
|
+
name: "Initialized",
|
|
2765
|
+
type: "event"
|
|
2766
|
+
},
|
|
2767
|
+
{
|
|
2768
|
+
anonymous: false,
|
|
2769
|
+
inputs: [
|
|
2770
|
+
{
|
|
2771
|
+
indexed: true,
|
|
2772
|
+
internalType: "address",
|
|
2773
|
+
name: "borrower",
|
|
2774
|
+
type: "address"
|
|
2775
|
+
},
|
|
2776
|
+
{
|
|
2777
|
+
indexed: true,
|
|
2778
|
+
internalType: "address",
|
|
2779
|
+
name: "tokenCollateral",
|
|
2780
|
+
type: "address"
|
|
2781
|
+
},
|
|
2782
|
+
{
|
|
2783
|
+
indexed: true,
|
|
2784
|
+
internalType: "uint256",
|
|
2785
|
+
name: "loanId",
|
|
2786
|
+
type: "uint256"
|
|
2787
|
+
},
|
|
2788
|
+
{
|
|
2789
|
+
indexed: false,
|
|
2790
|
+
internalType: "uint256",
|
|
2791
|
+
name: "closingPositionSize",
|
|
2792
|
+
type: "uint256"
|
|
2793
|
+
},
|
|
2794
|
+
{
|
|
2795
|
+
indexed: false,
|
|
2796
|
+
internalType: "uint256",
|
|
2797
|
+
name: "liquidatorRepaidAmount",
|
|
2798
|
+
type: "uint256"
|
|
2799
|
+
}
|
|
2800
|
+
],
|
|
2801
|
+
name: "Liquidation",
|
|
2802
|
+
type: "event"
|
|
2803
|
+
},
|
|
2804
|
+
{
|
|
2805
|
+
anonymous: false,
|
|
2806
|
+
inputs: [
|
|
2807
|
+
{
|
|
2808
|
+
indexed: true,
|
|
2809
|
+
internalType: "address",
|
|
2810
|
+
name: "buyer",
|
|
2811
|
+
type: "address"
|
|
2812
|
+
},
|
|
2813
|
+
{
|
|
2814
|
+
indexed: true,
|
|
2815
|
+
internalType: "address",
|
|
2816
|
+
name: "tokenCollateral",
|
|
2817
|
+
type: "address"
|
|
2818
|
+
},
|
|
2819
|
+
{
|
|
2820
|
+
indexed: true,
|
|
2821
|
+
internalType: "uint256",
|
|
2822
|
+
name: "loanId",
|
|
2823
|
+
type: "uint256"
|
|
2824
|
+
},
|
|
2825
|
+
{
|
|
2826
|
+
indexed: false,
|
|
2827
|
+
internalType: "uint256",
|
|
2828
|
+
name: "closingPositionSize",
|
|
2829
|
+
type: "uint256"
|
|
2830
|
+
},
|
|
2831
|
+
{
|
|
2832
|
+
indexed: false,
|
|
2833
|
+
internalType: "uint256",
|
|
2834
|
+
name: "profit",
|
|
2835
|
+
type: "uint256"
|
|
2836
|
+
}
|
|
2837
|
+
],
|
|
2838
|
+
name: "Sell",
|
|
2839
|
+
type: "event"
|
|
2840
|
+
},
|
|
2841
|
+
{
|
|
2842
|
+
inputs: [],
|
|
2843
|
+
name: "admin",
|
|
2844
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
2845
|
+
stateMutability: "view",
|
|
2846
|
+
type: "function"
|
|
2847
|
+
},
|
|
2848
|
+
{
|
|
2849
|
+
inputs: [
|
|
2850
|
+
{ internalType: "bytes", name: "buyingCode", type: "bytes" },
|
|
2851
|
+
{
|
|
2852
|
+
internalType: "contract IERC20",
|
|
2853
|
+
name: "tokenCollateral",
|
|
2854
|
+
type: "address"
|
|
2855
|
+
},
|
|
2856
|
+
{ internalType: "uint256", name: "borrowAmount", type: "uint256" },
|
|
2857
|
+
{
|
|
2858
|
+
internalType: "contract TokenHolder",
|
|
2859
|
+
name: "tokenHolder",
|
|
2860
|
+
type: "address"
|
|
2861
|
+
},
|
|
2862
|
+
{ internalType: "address", name: "inchRouter", type: "address" },
|
|
2863
|
+
{
|
|
2864
|
+
internalType: "address",
|
|
2865
|
+
name: "integratorFeeAddress",
|
|
2866
|
+
type: "address"
|
|
2867
|
+
}
|
|
2868
|
+
],
|
|
2869
|
+
name: "buy",
|
|
2870
|
+
outputs: [],
|
|
2871
|
+
stateMutability: "payable",
|
|
2872
|
+
type: "function"
|
|
2873
|
+
},
|
|
2874
|
+
{
|
|
2875
|
+
inputs: [
|
|
2876
|
+
{ internalType: "contract IERC20", name: "_weth", type: "address" }
|
|
2877
|
+
],
|
|
2878
|
+
name: "initialize",
|
|
2879
|
+
outputs: [],
|
|
2880
|
+
stateMutability: "nonpayable",
|
|
2881
|
+
type: "function"
|
|
2882
|
+
},
|
|
2883
|
+
{
|
|
2884
|
+
inputs: [
|
|
2885
|
+
{ internalType: "uint256", name: "loanId", type: "uint256" },
|
|
2886
|
+
{
|
|
2887
|
+
internalType: "contract TokenHolder",
|
|
2888
|
+
name: "tokenHolder",
|
|
2889
|
+
type: "address"
|
|
2890
|
+
},
|
|
2891
|
+
{ internalType: "uint256", name: "closingPositionSize", type: "uint256" }
|
|
2892
|
+
],
|
|
2893
|
+
name: "liquidate",
|
|
2894
|
+
outputs: [],
|
|
2895
|
+
stateMutability: "nonpayable",
|
|
2896
|
+
type: "function"
|
|
2897
|
+
},
|
|
2898
|
+
{
|
|
2899
|
+
inputs: [],
|
|
2900
|
+
name: "openingFee",
|
|
2901
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
2902
|
+
stateMutability: "view",
|
|
2903
|
+
type: "function"
|
|
2904
|
+
},
|
|
2905
|
+
{
|
|
2906
|
+
inputs: [],
|
|
2907
|
+
name: "profitFee",
|
|
2908
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
2909
|
+
stateMutability: "view",
|
|
2910
|
+
type: "function"
|
|
2911
|
+
},
|
|
2912
|
+
{
|
|
2913
|
+
inputs: [
|
|
2914
|
+
{ internalType: "uint256", name: "loanId", type: "uint256" },
|
|
2915
|
+
{ internalType: "bytes", name: "sellingCode", type: "bytes" },
|
|
2916
|
+
{
|
|
2917
|
+
internalType: "contract TokenHolder",
|
|
2918
|
+
name: "tokenHolder",
|
|
2919
|
+
type: "address"
|
|
2920
|
+
},
|
|
2921
|
+
{ internalType: "address", name: "inchRouter", type: "address" },
|
|
2922
|
+
{
|
|
2923
|
+
internalType: "address",
|
|
2924
|
+
name: "integratorFeeAddress",
|
|
2925
|
+
type: "address"
|
|
2926
|
+
}
|
|
2927
|
+
],
|
|
2928
|
+
name: "sell",
|
|
2929
|
+
outputs: [],
|
|
2930
|
+
stateMutability: "payable",
|
|
2931
|
+
type: "function"
|
|
2932
|
+
},
|
|
2933
|
+
{
|
|
2934
|
+
inputs: [{ internalType: "address", name: "_admin", type: "address" }],
|
|
2935
|
+
name: "setAdmin",
|
|
2936
|
+
outputs: [],
|
|
2937
|
+
stateMutability: "nonpayable",
|
|
2938
|
+
type: "function"
|
|
2939
|
+
},
|
|
2940
|
+
{
|
|
2941
|
+
inputs: [{ internalType: "uint256", name: "_openingFee", type: "uint256" }],
|
|
2942
|
+
name: "setOpeningFee",
|
|
2943
|
+
outputs: [],
|
|
2944
|
+
stateMutability: "nonpayable",
|
|
2945
|
+
type: "function"
|
|
2946
|
+
},
|
|
2947
|
+
{
|
|
2948
|
+
inputs: [{ internalType: "uint256", name: "_profitFee", type: "uint256" }],
|
|
2949
|
+
name: "setProfitFee",
|
|
2950
|
+
outputs: [],
|
|
2951
|
+
stateMutability: "nonpayable",
|
|
2952
|
+
type: "function"
|
|
2953
|
+
}
|
|
2954
|
+
];
|
|
2708
2955
|
|
|
2709
2956
|
// abi/tokenHolderAbi.ts
|
|
2710
|
-
var tokenHolderAbi = [{ "type": "function", "name": "BORROWER_ROUTER_ROLE", "inputs": [], "outputs": [{ "name": "", "type": "bytes32", "internalType": "bytes32" }], "stateMutability": "view" }, { "type": "function", "name": "DEFAULT_ADMIN_ROLE", "inputs": [], "outputs": [{ "name": "", "type": "bytes32", "internalType": "bytes32" }], "stateMutability": "view" }, { "type": "function", "name": "activeLoanIds", "inputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "addCollateral", "inputs": [{ "name": "collateralAddress", "type": "address", "internalType": "address" }, { "name": "_interestRate", "type": "uint256", "internalType": "uint256" }, { "name": "maxLendPerToken", "type": "uint256", "internalType": "uint256" }, { "name": "minAmount", "type": "uint256", "internalType": "uint256" }, { "name": "maxExposure", "type": "uint256", "internalType": "uint256" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "collateralMapping", "inputs": [{ "name": "", "type": "address", "internalType": "address" }], "outputs": [{ "name": "collateralAddress", "type": "address", "internalType": "address" }, { "name": "maxLendPerToken", "type": "uint256", "internalType": "uint256" }, { "name": "interestRate", "type": "uint256", "internalType": "uint256" }, { "name": "active", "type": "bool", "internalType": "bool" }, { "name": "minAmount", "type": "uint256", "internalType": "uint256" }, { "name": "maxExposure", "type": "uint256", "internalType": "uint256" }, { "name": "currentExposure", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "deposit", "inputs": [{ "name": "amount", "type": "uint256", "internalType": "uint256" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "getActiveLoanCount", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "getActiveLoansBatch", "inputs": [{ "name": "startIndex", "type": "uint256", "internalType": "uint256" }, { "name": "batchSize", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "", "type": "tuple[]", "internalType": "struct Loan[]", "components": [{ "name": "id", "type": "uint256", "internalType": "uint256" }, { "name": "amount", "type": "uint256", "internalType": "uint256" }, { "name": "collateral", "type": "tuple", "internalType": "struct Collateral", "components": [{ "name": "collateralAddress", "type": "address", "internalType": "address" }, { "name": "maxLendPerToken", "type": "uint256", "internalType": "uint256" }, { "name": "interestRate", "type": "uint256", "internalType": "uint256" }, { "name": "active", "type": "bool", "internalType": "bool" }, { "name": "minAmount", "type": "uint256", "internalType": "uint256" }, { "name": "maxExposure", "type": "uint256", "internalType": "uint256" }, { "name": "currentExposure", "type": "uint256", "internalType": "uint256" }] }, { "name": "collateralAmount", "type": "uint256", "internalType": "uint256" }, { "name": "timestamp", "type": "uint256", "internalType": "uint256" }, { "name": "borrower", "type": "address", "internalType": "address" }, { "name": "userPaid", "type": "uint256", "internalType": "uint256" }] }], "stateMutability": "view" }, { "type": "function", "name": "getAvailableExposure", "inputs": [{ "name": "collateralAddress", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "getBalance", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "getCollateralExposure", "inputs": [{ "name": "collateralAddress", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "getLoansByBorrower", "inputs": [{ "name": "borrower", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "tuple[]", "internalType": "struct Loan[]", "components": [{ "name": "id", "type": "uint256", "internalType": "uint256" }, { "name": "amount", "type": "uint256", "internalType": "uint256" }, { "name": "collateral", "type": "tuple", "internalType": "struct Collateral", "components": [{ "name": "collateralAddress", "type": "address", "internalType": "address" }, { "name": "maxLendPerToken", "type": "uint256", "internalType": "uint256" }, { "name": "interestRate", "type": "uint256", "internalType": "uint256" }, { "name": "active", "type": "bool", "internalType": "bool" }, { "name": "minAmount", "type": "uint256", "internalType": "uint256" }, { "name": "maxExposure", "type": "uint256", "internalType": "uint256" }, { "name": "currentExposure", "type": "uint256", "internalType": "uint256" }] }, { "name": "collateralAmount", "type": "uint256", "internalType": "uint256" }, { "name": "timestamp", "type": "uint256", "internalType": "uint256" }, { "name": "borrower", "type": "address", "internalType": "address" }, { "name": "userPaid", "type": "uint256", "internalType": "uint256" }] }], "stateMutability": "view" }, { "type": "function", "name": "getRoleAdmin", "inputs": [{ "name": "role", "type": "bytes32", "internalType": "bytes32" }], "outputs": [{ "name": "", "type": "bytes32", "internalType": "bytes32" }], "stateMutability": "view" }, { "type": "function", "name": "grantBorrowerRouterRole", "inputs": [{ "name": "account", "type": "address", "internalType": "address" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "grantRole", "inputs": [{ "name": "role", "type": "bytes32", "internalType": "bytes32" }, { "name": "account", "type": "address", "internalType": "address" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "hasRole", "inputs": [{ "name": "role", "type": "bytes32", "internalType": "bytes32" }, { "name": "account", "type": "address", "internalType": "address" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "initialize", "inputs": [{ "name": "_tokenAddress", "type": "address", "internalType": "address" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "loanConfirmation", "inputs": [{ "name": "amount", "type": "uint256", "internalType": "uint256" }, { "name": "collateralAmount", "type": "uint256", "internalType": "uint256" }, { "name": "collateralAddress", "type": "address", "internalType": "address" }, { "name": "borrower", "type": "address", "internalType": "address" }, { "name": "userPaid", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "loans", "inputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "id", "type": "uint256", "internalType": "uint256" }, { "name": "amount", "type": "uint256", "internalType": "uint256" }, { "name": "collateral", "type": "tuple", "internalType": "struct Collateral", "components": [{ "name": "collateralAddress", "type": "address", "internalType": "address" }, { "name": "maxLendPerToken", "type": "uint256", "internalType": "uint256" }, { "name": "interestRate", "type": "uint256", "internalType": "uint256" }, { "name": "active", "type": "bool", "internalType": "bool" }, { "name": "minAmount", "type": "uint256", "internalType": "uint256" }, { "name": "maxExposure", "type": "uint256", "internalType": "uint256" }, { "name": "currentExposure", "type": "uint256", "internalType": "uint256" }] }, { "name": "collateralAmount", "type": "uint256", "internalType": "uint256" }, { "name": "timestamp", "type": "uint256", "internalType": "uint256" }, { "name": "borrower", "type": "address", "internalType": "address" }, { "name": "userPaid", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "nextLoanId", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "privilegedLoan", "inputs": [{ "name": "flashLoanToken", "type": "address", "internalType": "contract IERC20" }, { "name": "amount", "type": "uint256", "internalType": "uint256" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "removeCollateral", "inputs": [{ "name": "collateralAddress", "type": "address", "internalType": "address" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "renounceRole", "inputs": [{ "name": "role", "type": "bytes32", "internalType": "bytes32" }, { "name": "callerConfirmation", "type": "address", "internalType": "address" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "repayLoan", "inputs": [{ "name": "loanId", "type": "uint256", "internalType": "uint256" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "revokeBorrowerRouterRole", "inputs": [{ "name": "account", "type": "address", "internalType": "address" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "revokeRole", "inputs": [{ "name": "role", "type": "bytes32", "internalType": "bytes32" }, { "name": "account", "type": "address", "internalType": "address" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "supportsInterface", "inputs": [{ "name": "interfaceId", "type": "bytes4", "internalType": "bytes4" }], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "tokenHolded", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "contract IERC20" }], "stateMutability": "view" }, { "type": "function", "name": "updateMaxExposure", "inputs": [{ "name": "collateralAddress", "type": "address", "internalType": "address" }, { "name": "newMaxExposure", "type": "uint256", "internalType": "uint256" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "updateMaxLendPerTokenBulk", "inputs": [{ "name": "collateralAddresses", "type": "address[]", "internalType": "address[]" }, { "name": "newMaxLendPerTokens", "type": "uint256[]", "internalType": "uint256[]" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "withdraw", "inputs": [{ "name": "amount", "type": "uint256", "internalType": "uint256" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "event", "name": "ExposureUpdated", "inputs": [{ "name": "collateralAddress", "type": "address", "indexed": false, "internalType": "address" }, { "name": "currentExposure", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "Initialized", "inputs": [{ "name": "version", "type": "uint64", "indexed": false, "internalType": "uint64" }], "anonymous": false }, { "type": "event", "name": "InterestRateSet", "inputs": [{ "name": "newInterestRate", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "LoanCreated", "inputs": [{ "name": "loanId", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "amount", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "timestamp", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "repaid", "type": "bool", "indexed": false, "internalType": "bool" }], "anonymous": false }, { "type": "event", "name": "LoanRepaid", "inputs": [{ "name": "loanId", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "MaxExposureUpdated", "inputs": [{ "name": "collateralAddress", "type": "address", "indexed": false, "internalType": "address" }, { "name": "oldMaxExposure", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "newMaxExposure", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "MaxLendPerTokenUpdated", "inputs": [{ "name": "collateralAddress", "type": "address", "indexed": false, "internalType": "address" }, { "name": "oldValue", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "newValue", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "PrivilegedLoan", "inputs": [{ "name": "borrower", "type": "address", "indexed": false, "internalType": "address" }, { "name": "amount", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "PrivilegedLoanRepaid", "inputs": [{ "name": "borrower", "type": "address", "indexed": false, "internalType": "address" }, { "name": "amount", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "RoleAdminChanged", "inputs": [{ "name": "role", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "previousAdminRole", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "newAdminRole", "type": "bytes32", "indexed": true, "internalType": "bytes32" }], "anonymous": false }, { "type": "event", "name": "RoleGranted", "inputs": [{ "name": "role", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "account", "type": "address", "indexed": true, "internalType": "address" }, { "name": "sender", "type": "address", "indexed": true, "internalType": "address" }], "anonymous": false }, { "type": "event", "name": "RoleRevoked", "inputs": [{ "name": "role", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "account", "type": "address", "indexed": true, "internalType": "address" }, { "name": "sender", "type": "address", "indexed": true, "internalType": "address" }], "anonymous": false }, { "type": "error", "name": "AccessControlBadConfirmation", "inputs": [] }, { "type": "error", "name": "AccessControlUnauthorizedAccount", "inputs": [{ "name": "account", "type": "address", "internalType": "address" }, { "name": "neededRole", "type": "bytes32", "internalType": "bytes32" }] }, { "type": "error", "name": "InvalidInitialization", "inputs": [] }, { "type": "error", "name": "NotInitializing", "inputs": [] }];
|
|
2957
|
+
var tokenHolderAbi = [
|
|
2958
|
+
{ inputs: [], name: "AccessControlBadConfirmation", type: "error" },
|
|
2959
|
+
{
|
|
2960
|
+
inputs: [
|
|
2961
|
+
{ internalType: "address", name: "account", type: "address" },
|
|
2962
|
+
{ internalType: "bytes32", name: "neededRole", type: "bytes32" }
|
|
2963
|
+
],
|
|
2964
|
+
name: "AccessControlUnauthorizedAccount",
|
|
2965
|
+
type: "error"
|
|
2966
|
+
},
|
|
2967
|
+
{ inputs: [], name: "InvalidInitialization", type: "error" },
|
|
2968
|
+
{ inputs: [], name: "NotInitializing", type: "error" },
|
|
2969
|
+
{
|
|
2970
|
+
anonymous: false,
|
|
2971
|
+
inputs: [
|
|
2972
|
+
{
|
|
2973
|
+
indexed: false,
|
|
2974
|
+
internalType: "uint64",
|
|
2975
|
+
name: "version",
|
|
2976
|
+
type: "uint64"
|
|
2977
|
+
}
|
|
2978
|
+
],
|
|
2979
|
+
name: "Initialized",
|
|
2980
|
+
type: "event"
|
|
2981
|
+
},
|
|
2982
|
+
{
|
|
2983
|
+
anonymous: false,
|
|
2984
|
+
inputs: [
|
|
2985
|
+
{
|
|
2986
|
+
indexed: false,
|
|
2987
|
+
internalType: "uint256",
|
|
2988
|
+
name: "newInterestRate",
|
|
2989
|
+
type: "uint256"
|
|
2990
|
+
}
|
|
2991
|
+
],
|
|
2992
|
+
name: "InterestRateSet",
|
|
2993
|
+
type: "event"
|
|
2994
|
+
},
|
|
2995
|
+
{
|
|
2996
|
+
anonymous: false,
|
|
2997
|
+
inputs: [
|
|
2998
|
+
{
|
|
2999
|
+
indexed: false,
|
|
3000
|
+
internalType: "uint256",
|
|
3001
|
+
name: "loanId",
|
|
3002
|
+
type: "uint256"
|
|
3003
|
+
},
|
|
3004
|
+
{
|
|
3005
|
+
indexed: false,
|
|
3006
|
+
internalType: "uint256",
|
|
3007
|
+
name: "amount",
|
|
3008
|
+
type: "uint256"
|
|
3009
|
+
},
|
|
3010
|
+
{
|
|
3011
|
+
indexed: false,
|
|
3012
|
+
internalType: "uint256",
|
|
3013
|
+
name: "timestamp",
|
|
3014
|
+
type: "uint256"
|
|
3015
|
+
},
|
|
3016
|
+
{ indexed: false, internalType: "bool", name: "repaid", type: "bool" }
|
|
3017
|
+
],
|
|
3018
|
+
name: "LoanCreated",
|
|
3019
|
+
type: "event"
|
|
3020
|
+
},
|
|
3021
|
+
{
|
|
3022
|
+
anonymous: false,
|
|
3023
|
+
inputs: [
|
|
3024
|
+
{
|
|
3025
|
+
indexed: false,
|
|
3026
|
+
internalType: "uint256",
|
|
3027
|
+
name: "loanId",
|
|
3028
|
+
type: "uint256"
|
|
3029
|
+
}
|
|
3030
|
+
],
|
|
3031
|
+
name: "LoanRepaid",
|
|
3032
|
+
type: "event"
|
|
3033
|
+
},
|
|
3034
|
+
{
|
|
3035
|
+
anonymous: false,
|
|
3036
|
+
inputs: [
|
|
3037
|
+
{
|
|
3038
|
+
indexed: false,
|
|
3039
|
+
internalType: "address",
|
|
3040
|
+
name: "collateralAddress",
|
|
3041
|
+
type: "address"
|
|
3042
|
+
},
|
|
3043
|
+
{
|
|
3044
|
+
indexed: false,
|
|
3045
|
+
internalType: "uint256",
|
|
3046
|
+
name: "oldValue",
|
|
3047
|
+
type: "uint256"
|
|
3048
|
+
},
|
|
3049
|
+
{
|
|
3050
|
+
indexed: false,
|
|
3051
|
+
internalType: "uint256",
|
|
3052
|
+
name: "newValue",
|
|
3053
|
+
type: "uint256"
|
|
3054
|
+
}
|
|
3055
|
+
],
|
|
3056
|
+
name: "MaxLendPerTokenUpdated",
|
|
3057
|
+
type: "event"
|
|
3058
|
+
},
|
|
3059
|
+
{
|
|
3060
|
+
anonymous: false,
|
|
3061
|
+
inputs: [
|
|
3062
|
+
{
|
|
3063
|
+
indexed: false,
|
|
3064
|
+
internalType: "address",
|
|
3065
|
+
name: "borrower",
|
|
3066
|
+
type: "address"
|
|
3067
|
+
},
|
|
3068
|
+
{
|
|
3069
|
+
indexed: false,
|
|
3070
|
+
internalType: "uint256",
|
|
3071
|
+
name: "amount",
|
|
3072
|
+
type: "uint256"
|
|
3073
|
+
}
|
|
3074
|
+
],
|
|
3075
|
+
name: "PrivilegedLoan",
|
|
3076
|
+
type: "event"
|
|
3077
|
+
},
|
|
3078
|
+
{
|
|
3079
|
+
anonymous: false,
|
|
3080
|
+
inputs: [
|
|
3081
|
+
{
|
|
3082
|
+
indexed: false,
|
|
3083
|
+
internalType: "address",
|
|
3084
|
+
name: "borrower",
|
|
3085
|
+
type: "address"
|
|
3086
|
+
},
|
|
3087
|
+
{
|
|
3088
|
+
indexed: false,
|
|
3089
|
+
internalType: "uint256",
|
|
3090
|
+
name: "amount",
|
|
3091
|
+
type: "uint256"
|
|
3092
|
+
}
|
|
3093
|
+
],
|
|
3094
|
+
name: "PrivilegedLoanRepaid",
|
|
3095
|
+
type: "event"
|
|
3096
|
+
},
|
|
3097
|
+
{
|
|
3098
|
+
anonymous: false,
|
|
3099
|
+
inputs: [
|
|
3100
|
+
{ indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
|
|
3101
|
+
{
|
|
3102
|
+
indexed: true,
|
|
3103
|
+
internalType: "bytes32",
|
|
3104
|
+
name: "previousAdminRole",
|
|
3105
|
+
type: "bytes32"
|
|
3106
|
+
},
|
|
3107
|
+
{
|
|
3108
|
+
indexed: true,
|
|
3109
|
+
internalType: "bytes32",
|
|
3110
|
+
name: "newAdminRole",
|
|
3111
|
+
type: "bytes32"
|
|
3112
|
+
}
|
|
3113
|
+
],
|
|
3114
|
+
name: "RoleAdminChanged",
|
|
3115
|
+
type: "event"
|
|
3116
|
+
},
|
|
3117
|
+
{
|
|
3118
|
+
anonymous: false,
|
|
3119
|
+
inputs: [
|
|
3120
|
+
{ indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
|
|
3121
|
+
{
|
|
3122
|
+
indexed: true,
|
|
3123
|
+
internalType: "address",
|
|
3124
|
+
name: "account",
|
|
3125
|
+
type: "address"
|
|
3126
|
+
},
|
|
3127
|
+
{
|
|
3128
|
+
indexed: true,
|
|
3129
|
+
internalType: "address",
|
|
3130
|
+
name: "sender",
|
|
3131
|
+
type: "address"
|
|
3132
|
+
}
|
|
3133
|
+
],
|
|
3134
|
+
name: "RoleGranted",
|
|
3135
|
+
type: "event"
|
|
3136
|
+
},
|
|
3137
|
+
{
|
|
3138
|
+
anonymous: false,
|
|
3139
|
+
inputs: [
|
|
3140
|
+
{ indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
|
|
3141
|
+
{
|
|
3142
|
+
indexed: true,
|
|
3143
|
+
internalType: "address",
|
|
3144
|
+
name: "account",
|
|
3145
|
+
type: "address"
|
|
3146
|
+
},
|
|
3147
|
+
{
|
|
3148
|
+
indexed: true,
|
|
3149
|
+
internalType: "address",
|
|
3150
|
+
name: "sender",
|
|
3151
|
+
type: "address"
|
|
3152
|
+
}
|
|
3153
|
+
],
|
|
3154
|
+
name: "RoleRevoked",
|
|
3155
|
+
type: "event"
|
|
3156
|
+
},
|
|
3157
|
+
{
|
|
3158
|
+
inputs: [],
|
|
3159
|
+
name: "BORROWER_ROUTER_ROLE",
|
|
3160
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
3161
|
+
stateMutability: "view",
|
|
3162
|
+
type: "function"
|
|
3163
|
+
},
|
|
3164
|
+
{
|
|
3165
|
+
inputs: [],
|
|
3166
|
+
name: "DEFAULT_ADMIN_ROLE",
|
|
3167
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
3168
|
+
stateMutability: "view",
|
|
3169
|
+
type: "function"
|
|
3170
|
+
},
|
|
3171
|
+
{
|
|
3172
|
+
inputs: [
|
|
3173
|
+
{ internalType: "address", name: "collateralAddress", type: "address" },
|
|
3174
|
+
{ internalType: "uint256", name: "_interestRate", type: "uint256" },
|
|
3175
|
+
{ internalType: "uint256", name: "maxLendPerToken", type: "uint256" },
|
|
3176
|
+
{ internalType: "uint256", name: "minAmount", type: "uint256" }
|
|
3177
|
+
],
|
|
3178
|
+
name: "addCollateral",
|
|
3179
|
+
outputs: [],
|
|
3180
|
+
stateMutability: "nonpayable",
|
|
3181
|
+
type: "function"
|
|
3182
|
+
},
|
|
3183
|
+
{
|
|
3184
|
+
inputs: [{ internalType: "address", name: "", type: "address" }],
|
|
3185
|
+
name: "collateralMapping",
|
|
3186
|
+
outputs: [
|
|
3187
|
+
{ internalType: "address", name: "collateralAddress", type: "address" },
|
|
3188
|
+
{ internalType: "uint256", name: "maxLendPerToken", type: "uint256" },
|
|
3189
|
+
{ internalType: "uint256", name: "interestRate", type: "uint256" },
|
|
3190
|
+
{ internalType: "bool", name: "active", type: "bool" },
|
|
3191
|
+
{ internalType: "uint256", name: "minAmount", type: "uint256" },
|
|
3192
|
+
{ internalType: "uint256", name: "maxExposure", type: "uint256" },
|
|
3193
|
+
{ internalType: "uint256", name: "currentExposure", type: "uint256" }
|
|
3194
|
+
],
|
|
3195
|
+
stateMutability: "view",
|
|
3196
|
+
type: "function"
|
|
3197
|
+
},
|
|
3198
|
+
{
|
|
3199
|
+
inputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
|
|
3200
|
+
name: "deposit",
|
|
3201
|
+
outputs: [],
|
|
3202
|
+
stateMutability: "nonpayable",
|
|
3203
|
+
type: "function"
|
|
3204
|
+
},
|
|
3205
|
+
{
|
|
3206
|
+
inputs: [],
|
|
3207
|
+
name: "getBalance",
|
|
3208
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
3209
|
+
stateMutability: "view",
|
|
3210
|
+
type: "function"
|
|
3211
|
+
},
|
|
3212
|
+
{
|
|
3213
|
+
inputs: [{ internalType: "bytes32", name: "role", type: "bytes32" }],
|
|
3214
|
+
name: "getRoleAdmin",
|
|
3215
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
3216
|
+
stateMutability: "view",
|
|
3217
|
+
type: "function"
|
|
3218
|
+
},
|
|
3219
|
+
{
|
|
3220
|
+
inputs: [{ internalType: "address", name: "account", type: "address" }],
|
|
3221
|
+
name: "grantBorrowerRouterRole",
|
|
3222
|
+
outputs: [],
|
|
3223
|
+
stateMutability: "nonpayable",
|
|
3224
|
+
type: "function"
|
|
3225
|
+
},
|
|
3226
|
+
{
|
|
3227
|
+
inputs: [
|
|
3228
|
+
{ internalType: "bytes32", name: "role", type: "bytes32" },
|
|
3229
|
+
{ internalType: "address", name: "account", type: "address" }
|
|
3230
|
+
],
|
|
3231
|
+
name: "grantRole",
|
|
3232
|
+
outputs: [],
|
|
3233
|
+
stateMutability: "nonpayable",
|
|
3234
|
+
type: "function"
|
|
3235
|
+
},
|
|
3236
|
+
{
|
|
3237
|
+
inputs: [
|
|
3238
|
+
{ internalType: "bytes32", name: "role", type: "bytes32" },
|
|
3239
|
+
{ internalType: "address", name: "account", type: "address" }
|
|
3240
|
+
],
|
|
3241
|
+
name: "hasRole",
|
|
3242
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
3243
|
+
stateMutability: "view",
|
|
3244
|
+
type: "function"
|
|
3245
|
+
},
|
|
3246
|
+
{
|
|
3247
|
+
inputs: [
|
|
3248
|
+
{ internalType: "address", name: "_tokenAddress", type: "address" }
|
|
3249
|
+
],
|
|
3250
|
+
name: "initialize",
|
|
3251
|
+
outputs: [],
|
|
3252
|
+
stateMutability: "nonpayable",
|
|
3253
|
+
type: "function"
|
|
3254
|
+
},
|
|
3255
|
+
{
|
|
3256
|
+
inputs: [
|
|
3257
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
3258
|
+
{ internalType: "uint256", name: "collateralAmount", type: "uint256" },
|
|
3259
|
+
{ internalType: "address", name: "collateralAddress", type: "address" },
|
|
3260
|
+
{ internalType: "address", name: "borrower", type: "address" },
|
|
3261
|
+
{ internalType: "uint256", name: "userPaid", type: "uint256" }
|
|
3262
|
+
],
|
|
3263
|
+
name: "loanConfirmation",
|
|
3264
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
3265
|
+
stateMutability: "nonpayable",
|
|
3266
|
+
type: "function"
|
|
3267
|
+
},
|
|
3268
|
+
{
|
|
3269
|
+
inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
3270
|
+
name: "loans",
|
|
3271
|
+
outputs: [
|
|
3272
|
+
{ internalType: "uint256", name: "id", type: "uint256" },
|
|
3273
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
3274
|
+
{
|
|
3275
|
+
components: [
|
|
3276
|
+
{
|
|
3277
|
+
internalType: "address",
|
|
3278
|
+
name: "collateralAddress",
|
|
3279
|
+
type: "address"
|
|
3280
|
+
},
|
|
3281
|
+
{ internalType: "uint256", name: "maxLendPerToken", type: "uint256" },
|
|
3282
|
+
{ internalType: "uint256", name: "interestRate", type: "uint256" },
|
|
3283
|
+
{ internalType: "bool", name: "active", type: "bool" },
|
|
3284
|
+
{ internalType: "uint256", name: "minAmount", type: "uint256" },
|
|
3285
|
+
{ internalType: "uint256", name: "maxExposure", type: "uint256" },
|
|
3286
|
+
{ internalType: "uint256", name: "currentExposure", type: "uint256" }
|
|
3287
|
+
],
|
|
3288
|
+
internalType: "struct Collateral",
|
|
3289
|
+
name: "collateral",
|
|
3290
|
+
type: "tuple"
|
|
3291
|
+
},
|
|
3292
|
+
{ internalType: "uint256", name: "collateralAmount", type: "uint256" },
|
|
3293
|
+
{ internalType: "uint256", name: "timestamp", type: "uint256" },
|
|
3294
|
+
{ internalType: "address", name: "borrower", type: "address" },
|
|
3295
|
+
{ internalType: "uint256", name: "userPaid", type: "uint256" }
|
|
3296
|
+
],
|
|
3297
|
+
stateMutability: "view",
|
|
3298
|
+
type: "function"
|
|
3299
|
+
},
|
|
3300
|
+
{
|
|
3301
|
+
inputs: [],
|
|
3302
|
+
name: "nextLoanId",
|
|
3303
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
3304
|
+
stateMutability: "view",
|
|
3305
|
+
type: "function"
|
|
3306
|
+
},
|
|
3307
|
+
{
|
|
3308
|
+
inputs: [
|
|
3309
|
+
{
|
|
3310
|
+
internalType: "contract IERC20",
|
|
3311
|
+
name: "flashLoanToken",
|
|
3312
|
+
type: "address"
|
|
3313
|
+
},
|
|
3314
|
+
{ internalType: "uint256", name: "amount", type: "uint256" }
|
|
3315
|
+
],
|
|
3316
|
+
name: "privilegedLoan",
|
|
3317
|
+
outputs: [],
|
|
3318
|
+
stateMutability: "nonpayable",
|
|
3319
|
+
type: "function"
|
|
3320
|
+
},
|
|
3321
|
+
{
|
|
3322
|
+
inputs: [
|
|
3323
|
+
{ internalType: "address", name: "collateralAddress", type: "address" }
|
|
3324
|
+
],
|
|
3325
|
+
name: "removeCollateral",
|
|
3326
|
+
outputs: [],
|
|
3327
|
+
stateMutability: "nonpayable",
|
|
3328
|
+
type: "function"
|
|
3329
|
+
},
|
|
3330
|
+
{
|
|
3331
|
+
inputs: [
|
|
3332
|
+
{ internalType: "bytes32", name: "role", type: "bytes32" },
|
|
3333
|
+
{ internalType: "address", name: "callerConfirmation", type: "address" }
|
|
3334
|
+
],
|
|
3335
|
+
name: "renounceRole",
|
|
3336
|
+
outputs: [],
|
|
3337
|
+
stateMutability: "nonpayable",
|
|
3338
|
+
type: "function"
|
|
3339
|
+
},
|
|
3340
|
+
{
|
|
3341
|
+
inputs: [{ internalType: "uint256", name: "loanId", type: "uint256" }],
|
|
3342
|
+
name: "repayLoan",
|
|
3343
|
+
outputs: [],
|
|
3344
|
+
stateMutability: "nonpayable",
|
|
3345
|
+
type: "function"
|
|
3346
|
+
},
|
|
3347
|
+
{
|
|
3348
|
+
inputs: [{ internalType: "address", name: "account", type: "address" }],
|
|
3349
|
+
name: "revokeBorrowerRouterRole",
|
|
3350
|
+
outputs: [],
|
|
3351
|
+
stateMutability: "nonpayable",
|
|
3352
|
+
type: "function"
|
|
3353
|
+
},
|
|
3354
|
+
{
|
|
3355
|
+
inputs: [
|
|
3356
|
+
{ internalType: "bytes32", name: "role", type: "bytes32" },
|
|
3357
|
+
{ internalType: "address", name: "account", type: "address" }
|
|
3358
|
+
],
|
|
3359
|
+
name: "revokeRole",
|
|
3360
|
+
outputs: [],
|
|
3361
|
+
stateMutability: "nonpayable",
|
|
3362
|
+
type: "function"
|
|
3363
|
+
},
|
|
3364
|
+
{
|
|
3365
|
+
inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }],
|
|
3366
|
+
name: "supportsInterface",
|
|
3367
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
3368
|
+
stateMutability: "view",
|
|
3369
|
+
type: "function"
|
|
3370
|
+
},
|
|
3371
|
+
{
|
|
3372
|
+
inputs: [],
|
|
3373
|
+
name: "tokenHolded",
|
|
3374
|
+
outputs: [{ internalType: "contract IERC20", name: "", type: "address" }],
|
|
3375
|
+
stateMutability: "view",
|
|
3376
|
+
type: "function"
|
|
3377
|
+
},
|
|
3378
|
+
{
|
|
3379
|
+
inputs: [
|
|
3380
|
+
{
|
|
3381
|
+
internalType: "address[]",
|
|
3382
|
+
name: "collateralAddresses",
|
|
3383
|
+
type: "address[]"
|
|
3384
|
+
},
|
|
3385
|
+
{
|
|
3386
|
+
internalType: "uint256[]",
|
|
3387
|
+
name: "newMaxLendPerTokens",
|
|
3388
|
+
type: "uint256[]"
|
|
3389
|
+
}
|
|
3390
|
+
],
|
|
3391
|
+
name: "updateMaxLendPerTokenBulk",
|
|
3392
|
+
outputs: [],
|
|
3393
|
+
stateMutability: "nonpayable",
|
|
3394
|
+
type: "function"
|
|
3395
|
+
},
|
|
3396
|
+
{
|
|
3397
|
+
inputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
|
|
3398
|
+
name: "withdraw",
|
|
3399
|
+
outputs: [],
|
|
3400
|
+
stateMutability: "nonpayable",
|
|
3401
|
+
type: "function"
|
|
3402
|
+
},
|
|
3403
|
+
{
|
|
3404
|
+
inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
3405
|
+
name: "activeLoanIds",
|
|
3406
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
3407
|
+
stateMutability: "view",
|
|
3408
|
+
type: "function"
|
|
3409
|
+
},
|
|
3410
|
+
{
|
|
3411
|
+
inputs: [],
|
|
3412
|
+
name: "getActiveLoanCount",
|
|
3413
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
3414
|
+
stateMutability: "view",
|
|
3415
|
+
type: "function"
|
|
3416
|
+
},
|
|
3417
|
+
{
|
|
3418
|
+
inputs: [
|
|
3419
|
+
{ internalType: "uint256", name: "startIndex", type: "uint256" },
|
|
3420
|
+
{ internalType: "uint256", name: "batchSize", type: "uint256" }
|
|
3421
|
+
],
|
|
3422
|
+
name: "getActiveLoansBatch",
|
|
3423
|
+
outputs: [
|
|
3424
|
+
{
|
|
3425
|
+
components: [
|
|
3426
|
+
{ internalType: "uint256", name: "id", type: "uint256" },
|
|
3427
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
3428
|
+
{
|
|
3429
|
+
components: [
|
|
3430
|
+
{
|
|
3431
|
+
internalType: "address",
|
|
3432
|
+
name: "collateralAddress",
|
|
3433
|
+
type: "address"
|
|
3434
|
+
},
|
|
3435
|
+
{
|
|
3436
|
+
internalType: "uint256",
|
|
3437
|
+
name: "maxLendPerToken",
|
|
3438
|
+
type: "uint256"
|
|
3439
|
+
},
|
|
3440
|
+
{
|
|
3441
|
+
internalType: "uint256",
|
|
3442
|
+
name: "interestRate",
|
|
3443
|
+
type: "uint256"
|
|
3444
|
+
},
|
|
3445
|
+
{ internalType: "bool", name: "active", type: "bool" },
|
|
3446
|
+
{ internalType: "uint256", name: "minAmount", type: "uint256" },
|
|
3447
|
+
{ internalType: "uint256", name: "maxExposure", type: "uint256" },
|
|
3448
|
+
{
|
|
3449
|
+
internalType: "uint256",
|
|
3450
|
+
name: "currentExposure",
|
|
3451
|
+
type: "uint256"
|
|
3452
|
+
}
|
|
3453
|
+
],
|
|
3454
|
+
internalType: "struct Collateral",
|
|
3455
|
+
name: "collateral",
|
|
3456
|
+
type: "tuple"
|
|
3457
|
+
},
|
|
3458
|
+
{
|
|
3459
|
+
internalType: "uint256",
|
|
3460
|
+
name: "collateralAmount",
|
|
3461
|
+
type: "uint256"
|
|
3462
|
+
},
|
|
3463
|
+
{ internalType: "uint256", name: "timestamp", type: "uint256" },
|
|
3464
|
+
{ internalType: "address", name: "borrower", type: "address" },
|
|
3465
|
+
{ internalType: "uint256", name: "userPaid", type: "uint256" }
|
|
3466
|
+
],
|
|
3467
|
+
internalType: "struct Loan[]",
|
|
3468
|
+
name: "",
|
|
3469
|
+
type: "tuple[]"
|
|
3470
|
+
}
|
|
3471
|
+
],
|
|
3472
|
+
stateMutability: "view",
|
|
3473
|
+
type: "function"
|
|
3474
|
+
},
|
|
3475
|
+
{
|
|
3476
|
+
inputs: [{ internalType: "address", name: "borrower", type: "address" }],
|
|
3477
|
+
name: "getLoansByBorrower",
|
|
3478
|
+
outputs: [
|
|
3479
|
+
{
|
|
3480
|
+
components: [
|
|
3481
|
+
{ internalType: "uint256", name: "id", type: "uint256" },
|
|
3482
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
3483
|
+
{
|
|
3484
|
+
components: [
|
|
3485
|
+
{
|
|
3486
|
+
internalType: "address",
|
|
3487
|
+
name: "collateralAddress",
|
|
3488
|
+
type: "address"
|
|
3489
|
+
},
|
|
3490
|
+
{
|
|
3491
|
+
internalType: "uint256",
|
|
3492
|
+
name: "maxLendPerToken",
|
|
3493
|
+
type: "uint256"
|
|
3494
|
+
},
|
|
3495
|
+
{
|
|
3496
|
+
internalType: "uint256",
|
|
3497
|
+
name: "interestRate",
|
|
3498
|
+
type: "uint256"
|
|
3499
|
+
},
|
|
3500
|
+
{ internalType: "bool", name: "active", type: "bool" },
|
|
3501
|
+
{ internalType: "uint256", name: "minAmount", type: "uint256" },
|
|
3502
|
+
{ internalType: "uint256", name: "maxExposure", type: "uint256" },
|
|
3503
|
+
{
|
|
3504
|
+
internalType: "uint256",
|
|
3505
|
+
name: "currentExposure",
|
|
3506
|
+
type: "uint256"
|
|
3507
|
+
}
|
|
3508
|
+
],
|
|
3509
|
+
internalType: "struct Collateral",
|
|
3510
|
+
name: "collateral",
|
|
3511
|
+
type: "tuple"
|
|
3512
|
+
},
|
|
3513
|
+
{
|
|
3514
|
+
internalType: "uint256",
|
|
3515
|
+
name: "collateralAmount",
|
|
3516
|
+
type: "uint256"
|
|
3517
|
+
},
|
|
3518
|
+
{ internalType: "uint256", name: "timestamp", type: "uint256" },
|
|
3519
|
+
{ internalType: "address", name: "borrower", type: "address" },
|
|
3520
|
+
{ internalType: "uint256", name: "userPaid", type: "uint256" }
|
|
3521
|
+
],
|
|
3522
|
+
internalType: "struct Loan[]",
|
|
3523
|
+
name: "",
|
|
3524
|
+
type: "tuple[]"
|
|
3525
|
+
}
|
|
3526
|
+
],
|
|
3527
|
+
stateMutability: "view",
|
|
3528
|
+
type: "function"
|
|
3529
|
+
},
|
|
3530
|
+
{
|
|
3531
|
+
inputs: [
|
|
3532
|
+
{ internalType: "address", name: "collateralAddress", type: "address" }
|
|
3533
|
+
],
|
|
3534
|
+
name: "getCollateralExposure",
|
|
3535
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
3536
|
+
stateMutability: "view",
|
|
3537
|
+
type: "function"
|
|
3538
|
+
},
|
|
3539
|
+
{
|
|
3540
|
+
inputs: [
|
|
3541
|
+
{ internalType: "address", name: "collateralAddress", type: "address" }
|
|
3542
|
+
],
|
|
3543
|
+
name: "getAvailableExposure",
|
|
3544
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
3545
|
+
stateMutability: "view",
|
|
3546
|
+
type: "function"
|
|
3547
|
+
},
|
|
3548
|
+
{
|
|
3549
|
+
inputs: [
|
|
3550
|
+
{ internalType: "address", name: "collateralAddress", type: "address" },
|
|
3551
|
+
{ internalType: "uint256", name: "_interestRate", type: "uint256" },
|
|
3552
|
+
{ internalType: "uint256", name: "maxLendPerToken", type: "uint256" },
|
|
3553
|
+
{ internalType: "uint256", name: "minAmount", type: "uint256" },
|
|
3554
|
+
{ internalType: "uint256", name: "maxExposure", type: "uint256" }
|
|
3555
|
+
],
|
|
3556
|
+
name: "addCollateral",
|
|
3557
|
+
outputs: [],
|
|
3558
|
+
stateMutability: "nonpayable",
|
|
3559
|
+
type: "function"
|
|
3560
|
+
},
|
|
3561
|
+
{
|
|
3562
|
+
inputs: [
|
|
3563
|
+
{ internalType: "address", name: "collateralAddress", type: "address" },
|
|
3564
|
+
{ internalType: "uint256", name: "newMaxExposure", type: "uint256" }
|
|
3565
|
+
],
|
|
3566
|
+
name: "updateMaxExposure",
|
|
3567
|
+
outputs: [],
|
|
3568
|
+
stateMutability: "nonpayable",
|
|
3569
|
+
type: "function"
|
|
3570
|
+
},
|
|
3571
|
+
{
|
|
3572
|
+
anonymous: false,
|
|
3573
|
+
inputs: [
|
|
3574
|
+
{
|
|
3575
|
+
indexed: false,
|
|
3576
|
+
internalType: "address",
|
|
3577
|
+
name: "collateralAddress",
|
|
3578
|
+
type: "address"
|
|
3579
|
+
},
|
|
3580
|
+
{
|
|
3581
|
+
indexed: false,
|
|
3582
|
+
internalType: "uint256",
|
|
3583
|
+
name: "currentExposure",
|
|
3584
|
+
type: "uint256"
|
|
3585
|
+
}
|
|
3586
|
+
],
|
|
3587
|
+
name: "ExposureUpdated",
|
|
3588
|
+
type: "event"
|
|
3589
|
+
},
|
|
3590
|
+
{
|
|
3591
|
+
anonymous: false,
|
|
3592
|
+
inputs: [
|
|
3593
|
+
{
|
|
3594
|
+
indexed: false,
|
|
3595
|
+
internalType: "address",
|
|
3596
|
+
name: "collateralAddress",
|
|
3597
|
+
type: "address"
|
|
3598
|
+
},
|
|
3599
|
+
{
|
|
3600
|
+
indexed: false,
|
|
3601
|
+
internalType: "uint256",
|
|
3602
|
+
name: "oldMaxExposure",
|
|
3603
|
+
type: "uint256"
|
|
3604
|
+
},
|
|
3605
|
+
{
|
|
3606
|
+
indexed: false,
|
|
3607
|
+
internalType: "uint256",
|
|
3608
|
+
name: "newMaxExposure",
|
|
3609
|
+
type: "uint256"
|
|
3610
|
+
}
|
|
3611
|
+
],
|
|
3612
|
+
name: "MaxExposureUpdated",
|
|
3613
|
+
type: "event"
|
|
3614
|
+
}
|
|
3615
|
+
];
|
|
2711
3616
|
|
|
2712
3617
|
// evm.ts
|
|
2713
3618
|
var openPositionEvm = (_0, _1, _2) => __async(void 0, [_0, _1, _2], function* (provider, borrowerOpsContractAddress, {
|
|
@@ -2950,6 +3855,56 @@ function getTokenBalanceEvm(provider, tokenHolderContractAddress) {
|
|
|
2950
3855
|
return contract.getBalance();
|
|
2951
3856
|
});
|
|
2952
3857
|
}
|
|
3858
|
+
function getActiveLoanCountEvm(provider, tokenHolderContractAddress) {
|
|
3859
|
+
return __async(this, null, function* () {
|
|
3860
|
+
const contract = new Contract(
|
|
3861
|
+
tokenHolderContractAddress,
|
|
3862
|
+
tokenHolderAbi,
|
|
3863
|
+
provider
|
|
3864
|
+
);
|
|
3865
|
+
return contract.getActiveLoanCount();
|
|
3866
|
+
});
|
|
3867
|
+
}
|
|
3868
|
+
function getActiveLoansBatchEvm(provider, tokenHolderContractAddress, startIndex, batchSize) {
|
|
3869
|
+
return __async(this, null, function* () {
|
|
3870
|
+
const contract = new Contract(
|
|
3871
|
+
tokenHolderContractAddress,
|
|
3872
|
+
tokenHolderAbi,
|
|
3873
|
+
provider
|
|
3874
|
+
);
|
|
3875
|
+
return contract.getActiveLoansBatch(startIndex, batchSize);
|
|
3876
|
+
});
|
|
3877
|
+
}
|
|
3878
|
+
function getLoansByBorrowerEvm(provider, tokenHolderContractAddress, borrowerAddress) {
|
|
3879
|
+
return __async(this, null, function* () {
|
|
3880
|
+
const contract = new Contract(
|
|
3881
|
+
tokenHolderContractAddress,
|
|
3882
|
+
tokenHolderAbi,
|
|
3883
|
+
provider
|
|
3884
|
+
);
|
|
3885
|
+
return contract.getLoansByBorrower(borrowerAddress);
|
|
3886
|
+
});
|
|
3887
|
+
}
|
|
3888
|
+
function getCollateralExposureEvm(provider, tokenHolderContractAddress, collateralAddress) {
|
|
3889
|
+
return __async(this, null, function* () {
|
|
3890
|
+
const contract = new Contract(
|
|
3891
|
+
tokenHolderContractAddress,
|
|
3892
|
+
tokenHolderAbi,
|
|
3893
|
+
provider
|
|
3894
|
+
);
|
|
3895
|
+
return contract.getCollateralExposure(collateralAddress);
|
|
3896
|
+
});
|
|
3897
|
+
}
|
|
3898
|
+
function getAvailableExposureEvm(provider, tokenHolderContractAddress, collateralAddress) {
|
|
3899
|
+
return __async(this, null, function* () {
|
|
3900
|
+
const contract = new Contract(
|
|
3901
|
+
tokenHolderContractAddress,
|
|
3902
|
+
tokenHolderAbi,
|
|
3903
|
+
provider
|
|
3904
|
+
);
|
|
3905
|
+
return contract.getAvailableExposure(collateralAddress);
|
|
3906
|
+
});
|
|
3907
|
+
}
|
|
2953
3908
|
|
|
2954
3909
|
// index.ts
|
|
2955
3910
|
function getPda(seed, programId) {
|
|
@@ -4095,14 +5050,19 @@ export {
|
|
|
4095
5050
|
closeTradeV1,
|
|
4096
5051
|
closeTradeV2,
|
|
4097
5052
|
createTpDelegate,
|
|
5053
|
+
getActiveLoanCountEvm,
|
|
5054
|
+
getActiveLoansBatchEvm,
|
|
4098
5055
|
getAllPositions,
|
|
5056
|
+
getAvailableExposureEvm,
|
|
4099
5057
|
getClosedPositions,
|
|
4100
5058
|
getClosedPositionsEvm,
|
|
5059
|
+
getCollateralExposureEvm,
|
|
4101
5060
|
getCollateralInfoEvm,
|
|
4102
5061
|
getDelegateAccounts,
|
|
4103
5062
|
getLiquidatedPositions,
|
|
4104
5063
|
getLiquidatedPositionsEvm,
|
|
4105
5064
|
getLoanEvm,
|
|
5065
|
+
getLoansByBorrowerEvm,
|
|
4106
5066
|
getOffers,
|
|
4107
5067
|
getOffersEvm,
|
|
4108
5068
|
getOpenPositions,
|