Skip to content

zap-in/out feature#44

Merged
ducquangkstn merged 5 commits into
developfrom
example-zapin
Nov 2, 2021
Merged

zap-in/out feature#44
ducquangkstn merged 5 commits into
developfrom
example-zapin

Conversation

@ducquangkstn

@ducquangkstn ducquangkstn commented Jun 28, 2021

Copy link
Copy Markdown
  • ropsten: 0x18f3a9D6263849475cBeC20B13718221725f2192
  • bsc testnet: 0x3A4185B6f76a4fbBa60B50dF4756bFF1339C0d9c

@ducquangkstn ducquangkstn marked this pull request as ready for review June 28, 2021 09:00
@ducquangkstn ducquangkstn force-pushed the example-zapin branch 2 times, most recently from 78618a8 to 602c33e Compare October 26, 2021 08:36
Comment thread contracts/periphery/ZapIn.sol Outdated
uint256 private constant PRECISION = 1e18;
uint256 internal constant Q112 = 2**112;

IDMMFactory public factory;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

immutable as well?

Comment thread contracts/periphery/ZapIn.sol Outdated
uint256 feeInPrecision,
uint256 userIn
) internal pure returns (uint256) {
require(feeInPrecision < PRECISION, "invalid feeInPrecision");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

not necessary IMO, can trust the pool.

Comment thread contracts/periphery/ZapIn.sol Outdated
}
uint256 inverseC = vIn.mul(userIn);
// numerator = sqrt(b^2 -4ac) - b
uint256 numerator = MathExt.sqrt(b.mul(b).add(inverseC.mul(4).mul(r) / PRECISION)).sub(b);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

can do inverseC.mul(4*r) since r <= PRECISION.

@ducquangkstn ducquangkstn changed the title add an example for zap-in zap-in/out feature Nov 1, 2021
@ducquangkstn ducquangkstn merged commit fedf30d into develop Nov 2, 2021
@ducquangkstn ducquangkstn deleted the example-zapin branch November 2, 2021 03:08
manhlx3006 added a commit that referenced this pull request Jun 14, 2022
* update env for matic, bsc and avax (#43)

* zap-in/out feature (#44)

* read function for zapOut (#46)

* Fix bug calculate zapOutAmount (#47)

* add rpc fantom (#45)

* remove_dynamic_fee -> Done (#48)

* remove_dynamic_fee -> Done

* fix bugs and add deployment script

* rename stuffs

* remove unused var

* move feeinPrecision to Factory and Rename DMM to KS

* rename DMM to KS

* remove dynamic fee, add fee options

* fix deployment script

* add modifier for checking fee setter

* Add KSRouter, change feeOptions to public, remove getFinalFee

* update hardhat config

* fix hardhat config

* add router test

* rename dmmSwapCall to ksSwapCall, add ZapInV2

* fix test

* rename deployKs to deployKyberSwap

Co-authored-by: Jensen Tran <jensen@kyber.network>

* Update minting fee formula for DAO (#49)

* Add a new 0.008% fee option (#52)

* Mutiply the fee options by 10 times

* Add tests for changing BPS and add a new feeOption

* Add FEE_UNITS

* Update _mintFee func

* Fix overflow in minting fee formula (#51)

* Fix overflow mul div

Co-authored-by: quang_neo <ducquang.kstn@gmail.com>
Co-authored-by: Vu Tran <vutt94@gmail.com>
Co-authored-by: Jensen Tran <jensen@kyber.network>
Co-authored-by: Nguyen Minh Quan <30571817+minhquanym@users.noreply.github.com>
Co-authored-by: Daniel Pham <daniel.pham765@gmail.com>
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