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

native splitter #102

Merged
merged 5 commits into from
Sep 5, 2023
Merged

native splitter #102

merged 5 commits into from
Sep 5, 2023

Conversation

bekauz
Copy link
Collaborator

@bekauz bekauz commented Aug 21, 2023

base implementation for #91
to be reviewed after #98 is merged

at the moment the split configuration expects all receiver shares to add up to 100 (indicating percentages). feels like this can be simplified to take in arbitrary amounts that would get converted to fractions relative to inputs. e.g.: given three receivers with shares of (20, 30, 10) that add up to 60, we would be looking at a split of (20/60, 30/60, 10/60). wasn't sure if it's the right move yet so keeping it open for future.

@bekauz bekauz requested a review from Art3miX August 21, 2023 13:28
@bekauz bekauz mentioned this pull request Aug 25, 2023
Copy link
Collaborator

@Art3miX Art3miX left a comment

Choose a reason for hiding this comment

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

Regarding the precision of the % we want, right now you only handle rounded % (50%, 51%, 25%), but there might be cases where we want a fractioned % (33.33%, 12.5%), in that case we better move to a BPS system.

I think we should stick with 100%, and not complicate it further.

contracts/native-splitter/src/contract.rs Outdated Show resolved Hide resolved
}

impl NativeDenomSplit {
pub fn validate(self) -> Result<NativeDenomSplit, StdError> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Dont forget to confirm that the denoms are the same as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So in here it handles multiple denoms with their individual splits:

pub struct NativeDenomSplit {
    /// denom to be distributed
    pub denom: String,
    /// denom receivers and their respective shares
    pub receivers: Vec<SplitReceiver>,
}

Though now that I think of it, a good validation is to make sure that there are no two NativeDenomSplits with the same denom. Will add.

pub enum ExecuteMsg {}

#[cw_serde]
pub struct SplitConfigMap {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Map that maps denoms to vec of receivers with their shares for that denom. Added a comment.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Are you using that? Seems like theres a state with same name?

@bekauz bekauz merged commit 47e0bf9 into v2 Sep 5, 2023
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.

3 participants