Skip to content

Commit

Permalink
Fixes for 138
Browse files Browse the repository at this point in the history
  • Loading branch information
ChewingGlass committed Dec 13, 2024
1 parent d3ffe52 commit cbba212
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
17 changes: 6 additions & 11 deletions packages/helium-admin-cli/src/migrate-to-hip-138.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
import * as anchor from "@coral-xyz/anchor";
import { init as initLazy } from "@helium/lazy-distributor-sdk";
import { ThresholdType } from "@helium/circuit-breaker-sdk";
import {
daoKey,
delegatorRewardsPercent,
init as initHsd,
subDaoKey,
init as initHsd
} from "@helium/helium-sub-daos-sdk";
import { init as initLazy, lazyDistributorKey } from "@helium/lazy-distributor-sdk";
import { organizationKey } from "@helium/organization-sdk";
import { oracleSignerKey } from "@helium/rewards-oracle-sdk";
import {
batchParallelInstructionsWithPriorityFee,
HNT_MINT,
IOT_MINT,
MOBILE_MINT,
} from "@helium/spl-utils";
import { getAssociatedTokenAddressSync } from "@solana/spl-token";
import { PublicKey, TransactionInstruction } from "@solana/web3.js";
import Squads from "@sqds/sdk";
import os from "os";
import { organizationKey } from "@helium/organization-sdk";
import yargs from "yargs/yargs";
import {
loadKeypair,
parseEmissionsSchedule,
sendInstructionsOrSquads,
} from "./utils";
import { lazyDistributorKey } from "@helium/lazy-distributor-sdk";
import { ThresholdType } from "@helium/circuit-breaker-sdk";
import { oracleSignerKey } from "@helium/rewards-oracle-sdk";
import { getAssociatedTokenAddressSync } from "@solana/spl-token";

export async function run(args: any = process.argv) {
const yarg = yargs(args).options({
Expand Down Expand Up @@ -100,8 +98,6 @@ export async function run(args: any = process.argv) {

const instructions: TransactionInstruction[] = [];

const iotMint = new PublicKey(argv.iotMint);
const mobileMint = new PublicKey(argv.mobileMint);
const hntMint = new PublicKey(argv.hntMint);
const dao = daoKey(hntMint)[0];

Expand Down Expand Up @@ -138,7 +134,6 @@ export async function run(args: any = process.argv) {
);

const ld = lazyDistributorKey(hntMint)[0];
const rewardsEscrow = getAssociatedTokenAddressSync(hntMint, ld, true);
const ldAcc = await lazyDistProgram.account.lazyDistributorV0.fetchNullable(
ld
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ pub struct TempResizeAccount<'info> {

pub fn handler(ctx: Context<TempResizeAccount>) -> Result<()> {
let account = &mut ctx.accounts.account;
let new_size = account.data_len() + std::mem::size_of::<RecentProposal>() * 4;
let mut new_size = account.data_len() + std::mem::size_of::<RecentProposal>() * 4;
// This is the dao account.
if account.key() == Pubkey::from_str("BQ3MCuTT5zVBhNfQ4SjMh3NPVhFy73MPV8rjfq5d1zie").unwrap() {
new_size += 104; // Add space for rewards_escrow, delegator_pool, delegator_rewards_percent, proposal_namespace
}
let rent = Rent::get()?;
let new_minimum_balance = rent.minimum_balance(new_size);
let lamports_diff = new_minimum_balance.saturating_sub(account.to_account_info().lamports());
Expand Down

0 comments on commit cbba212

Please sign in to comment.