bnb-chain/eth-bsc-swap-contracts
Fork: 93 Star: 64 (更新于 2024-10-18 05:20:58)
license: 暂无
Language: Solidity .
最后发布版本: v1.0.0 ( 2021-02-26 11:11:11)
ETH BSC Swap Contracts
Security Report
Overview
ETH BSC Swap Contracts are responsible for registering swap pairs and swapping assets between ETH and BSC.
Register swap pair
-
Users register swap pair for erc20 token on ETH via ETHSwapAgent(
createSwapPair
) if token is not registered. -
Swap service will monitor the
SwapPairRegister
event and create swap pair on BSC:- create an BEP20 token on BSC
- record the relation between erc20 token and bep20 token.
Swap from ETH to BSC
Once swap pair is registered, users can swap tokens from ETH to BSC.
- Users call
swapBSC2ETH
via ETHSwapAgent and specify erc20 token address, amount and swap fee. - Swap service will monitor the
SwapStarted
event and callfillETH2BSCSwap
via BSCSwapAgent to mint corresponding bep20 tokens to the same address that initiate the swap.
Swap from BSC to ETH
Once swap pair is registered, users can swap tokens from BSC to ETH.
- Users call
swapBSC2ETH
via BSCSwapAgent and specify bep20 token address, amount and swap fee. Bep20 tokens will be burned. - Swap service will monitor the
SwapStarted
event and callfillBSC2ETHSwap
via BSCSwapAgent to transfer corresponding erc20 tokens to the same address that initiate the swap.
Generate contracts from templates
npm run generate
Test
Generate test contracts from templates:
npm run generate-test
Run tests:
npm run truffle:test
Run coverage:
npm run coverage
bnb-chain/eth-bsc-swap-contracts同语言 Solidity最近更新仓库
2024-10-03 22:56:46 OpenZeppelin/openzeppelin-contracts
2024-08-28 00:31:10 Uniswap/UniswapX
2024-07-26 11:31:29 bnb-chain/bsc-genesis-contract
2024-02-23 01:47:34 eth-infinitism/account-abstraction
1970-01-01 00:00:00 Vectorized/solady
1970-01-01 00:00:00 Uniswap/v4-periphery