For geeks who like to climb under the hood and double-check everything by hand, the formulas below are presented:

CalculatePurchaseReturn

Number of coins (s), current reserve in DEL (r), CRR (c) and number of coins to be purchased (d). The result is the amount of DEL spent on buying the coin:

return s * ((1 + d / r) ^ c - 1);

CalculateSaleReturn

Number of coins (s), current reserve in DEL (r), CRR (c) and number of coins for sale (a). As a result, the number of DELs received from the sale of coins:

return r * (1 - (1 - a / s) ^ (1 / c));

Where is the formula for exchanging one coin for another? it doesn't exist. All calculations are made in relation to the base coin - DEL.