Skip to content

Commit

Permalink
feat(update lm flow): replace anchor with spl (#7) (solana-labs#1073)
Browse files Browse the repository at this point in the history
  • Loading branch information
EvgeniiVoznyuk committed Oct 4, 2022
1 parent 06e6fa3 commit 654dc55
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 77 deletions.
20 changes: 3 additions & 17 deletions Strategies/protocols/everlend/depositTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import {
REGISTRY_MAIN,
REWARD_PROGRAM_ID,
} from './constants'
import { getInitMiningTx } from './useRewardProgram'
import { getInitMiningTx } from './useInitMining'
import { SignerWalletAdapter } from '@solana/wallet-adapter-base'
import { syncNative } from '@solendprotocol/solend-sdk'

Expand Down Expand Up @@ -148,8 +148,6 @@ export const prepareSolDepositTx = async (
poolMint,
rewardPool,
rewardAccount,
config,
rewardProgramId,
poolMarketAuthority,
amount,
}
Expand Down Expand Up @@ -333,16 +331,8 @@ export async function handleEverlendDeposit(
rewardAccount
)

if (!rewardAccountInfo && rewardPoolInfo?.data) {
const initTx = await getInitMiningTx(
rewardPool,
rewardAccount,
wallet.publicKey!,
owner,
connection,
wallet,
CONFIG
)
if (!rewardAccountInfo && rewardPoolInfo?.data && wallet.publicKey) {
const initTx = await getInitMiningTx(owner, connection.current, rewardPool)
initMiningTx.add(initTx)
prerequisiteInstructions.push(...initTx.instructions)
}
Expand All @@ -366,8 +356,6 @@ export async function handleEverlendDeposit(
{ connection: connection.current, payerPublicKey: owner },
new PublicKey(poolPubKey),
amount,
REWARD_PROGRAM_ID,
CONFIG,
rewardPool,
rewardAccount,
source
Expand Down Expand Up @@ -398,8 +386,6 @@ export async function handleEverlendWithdraw(
},
new PublicKey(poolPubKey),
amount,
REWARD_PROGRAM_ID,
CONFIG,
rewardPool,
rewardAccount,
source,
Expand Down
21 changes: 21 additions & 0 deletions Strategies/protocols/everlend/useInitMining.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Connection, PublicKey, Transaction } from '@solana/web3.js'
import { prepareInititalizeMining } from '@everlend/general-pool'

const getInitMiningTx = async (
walletPubKey: PublicKey,
connection: Connection,
rewardPool: PublicKey
): Promise<Transaction> => {
const tx = new Transaction()
if (!walletPubKey) return tx
const { tx: initMiningTx } = await prepareInititalizeMining(
{ payerPublicKey: walletPubKey, connection },
rewardPool
)

tx.add(initMiningTx)

return tx
}

export { getInitMiningTx }
59 changes: 0 additions & 59 deletions Strategies/protocols/everlend/useRewardProgram.ts

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@emotion/react": "^11.9.0",
"@emotion/styled": "^11.8.1",
"@everlend/core": "^0.0.6",
"@everlend/general-pool": "^0.0.23",
"@everlend/general-pool": "^0.0.27",
"@foresight-tmp/foresight-sdk": "^0.1.46",
"@friktion-labs/friktion-sdk": "^1.1.118",
"@headlessui/react": "^1.6.6",
Expand Down

0 comments on commit 654dc55

Please sign in to comment.