@gvnrdao/dh-lit-actions 0.0.22 → 0.0.24
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
d27c13a41c5bcc6709d851c076c5f2d38aa804a9a9e3183a2dc035dd1d6b29d7
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
6c842ec61916b48d7a77ad2ecf7a3567e0c33fd20c3870f8ce97f296f3e4a1a9
|
|
@@ -1829,23 +1829,13 @@ var _LIT_ACTION_ = (() => {
|
|
|
1829
1829
|
throw new Error(`Amount must be positive, got: ${amount.toString()} wei`);
|
|
1830
1830
|
}
|
|
1831
1831
|
console.log(" Fetching protocol mint limits...");
|
|
1832
|
-
const
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
abi: ABI_MINIMUM_LOAN_VALUE_WEI,
|
|
1837
|
-
methodName: "minimumLoanValueWei",
|
|
1838
|
-
params: []
|
|
1839
|
-
});
|
|
1832
|
+
const rpcUrl = await Lit.Actions.getRpcUrl({ chain });
|
|
1833
|
+
const provider = new ethers.providers.JsonRpcProvider(rpcUrl);
|
|
1834
|
+
const loanOpsContract = new ethers.Contract(LOAN_OPS_MANAGER_ADDRESS, ABI_MINIMUM_LOAN_VALUE_WEI, provider);
|
|
1835
|
+
const minLoanValueResult = await loanOpsContract.minimumLoanValueWei();
|
|
1840
1836
|
const MIN_MINT_AMOUNT = BigInt(minLoanValueResult.toString());
|
|
1841
|
-
const
|
|
1842
|
-
|
|
1843
|
-
chain,
|
|
1844
|
-
contractAddress: LOAN_OPS_MANAGER_ADDRESS,
|
|
1845
|
-
abi: ABI_MAXIMUM_LOAN_VALUE_UCD,
|
|
1846
|
-
methodName: "maximumLoanValueUcd",
|
|
1847
|
-
params: []
|
|
1848
|
-
});
|
|
1837
|
+
const loanOpsContractForMax = new ethers.Contract(LOAN_OPS_MANAGER_ADDRESS, ABI_MAXIMUM_LOAN_VALUE_UCD, provider);
|
|
1838
|
+
const maxLoanValueUcdResult = await loanOpsContractForMax.maximumLoanValueUcd();
|
|
1849
1839
|
const maxLoanValueUcd = BigInt(maxLoanValueUcdResult.toString());
|
|
1850
1840
|
const MAX_MINT_AMOUNT = maxLoanValueUcd * 1000000000000000000n;
|
|
1851
1841
|
console.log(` \u2705 Protocol limits loaded from LoanOperationsManager`);
|
|
@@ -1960,14 +1950,8 @@ var _LIT_ACTION_ = (() => {
|
|
|
1960
1950
|
currentStep = "4a";
|
|
1961
1951
|
console.log("[Step 4a] Validating daily mint limit...");
|
|
1962
1952
|
const totalMintAmount = amount + mintFee;
|
|
1963
|
-
const
|
|
1964
|
-
|
|
1965
|
-
chain,
|
|
1966
|
-
contractAddress: UCD_CONTROLLER_ADDRESS,
|
|
1967
|
-
abi: ABI_REMAINING_MINT_CAPACITY,
|
|
1968
|
-
methodName: "getRemainingMintCapacity",
|
|
1969
|
-
params: []
|
|
1970
|
-
});
|
|
1953
|
+
const ucdControllerContract = new ethers.Contract(UCD_CONTROLLER_ADDRESS, ABI_REMAINING_MINT_CAPACITY, provider);
|
|
1954
|
+
const remainingCapacity = await ucdControllerContract.getRemainingMintCapacity();
|
|
1971
1955
|
const remainingCapacityBigInt = BigInt(remainingCapacity.toString());
|
|
1972
1956
|
if (totalMintAmount > remainingCapacityBigInt) {
|
|
1973
1957
|
throw new Error(
|
|
@@ -1983,24 +1967,12 @@ var _LIT_ACTION_ = (() => {
|
|
|
1983
1967
|
);
|
|
1984
1968
|
currentStep = "4b";
|
|
1985
1969
|
console.log("[Step 4b] Validating max supply limit...");
|
|
1986
|
-
const
|
|
1987
|
-
|
|
1988
|
-
chain,
|
|
1989
|
-
contractAddress: UCD_CONTROLLER_ADDRESS,
|
|
1990
|
-
abi: ABI_MAX_SUPPLY,
|
|
1991
|
-
methodName: "maxSupply",
|
|
1992
|
-
params: []
|
|
1993
|
-
});
|
|
1970
|
+
const ucdControllerMaxSupplyContract = new ethers.Contract(UCD_CONTROLLER_ADDRESS, ABI_MAX_SUPPLY, provider);
|
|
1971
|
+
const maxSupplyResult = await ucdControllerMaxSupplyContract.maxSupply();
|
|
1994
1972
|
const maxSupply = BigInt(maxSupplyResult.toString());
|
|
1995
1973
|
if (maxSupply > 0n) {
|
|
1996
|
-
const
|
|
1997
|
-
|
|
1998
|
-
chain,
|
|
1999
|
-
contractAddress: UCD_CONTROLLER_ADDRESS,
|
|
2000
|
-
abi: ABI_CURRENT_SUPPLY,
|
|
2001
|
-
methodName: "getCurrentSupply",
|
|
2002
|
-
params: []
|
|
2003
|
-
});
|
|
1974
|
+
const ucdControllerCurrentSupplyContract = new ethers.Contract(UCD_CONTROLLER_ADDRESS, ABI_CURRENT_SUPPLY, provider);
|
|
1975
|
+
const currentSupplyResult = await ucdControllerCurrentSupplyContract.getCurrentSupply();
|
|
2004
1976
|
const currentSupply = BigInt(currentSupplyResult.toString());
|
|
2005
1977
|
const projectedSupply = currentSupply + totalMintAmount;
|
|
2006
1978
|
if (projectedSupply > maxSupply) {
|