Skip to content

Conversation

@MattPereira
Copy link
Member

@MattPereira MattPereira commented Sep 11, 2025

source logic for init amounts ratio:

function getProportionOfTokens(alpha, beta, s, c, lambda, spotPrice, rateA, rateB) {
    const soptPriceWithoutRate = spotPrice * rateB / rateA;
    const rHint = 1000;
    const tauAlpha = getTau(alpha, c, s, lambda);
    const tauBeta = getTau(beta, c, s, lambda);
    const tauSpotPrice = getTau(soptPriceWithoutRate, c, s, lambda);

    const amountTokenA = rateA * rHint * (c * lambda * tauBeta[0] + s * tauBeta[1]) - (c * lambda * tauSpotPrice[0] + s * tauSpotPrice[1])
    const amountTokenB = rateB * rHint * (-s * lambda * tauAlpha[0] + c * tauAlpha[1]) - (-s * lambda * tauSpotPrice[0] + c * tauSpotPrice[1])

    return amountTokenA / amountTokenB;
}

function getTau(price, c, s, lambda) {
    return [price * c / (1 - s), (c + (s * price)) / lambda];
}
image

@vercel
Copy link

vercel bot commented Sep 11, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
pool-creator Ready Ready Preview Comment Sep 11, 2025 6:30pm

@MattPereira MattPereira merged commit cec094a into main Sep 11, 2025
3 checks passed
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