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

Make swap fees inclusive #32

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

marco-sundsk
Copy link
Contributor

  • Put exchange_fee and referral_fee, as ratios, include in the pool fee.

    Apply this info:

    pub struct InternalFeesRatio {
        /// Portion (bps) of the fee going to exchange in total fee.
        pub exchange_fee: u32,
        /// Portion (bps) of the fee going to referral in total fee.
        pub referral_fee: u32,
    }

    when initial contract, and it can be changed by owner of this contract, normally a DAO, using interface:

    pub fn set_fee_policy(&mut self, fee_policy: InternalFeesRatio);

    In this way, when create pool, the fee param would be the total fee in bps. Exchange_fee and Referral_fee are charge from that total fee according to the bps value assigned in InternalFeesRatio.

  • Cause storage changed, a migration is needed.

  • provide a new view function to get contract meta info in one shot:

    pub struct Metadata {
        pub version: String,
        pub owner_id: AccountId,
        pub pool_count: U64,
        pub whitelist_count: U64,
        pub fee_policy: InternalFeesRatio,
    }
    pub fn get_metadata(&self) -> Metadata;

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.

1 participant