mirror of https://github.com/certusone/oyster.git
feat: change ownership of mem
This commit is contained in:
parent
a727c11b51
commit
390dea08a7
|
@ -31,6 +31,7 @@ export function createTempMemoryAccount(
|
||||||
instructions: TransactionInstruction[],
|
instructions: TransactionInstruction[],
|
||||||
payer: PublicKey,
|
payer: PublicKey,
|
||||||
signers: Account[],
|
signers: Account[],
|
||||||
|
owner: PublicKey,
|
||||||
space = DEFAULT_TEMP_MEM_SPACE
|
space = DEFAULT_TEMP_MEM_SPACE
|
||||||
) {
|
) {
|
||||||
const account = new Account();
|
const account = new Account();
|
||||||
|
@ -38,10 +39,10 @@ export function createTempMemoryAccount(
|
||||||
SystemProgram.createAccount({
|
SystemProgram.createAccount({
|
||||||
fromPubkey: payer,
|
fromPubkey: payer,
|
||||||
newAccountPubkey: account.publicKey,
|
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,
|
lamports: 0,
|
||||||
space: space,
|
space: space,
|
||||||
programId: TOKEN_PROGRAM_ID,
|
programId: owner,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ export const borrow = async (
|
||||||
? dexMarket?.info.asks
|
? dexMarket?.info.asks
|
||||||
: dexMarket?.info.bids;
|
: 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
|
// Creates host fee account if it doesn't exsist
|
||||||
let hostFeeReceiver = LEND_HOST_FEE_ADDRESS
|
let hostFeeReceiver = LEND_HOST_FEE_ADDRESS
|
||||||
|
|
|
@ -90,7 +90,7 @@ export const liquidate = async (
|
||||||
? dexMarket?.info.asks
|
? dexMarket?.info.asks
|
||||||
: dexMarket?.info.bids;
|
: dexMarket?.info.bids;
|
||||||
|
|
||||||
const memory = createTempMemoryAccount(instructions, wallet.publicKey, signers);
|
const memory = createTempMemoryAccount(instructions, wallet.publicKey, signers, LENDING_PROGRAM_ID);
|
||||||
|
|
||||||
instructions.push(
|
instructions.push(
|
||||||
liquidateInstruction(
|
liquidateInstruction(
|
||||||
|
|
Loading…
Reference in New Issue