Skip to content

Commit

Permalink
feat: deposit boost support (#187)
Browse files Browse the repository at this point in the history
* prepare/write for `updateUserPointsInLoans` - used by script to
iterate through user loans and make sure the loan manager smart contract
is updated with the latest points (should be called before
`updateAccountsPointsForRewards`).
* prepare/write for `updateAccountsPointsForRewards` - reads the points
in the loan manager smart contract and records it to the rewardsV1
contract (should be called after `updateUserPointsInLoans `).
* prepare/write for `claimRewards` - claims the AVAX rewards earned from
past epochs
* read `activeEpochs` - returns the active epochs for each token/pool
* read `unclaimedRewards` - returns the rewards which have been earned
in past epochs and are ready to be claimed
* read `userPoints` - returns the user points were they to be updated
with `updateUserPointsInLoans`

---------

Co-authored-by: stefanofa <[email protected]>
Co-authored-by: palace22 <[email protected]>
  • Loading branch information
3 people authored Nov 15, 2024
1 parent 5f5b333 commit 97a19c3
Show file tree
Hide file tree
Showing 13 changed files with 1,297 additions and 25 deletions.
5 changes: 5 additions & 0 deletions .changeset/selfish-eggs-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@folks-finance/xchain-sdk": patch
---

deposit boost support
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ yarn-error.log*
# local env files
.env
.env*.local

# intellij
.idea
3 changes: 3 additions & 0 deletions src/chains/evm/common/constants/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ export const GAS_LIMIT_ESTIMATE_INCREASE = 10_000n;
export const SEND_TOKEN_ACTION_RETURN_GAS_LIMIT = 500_000n;
export const RECEIVER_VALUE_SLIPPAGE = 0.01;
export const RETRY_REVERSE_GAS_LIMIT_SLIPPAGE = 0.05;
export const UPDATE_USER_POINTS_IN_LOANS_GAS_LIMIT_SLIPPAGE = 0.1;
export const UPDATE_ACCOUNT_POINTS_FOR_REWARDS_GAS_LIMIT_SLIPPAGE = 0.01;
export const CLAIM_REWARDS_GAS_LIMIT_SLIPPAGE = 0;
18 changes: 17 additions & 1 deletion src/chains/evm/common/types/module.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { MessageReceived } from "./gmp.js";
import type { GenericAddress } from "../../../../common/types/address.js";
import type { EvmAddress, GenericAddress } from "../../../../common/types/address.js";
import type { AccountId } from "../../../../common/types/lending.js";
import type { MessageParams } from "../../../../common/types/message.js";
import type { SpokeTokenData } from "../../../../common/types/token.js";
import type { PoolEpoch } from "../../hub/types/rewards.js";
import type { Hex } from "viem";

export type PrepareCall = {
Expand Down Expand Up @@ -103,3 +104,18 @@ export type PrepareResendWormholeMessageCall = {
deliveryProviderAddress: GenericAddress;
wormholeRelayerAddress: GenericAddress;
} & Omit<PrepareCall, "messageParams">;

export type PrepareUpdateUserPointsInLoans = {
loanManagerAddress: GenericAddress;
} & Omit<PrepareCall, "messageParams" | "msgValue">;

export type PrepareUpdateAccountsPointsForRewardsCall = {
poolEpochs: Array<PoolEpoch>;
rewardsV1Address: GenericAddress;
} & Omit<PrepareCall, "messageParams" | "msgValue">;

export type PrepareClaimRewardsCall = {
poolEpochs: Array<PoolEpoch>;
receiver: EvmAddress;
rewardsV1Address: GenericAddress;
} & Omit<PrepareCall, "messageParams" | "msgValue">;
Loading

0 comments on commit 97a19c3

Please sign in to comment.