Skip to content

Commit

Permalink
fix PACT airdrop + update loan manager comments + v4.0.3 (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernardo Vieira authored Jul 18, 2023
1 parent 3f57c06 commit 68de367
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@impact-market/utils",
"version": "4.0.2",
"version": "4.0.3",
"description": "impactMarket utils",
"repository": {
"type": "git",
Expand Down
9 changes: 8 additions & 1 deletion src/useAirdropRecurring.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,14 @@ export const useAirdropRecurring = (airdropSmartContractAddress: string) => {

setAmountClaimed(toNumber(claimedAmount));
if (lastClaimTime.toNumber() !== 0) {
setNextClaim(new Date((lastClaimTime.toNumber() + cooldown.toNumber()) * 1000));
const next = new Date((lastClaimTime.toNumber() + cooldown.toNumber()) * 1000);

if (next.getTime() < new Date().getTime()) {
setNextClaim(new Date(0));

return;
}
setNextClaim(next);
_startUpdateInterval(address, lastClaimTime.toNumber(), cooldown.toNumber());
} else {
setNextClaim(new Date(0));
Expand Down
8 changes: 4 additions & 4 deletions src/useLoanManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ export const useLoanManager = () => {
* Add loans
* @param {string[]} userAddresses addresses to add loans to
* @param {number[]} amounts amount of each loan
* @param {number[]} periods periods of each loan
* @param {number[]} periods periods of each loan, in seconds
* @param {number[]} dailyInterests daily interests of each loan
* @param {number[]} startDates start dates of each loan
* @param {number[]} claimDeadlines claim deadline of each loan (timestamp in seconds)
* @returns {Promise<TransactionReceipt>} tx details
*/
const addLoans = async (
userAddresses: string[],
amounts: number[],
periods: number[],
dailyInterests: number[],
startDates: number[]
claimDeadlines: number[]
) => {
if (!address || !signer) {
throw new Error('No wallet connected');
Expand All @@ -34,7 +34,7 @@ export const useLoanManager = () => {
amounts.map(amount => toToken(amount)),
periods,
dailyInterests.map(interest => toToken(interest)),
startDates
claimDeadlines
);
const response = await executeTransaction(tx);

Expand Down

0 comments on commit 68de367

Please sign in to comment.