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

[NTRN-94] feat: add registry migration #197

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions contracts_migrate/additional/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Additional contracts used in scope of migration:

- `lockdrop_vault_for_cl_pools.wasm` — https://github.com/neutron-org/neutron-dao/pull/71 0edde36c67f4c9c96b68b4fa915003071070300a;
- `vesting_lp_vault_for_cl_pools.wasm` — https://github.com/neutron-org/neutron-dao/pull/71 0edde36c67f4c9c96b68b4fa915003071070300a.
Binary file not shown.
Binary file not shown.
5 changes: 5 additions & 0 deletions contracts_migrate/current/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Contract versions currently deployed on Neutron mainnet. Retrieved for each contract to be migrated via:

1. Get contract address from [Mainnet deployments page](https://docs.neutron.org/deployment/mainnet/);
2. Run `neutrond q wasm contract <addr>` for a mainnet node, get the `contract_info.code_id` value;
3. Run `neutrond q wasm code <code_id> <binary_name.wasm>` for a mainnet node.
Binary file not shown.
Binary file added contracts_migrate/current/vesting_lp.wasm
Binary file not shown.
5 changes: 5 additions & 0 deletions contracts_migrate/new/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Contract versions to be migrated to. Origins:

- `neutron_lockdrop.wasm` — https://github.com/neutron-org/neutron-tge-contracts/pull/51 201126859f2e03b2da814efe8e9dea6c680fbfaa;
- `neutron_voting_registry.wasm` — https://github.com/neutron-org/neutron-dao/pull/75 1d90c078bf277126fb1fc415bc6dc9ab3b4f8e89;
- `vesting_lp.wasm` — https://github.com/neutron-org/neutron-tge-contracts/pull/51 201126859f2e03b2da814efe8e9dea6c680fbfaa.
Binary file added contracts_migrate/new/neutron_lockdrop.wasm
Binary file not shown.
Binary file not shown.
Binary file added contracts_migrate/new/vesting_lp.wasm
Binary file not shown.
24 changes: 18 additions & 6 deletions src/helpers/dao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,22 +392,34 @@ export class Dao {
);
}

