feat: change ownership of mem

This commit is contained in:
bartosz-lipinski 2021-01-06 21:26:20 -06:00
parent a727c11b51
commit 390dea08a7
3 changed files with 5 additions and 4 deletions

View File

@ -31,6 +31,7 @@ export function createTempMemoryAccount(
instructions: TransactionInstruction[],
payer: PublicKey,
signers: Account[],
owner: PublicKey,
space = DEFAULT_TEMP_MEM_SPACE
) {
const account = new Account();
@ -38,10 +39,10 @@ export function createTempMemoryAccount(
SystemProgram.createAccount({
fromPubkey: payer,
newAccountPubkey: account.publicKey,
// 0 will evict/clost account since it cannot pay rent
// 0 will evict/close account since it cannot pay rent
lamports: 0,
space: space,
programId: TOKEN_PROGRAM_ID,
programId: owner,
})
);

View File

@ -170,7 +170,7 @@ export const borrow = async (
? dexMarket?.info.asks
: dexMarket?.info.bids;
const memory = createTempMemoryAccount(instructions, wallet.publicKey, signers);
const memory = createTempMemoryAccount(instructions, wallet.publicKey, signers, LENDING_PROGRAM_ID);
// Creates host fee account if it doesn't exsist
let hostFeeReceiver = LEND_HOST_FEE_ADDRESS

View File

@ -90,7 +90,7 @@ export const liquidate = async (
? dexMarket?.info.asks
: dexMarket?.info.bids;
const memory = createTempMemoryAccount(instructions, wallet.publicKey, signers);
const memory = createTempMemoryAccount(instructions, wallet.publicKey, signers, LENDING_PROGRAM_ID);
instructions.push(
liquidateInstruction(