Skip to content

Commit 86f5964

Browse files
authored
remove delete amm ixs (#2000)
1 parent 757f129 commit 86f5964

File tree

4 files changed

+40
-67
lines changed

4 files changed

+40
-67
lines changed

programs/drift/src/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,12 +1026,6 @@ pub mod drift {
10261026
handle_resize_amm_cache(ctx)
10271027
}
10281028

1029-
pub fn delete_amm_cache<'c: 'info, 'info>(
1030-
ctx: Context<'_, '_, 'c, 'info, DeleteAmmCache<'info>>,
1031-
) -> Result<()> {
1032-
handle_delete_amm_cache(ctx)
1033-
}
1034-
10351029
pub fn update_initial_amm_cache_info<'c: 'info, 'info>(
10361030
ctx: Context<'_, '_, 'c, 'info, UpdateInitialAmmCacheInfo<'info>>,
10371031
) -> Result<()> {

sdk/src/adminClient.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -736,9 +736,9 @@ export class AdminClient extends DriftClient {
736736
return await this.program.instruction.updateInitialAmmCacheInfo({
737737
accounts: {
738738
state: await this.getStatePublicKey(),
739-
admin: this.isSubscribed
740-
? this.getStateAccount().admin
741-
: this.wallet.publicKey,
739+
admin: this.useHotWalletAdmin
740+
? this.wallet.publicKey
741+
: this.getStateAccount().admin,
742742
ammCache: getAmmCachePublicKey(this.program.programId),
743743
},
744744
remainingAccounts,
@@ -796,9 +796,9 @@ export class AdminClient extends DriftClient {
796796
{
797797
accounts: {
798798
state: await this.getStatePublicKey(),
799-
admin: this.isSubscribed
800-
? this.getStateAccount().admin
801-
: this.wallet.publicKey,
799+
admin: this.useHotWalletAdmin
800+
? this.wallet.publicKey
801+
: this.getStateAccount().admin,
802802
ammCache: getAmmCachePublicKey(this.program.programId),
803803
},
804804
}
@@ -820,9 +820,9 @@ export class AdminClient extends DriftClient {
820820
return this.program.instruction.resetAmmCache({
821821
accounts: {
822822
state: await this.getStatePublicKey(),
823-
admin: this.isSubscribed
824-
? this.getStateAccount().admin
825-
: this.wallet.publicKey,
823+
admin: this.useHotWalletAdmin
824+
? this.wallet.publicKey
825+
: this.getStateAccount().admin,
826826
ammCache: getAmmCachePublicKey(this.program.programId),
827827
systemProgram: anchor.web3.SystemProgram.programId,
828828
},
@@ -5545,9 +5545,9 @@ export class AdminClient extends DriftClient {
55455545
{
55465546
accounts: {
55475547
constituent,
5548-
admin: this.isSubscribed
5549-
? this.getStateAccount().admin
5550-
: this.wallet.publicKey,
5548+
admin: this.useHotWalletAdmin
5549+
? this.wallet.publicKey
5550+
: this.getStateAccount().admin,
55515551
state: await this.getStatePublicKey(),
55525552
},
55535553
}
@@ -6435,9 +6435,9 @@ export class AdminClient extends DriftClient {
64356435
lpExchangeFeeExcluscionScalar ?? null,
64366436
{
64376437
accounts: {
6438-
admin: this.isSubscribed
6439-
? this.getStateAccount().admin
6440-
: this.wallet.publicKey,
6438+
admin: this.useHotWalletAdmin
6439+
? this.wallet.publicKey
6440+
: this.getStateAccount().admin,
64416441
state: await this.getStatePublicKey(),
64426442
perpMarket: this.getPerpMarketAccount(marketIndex).pubkey,
64436443
},
@@ -6466,9 +6466,9 @@ export class AdminClient extends DriftClient {
64666466
pausedOperations,
64676467
{
64686468
accounts: {
6469-
admin: this.isSubscribed
6470-
? this.getStateAccount().admin
6471-
: this.wallet.publicKey,
6469+
admin: this.useHotWalletAdmin
6470+
? this.wallet.publicKey
6471+
: this.getStateAccount().admin,
64726472
state: await this.getStatePublicKey(),
64736473
perpMarket: this.getPerpMarketAccount(marketIndex).pubkey,
64746474
},

sdk/src/idl/drift.json

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4484,27 +4484,6 @@
44844484
],
44854485
"args": []
44864486
},
4487-
{
4488-
"name": "deleteAmmCache",
4489-
"accounts": [
4490-
{
4491-
"name": "admin",
4492-
"isMut": true,
4493-
"isSigner": true
4494-
},
4495-
{
4496-
"name": "state",
4497-
"isMut": false,
4498-
"isSigner": false
4499-
},
4500-
{
4501-
"name": "ammCache",
4502-
"isMut": true,
4503-
"isSigner": false
4504-
}
4505-
],
4506-
"args": []
4507-
},
45084487
{
45094488
"name": "updateInitialAmmCacheInfo",
45104489
"accounts": [

tests/lpPool.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,26 +1734,26 @@ describe('LP Pool', () => {
17341734
}
17351735
});
17361736

1737-
it('can delete amm cache and then init and realloc and update', async () => {
1738-
const ammCacheKey = getAmmCachePublicKey(program.programId);
1739-
const ammCacheBefore = (await adminClient.program.account.ammCache.fetch(
1740-
ammCacheKey
1741-
)) as AmmCache;
1742-
1743-
await adminClient.deleteAmmCache();
1744-
await adminClient.initializeAmmCache();
1745-
await adminClient.resizeAmmCache();
1746-
await adminClient.updateInitialAmmCacheInfo([0, 1, 2]);
1747-
await adminClient.updateAmmCache([0, 1, 2]);
1748-
1749-
const ammCacheAfter = (await adminClient.program.account.ammCache.fetch(
1750-
ammCacheKey
1751-
)) as AmmCache;
1752-
1753-
for (let i = 0; i < ammCacheBefore.cache.length; i++) {
1754-
assert(
1755-
ammCacheBefore.cache[i].position.eq(ammCacheAfter.cache[i].position)
1756-
);
1757-
}
1758-
});
1737+
// it('can delete amm cache and then init and realloc and update', async () => {
1738+
// const ammCacheKey = getAmmCachePublicKey(program.programId);
1739+
// const ammCacheBefore = (await adminClient.program.account.ammCache.fetch(
1740+
// ammCacheKey
1741+
// )) as AmmCache;
1742+
1743+
// await adminClient.deleteAmmCache();
1744+
// await adminClient.initializeAmmCache();
1745+
// await adminClient.resizeAmmCache();
1746+
// await adminClient.updateInitialAmmCacheInfo([0, 1, 2]);
1747+
// await adminClient.updateAmmCache([0, 1, 2]);
1748+
1749+
// const ammCacheAfter = (await adminClient.program.account.ammCache.fetch(
1750+
// ammCacheKey
1751+
// )) as AmmCache;
1752+
1753+
// for (let i = 0; i < ammCacheBefore.cache.length; i++) {
1754+
// assert(
1755+
// ammCacheBefore.cache[i].position.eq(ammCacheAfter.cache[i].position)
1756+
// );
1757+
// }
1758+
// });
17591759
});

0 commit comments

Comments
 (0)