async queryTotalVotingPower(): Promise<TotalPowerAtHeightResponse> {
async queryTotalVotingPower(
height?: number,
): Promise<TotalPowerAtHeightResponse> {
return await this.chain.queryContract<TotalPowerAtHeightResponse>(
this.contracts.core.address,
{
total_power_at_height: {},
total_power_at_height:
typeof height === 'undefined' ? {} : { height: height },
},
);
}

async queryVotingPower(addr: string): Promise<VotingPowerAtHeightResponse> {
async queryVotingPower(
addr: string,
height?: number,
): Promise<VotingPowerAtHeightResponse> {
return await this.chain.queryContract<VotingPowerAtHeightResponse>(
this.contracts.core.address,
{
voting_power_at_height: {
address: addr,
},
voting_power_at_height:
typeof height === 'undefined'
? {
address: addr,
}
: {
address: addr,
height: height,
},
},
);
}
Expand Down
16 changes: 7 additions & 9 deletions src/helpers/tge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ export class Tge {
priceFeed: string;
coinRegistry: string;
astroFactory: string;
astroFactoryCL: string;
vestingAtomLp: string;
vestingUsdcLp: string;
vestingLpVault: string;
Expand Down Expand Up @@ -198,8 +197,8 @@ export class Tge {
for (const contract of [
'TGE_CREDITS',
'TGE_AUCTION',
'TGE_LOCKDROP',
'TGE_LOCKDROP_V2',
'TGE_LOCKDROP_CURRENT',
'TGE_LOCKDROP_NEW',
'TGE_AIRDROP',
'TGE_PRICE_FEED_MOCK',
'ASTRO_PAIR',
Expand All @@ -212,12 +211,11 @@ export class Tge {
'ASTRO_VESTING',
'ASTRO_COIN_REGISTRY',
'VESTING_LP',
'VESTING_LP_V2',
'VESTING_LP_CURRENT',
'VESTING_LP_NEW',
'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 @@ -379,13 +377,13 @@ export class Tge {

this.contracts.vestingAtomLp = await instantiateVestingLp(
this.instantiator,
this.codeIds.VESTING_LP,
this.codeIds.VESTING_LP_CURRENT,
this.tokenInfoManager.wallet.address.toString(),
'vesting_atom_lp',
);
this.contracts.vestingUsdcLp = await instantiateVestingLp(
this.instantiator,
this.codeIds.VESTING_LP,
this.codeIds.VESTING_LP_CURRENT,
this.tokenInfoManager.wallet.address.toString(),
'vesting_usdc_lp',
);
Expand Down Expand Up @@ -437,7 +435,7 @@ export class Tge {
async deployLockdrop() {
this.contracts.lockdrop = await instantiateLockdrop(
this.instantiator,
this.codeIds.TGE_LOCKDROP,
this.codeIds.TGE_LOCKDROP_CURRENT,
null,
this.tokenInfoManager.wallet.address.toString(),
this.contracts.credits,
Expand Down
26 changes: 18 additions & 8 deletions src/helpers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,15 @@ export const NeutronContract = {
'cwd_subdao_pre_propose_single_no_timelock.wasm',
SUBDAO_PROPOSAL: 'cwd_subdao_proposal_single.wasm',
SUBDAO_TIMELOCK: 'cwd_subdao_timelock_single.wasm',
LOCKDROP_VAULT: '../contracts_thirdparty/lockdrop_vault.wasm',
LOCKDROP_VAULT_V2: 'lockdrop_vault.wasm',
LOCKDROP_VAULT: 'lockdrop_vault.wasm',
ORACLE_HISTORY: 'astroport_oracle.wasm',
TGE_CREDITS: 'credits.wasm',
TGE_AIRDROP: 'cw20_merkle_airdrop.wasm',
CW4_VOTING: '../contracts_thirdparty/cw4_voting.wasm',
CW4_GROUP: '../contracts_thirdparty/cw4_group.wasm',
CW20_BASE: '../contracts_thirdparty/cw20_base.wasm',
TGE_AUCTION: 'neutron_auction.wasm',
TGE_LOCKDROP: '../contracts_thirdparty/neutron_lockdrop.wasm',
TGE_LOCKDROP_V2: 'neutron_lockdrop.wasm',
TGE_LOCKDROP: 'neutron_lockdrop.wasm',
TGE_PRICE_FEED_MOCK: 'neutron_price_feed_mock.wasm',
ASTRO_PAIR: '../contracts_thirdparty/astroport_pair.wasm',
ASTRO_PAIR_CL: '../contracts_thirdparty/astroport_pair_concentrated.wasm',
Expand All @@ -152,14 +150,26 @@ export const NeutronContract = {
ASTRO_GENERATOR: '../contracts_thirdparty/astroport_generator.wasm',
ASTRO_WHITELIST: '../contracts_thirdparty/astroport_whitelist.wasm',
ASTRO_VESTING: '../contracts_thirdparty/astroport_vesting.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',
VESTING_LP: 'vesting_lp.wasm',
VESTING_LP_VAULT: 'vesting_lp_vault.wasm',
CREDITS_VAULT: 'credits_vault.wasm',
VESTING_INVESTORS: 'vesting_investors.wasm',
INVESTORS_VESTING_VAULT: 'investors_vesting_vault.wasm',
TOKENFACTORY: 'tokenfactory.wasm',

// contracts involved in migration
VOTING_REGISTRY_CURRENT:
'../contracts_migrate/current/neutron_voting_registry.wasm',
VOTING_REGISTRY_NEW: '../contracts_migrate/new/neutron_voting_registry.wasm',
TGE_LOCKDROP_CURRENT: '../contracts_migrate/current/neutron_lockdrop.wasm',
TGE_LOCKDROP_NEW: '../contracts_migrate/new/neutron_lockdrop.wasm',
VESTING_LP_CURRENT: '../contracts_migrate/current/vesting_lp.wasm',
VESTING_LP_NEW: '../contracts_migrate/new/vesting_lp.wasm',

LOCKDROP_VAULT_CL:
'../contracts_migrate/additional/lockdrop_vault_for_cl_pools.wasm',
VESTING_LP_VAULT_CL:
'../contracts_migrate/additional/vesting_lp_vault_for_cl_pools.wasm',
};

export type MultiChoiceOption = {
Expand Down
Loading