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

Migrate to cw-assets v3 and cw-storage-plus v1.2.0 #5

Merged
merged 5 commits into from
Jun 10, 2024
Merged

Conversation

kerber0x
Copy link
Contributor

This PR upgrades the cw-assets and cw-storage-plus dependencies of the alliance-hub contract in preparation to tweaks for eris' ve3-contracts.

@kerber0x kerber0x requested a review from 0xFable June 10, 2024 14:09
Copy link
Contributor

@0xFable 0xFable left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking pretty good. I have some concerns of not using AssetKey anymore but maybe that is a requirement for moving to cw-assets v3

WHITELIST
.load(deps.storage, asset_key.clone())
.load(deps.storage, &asset)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we not keep the AssetInfoKey ?
To be fair it is just a type overwriting a type but how do you feel

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AssetInfoKey does not exist in cw-assets v3, that's the whole point of this migration, should probably have mentioned it above

let total_reward_distributed = Decimal::from_atomics(rewards_collected, 0)?
* asset_distribution.distribution
/ total_distribution;

// If there are no balances, we stop updating the rate. This means that the emissions are not directed to any stakers.
let total_balance = TOTAL_BALANCES
.load(deps.storage, asset_key.clone())
.load(deps.storage, &asset_distribution.asset)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double check but maybe this causes migrations. If not then I am happy with it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all of it causes migrations 😅

}

fn migrate_whitelist_map(deps: DepsMut) -> Result<(), ContractError> {
const OLD_WHITELIST: Map016<cw_asset_v2::AssetInfoKey, ChainId> = Map016::new("whitelist");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does cw_asset_v3 not have an assetKey?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct

@kerber0x kerber0x merged commit 2d8bb51 into main Jun 10, 2024
1 of 2 checks passed
@kerber0x kerber0x deleted the feat/v3-tweaks branch June 10, 2024 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants