Skip to content

Commit

Permalink
fix:file structure
Browse files Browse the repository at this point in the history
  • Loading branch information
boombb12138 committed Nov 7, 2022
1 parent 9533b7b commit 62c5f53
Show file tree
Hide file tree
Showing 21 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hardhat-tutorial/contracts/Exchange.sol
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ contract Exchange is ERC20 {
uint256 cryptoDevTokenAmount = (getReserve() * _amount) / _totalSupply;
// /从用户的钱包中烧掉LP token,因为它们已经被发送到删除流动性
_burn(msg.sender, _amount);
// 将'ethAmount'的eth从合同转移到用户的钱包
// todo 将'ethAmount'的eth从合同转移到用户的钱包 这里为什么用payable
payable(msg.sender).transfer(ethAmount);
// 将“cryptoDevTokenAmount”数量的Crypto Dev token从合同转移到用户的钱包
ERC20(cryptoDevTokenAddress).transfer(msg.sender, cryptoDevTokenAmount);
Expand Down
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions my-app/my-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### 建造一个类似于Uniswap的去中心化交易所😀

这个repo里包含了Uniswap的原理图,我整合了知乎上的一篇文章(链接在导图里面有)和LW3的教程,做了总结性的思维导图 :wink:

总体而言,这个项目和之前的项目不同点在于

- 它封装了调用合约函数的方法,将这些方法放在utils文件夹里面
- 结合了Uniswap的原理,多了一些基础的数学计算,这些我也制作了手绘图~

话不多说 上图:tanabata_tree:





File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const getTokensAfterRemove = async (
);
// 得到CD LP Token的总数
const _totalSupply = await exchangeContract.totalSupply();
//用户remove LP Token后,返回给用户的Eth数量
// 这里我们使用的是乘法和除法的BigNumber方法
const _removeEther = _ethBalance.mul(removeLPTokensWei).div(_totalSupply);
const _removeCD = cryptoDevTokenReserve
Expand All @@ -43,7 +44,6 @@ export const getTokensAfterRemove = async (
_removeEther,
_removeCD,
};
//用户remove LP Token后,返回给用户的Eth数量
} catch (err) {
console.error(err);
}
Expand Down
File renamed without changes.

1 comment on commit 62c5f53

@vercel
Copy link

@vercel vercel bot commented on 62c5f53 Nov 7, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.