Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/xyk cl lp migration #171

Merged
merged 11 commits into from
Aug 21, 2023
Binary file added contracts_thirdparty/astroport_xastro_token.wasm
Binary file not shown.
Binary file added contracts_thirdparty/lockdrop_vault.wasm
Binary file not shown.
Binary file added contracts_thirdparty/vesting_lp.wasm
Binary file not shown.
Binary file added contracts_thirdparty/vesting_lp_vault.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion src/helpers/cosmos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ export class WalletWrapper {
contract: string,
msg: string,
funds: proto.cosmos.base.v1beta1.ICoin[] = [],
fee: proto.cosmos.tx.v1beta1.IFee = {
fee = {
gas_limit: Long.fromString('4000000'),
amount: [{ denom: this.chain.denom, amount: '10000' }],
},
Expand Down
103 changes: 102 additions & 1 deletion src/helpers/tge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
vestingAccount,
vestingSchedule,
vestingSchedulePoint,
VotingPowerAtHeightResponse,
} from './types';
import {
CreditsVaultConfig,
Expand Down Expand Up @@ -118,6 +119,10 @@ export class Tge {
atom_ntrn: { contract: string; liquidity: string };
usdc_ntrn: { contract: string; liquidity: string };
};
old_pairs: {
atom_ntrn: { contract: string; liquidity: string };
usdc_ntrn: { contract: string; liquidity: string };
};
times: Record<string, number>;
lockdropVaultName: string;
lockdropVaultDescription: string;
Expand Down Expand Up @@ -201,14 +206,18 @@ export class Tge {
'ASTRO_PAIR_CL',
'ASTRO_FACTORY',
'ASTRO_TOKEN',
'ASTRO_XASTRO_TOKEN',
'ASTRO_GENERATOR',
'ASTRO_WHITELIST',
'ASTRO_VESTING',
'ASTRO_COIN_REGISTRY',
'VESTING_LP',
'VESTING_LP_V2',
'LOCKDROP_VAULT',
'LOCKDROP_VAULT_V2',
'CREDITS_VAULT',
'VESTING_LP_VAULT',
'VESTING_LP_VAULT_V2',
'ORACLE_HISTORY',
]) {
const codeId = await this.instantiator.storeWasm(
Expand Down Expand Up @@ -278,7 +287,7 @@ export class Tge {
xyk: this.codeIds.ASTRO_PAIR,
concentrated: this.codeIds.ASTRO_PAIR_CL,
},
this.codeIds.ASTRO_TOKEN,
this.codeIds.ASTRO_XASTRO_TOKEN,
this.contracts.coinRegistry,
);

Expand Down Expand Up @@ -615,6 +624,35 @@ export class Tge {
usdcNtrnLpTokenBalance: +usdcNtrnLpTokenBalance.balance,
};
}
/**
* retrieves user's voting power from lp vault.
*/
async lpVotingPower(user: string): Promise<VotingPowerAtHeightResponse> {
return await this.chain.queryContract<VotingPowerAtHeightResponse>(
this.contracts.vestingLpVault,
{
voting_power_at_height: {
address: user,
},
},
);
}

/**
* retrieves user's voting power from lockdrop vault.
*/
async lockdropVotingPower(
user: string,
): Promise<VotingPowerAtHeightResponse> {
return await this.chain.queryContract<VotingPowerAtHeightResponse>(
this.contracts.lockdropVault,
{
voting_power_at_height: {
address: user,
},
},
);
}
}

export const instantiateAuction = async (
Expand Down Expand Up @@ -1098,6 +1136,10 @@ export type PairInfo = {
pair_type: Record<string, object>;
};

export type RewardInfoResponse = {
base_reward_token: string;
};

export type FactoryPairsResponse = {
pairs: PairInfo[];
};
Expand All @@ -1110,6 +1152,65 @@ export const queryFactoryPairs = async (
pairs: {},
});

export const queryTotalUnclaimedAmountAtHeight = async (
chain: CosmosWrapper,
address: string,
height: number,
) =>
chain.queryContract<string>(address, {
historical_extension: {
msg: {
unclaimed_total_amount_at_height: {
height: height,
},
},
},
});

export const queryNtrnCLBalanceAtHeight = async (
chain: CosmosWrapper,
address: string,
height: string,
) =>
chain.queryContract<string>(address, {
asset_balance_at: {
asset_info: {
native_token: {
denom: 'untrn',
},
},
block_height: height,
},
});

export const queryUnclaimmedAmountAtHeight = async (
chain: CosmosWrapper,
address: string,
height: number,
user: string,
) =>
chain.queryContract<string>(address, {
historical_extension: {
msg: {
unclaimed_amount_at_height: {
address: user,
height: height,
},
},
},
});

export const queryAvialableAmount = async (
chain: CosmosWrapper,
address: string,
user: string,
) =>
chain.queryContract<string>(address, {
available_amount: {
address: user,
},
});

export const instantiateAstroVesting = async (
cm: WalletWrapper,
codeId: CodeId,
Expand Down
10 changes: 7 additions & 3 deletions src/helpers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ export const NeutronContract = {
SUBDAO_PREPROPOSE: 'cwd_subdao_pre_propose_single.wasm',
SUBDAO_PROPOSAL: 'cwd_subdao_proposal_single.wasm',
SUBDAO_TIMELOCK: 'cwd_subdao_timelock_single.wasm',
LOCKDROP_VAULT: 'lockdrop_vault.wasm',
LOCKDROP_VAULT: '../contracts_thirdparty/lockdrop_vault.wasm',
LOCKDROP_VAULT_V2: 'lockdrop_vault.wasm',
ORACLE_HISTORY: 'astroport_oracle.wasm',
TGE_CREDITS: 'credits.wasm',
TGE_AIRDROP: 'cw20_merkle_airdrop.wasm',
Expand All @@ -142,11 +143,14 @@ export const NeutronContract = {
'../contracts_thirdparty/astroport_native_coin_registry.wasm',
ASTRO_FACTORY: '../contracts_thirdparty/astroport_factory.wasm',
ASTRO_TOKEN: '../contracts_thirdparty/astroport_token.wasm',
ASTRO_XASTRO_TOKEN: '../contracts_thirdparty/astroport_xastro_token.wasm',
ASTRO_GENERATOR: '../contracts_thirdparty/astroport_generator.wasm',
ASTRO_WHITELIST: '../contracts_thirdparty/astroport_whitelist.wasm',
ASTRO_VESTING: '../contracts_thirdparty/astroport_vesting.wasm',
VESTING_LP: 'vesting_lp.wasm',
VESTING_LP_VAULT: 'vesting_lp_vault.wasm',
VESTING_LP: '../contracts_thirdparty/vesting_lp.wasm',
VESTING_LP_V2: 'vesting_lp.wasm',
VESTING_LP_VAULT: '../contracts_thirdparty/vesting_lp_vault.wasm',
VESTING_LP_VAULT_V2: 'vesting_lp_vault.wasm',
CREDITS_VAULT: 'credits_vault.wasm',
VESTING_INVESTORS: 'vesting_investors.wasm',
INVESTORS_VESTING_VAULT: 'investors_vesting_vault.wasm',
Expand Down
Loading