Skip to content

Commit 3ccf453

Browse files
committed
Add study notes for 2025-08-14
1 parent 72aaed1 commit 3ccf453

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

evelive3.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,61 @@ Web2从业者;全栈偏后端开发,主力语言Python、Golang,学习Rust
1515
## Notes
1616

1717
<!-- Content_START -->
18+
# 2025-08-14
19+
20+
## 知识分享会
21+
22+
主题:一个真实的DApp开发全流程
23+
24+
嘉宾:[WongSSH](https://blog.wssh.trade/)
25+
26+
- 写了V3和V4的数学库
27+
28+
### 给小白的名词解释
29+
30+
- [FFI](https://getfoundry.sh/forge/advanced-testing/differential-ffi-testing#primer-the-ffi-cheatcode) allows you to execute an arbitrary shell command and capture the output.
31+
- [The Contract Application Binary Interface (ABI)](https://docs.soliditylang.org/en/latest/abi-spec.html), is the standard way to interact with contracts in the Ethereum ecosystem, both from outside the blockchain and for contract-to-contract interaction.
32+
- [Multi-chain deployments](https://getfoundry.sh/forge/deploying/#multi-chain-deployments): Deploying and verifying multiple smart contracts on multiple chains in one go is possible by using forking cheatcodes.
33+
- EVM中[Address](https://docs.soliditylang.org/en/latest/types.html#address)类型的长度为什么是160位长?因为[Keccak-256](https://github.com/ethereum/eth-hash)(64字节公钥) = 32字节哈希值,再截取后20位字节
34+
35+
### `Wong`给的一些经验和最佳实践
36+
37+
- UniSwap V3 和V4的科学计算库是一样的
38+
- 编写单元测试检查V3和V4是否等效
39+
- 使用Soldeer代替Git进行版本管理
40+
- 解决Solidify版本冲突问题,采用了将V3编译为字节码的方式
41+
- 通过FFI与JS、Python计算的结果进行横向对比,确保通过Solidity实现的科学计算库的准确性
42+
- Python使用mpmath计算库,确保与Solidity计算结果一致
43+
- 使用Python写出函数,实现和验证功能,再转换为Solidity版本
44+
- 通过内联汇编实现了很多优化,省Gas
45+
- 组合大于继承,功能通过library实现,减少使用继承和重载,不要使用多重继承和复数个重载(影响可读性,审计友好)
46+
- 类型别名(type xxx is xxxtype, using xxx for xxxx)语法糖,可以提升代码可读性,编译后还原为原始类型
47+
- mapping会算一个hash,更费Gas
48+
- 减少写View函数,建议都用internal修饰符,不写public(写public会被Foundry编译为一个view,会占用代码存储空间,当前单个合约有24KB的大小限制),通过函数来获取存储slot的值
49+
- 合约的状态是warm还是cold,热合约使用更少的Gas
50+
- 递归用起来很酷,但很烧脑,而且EVM也存在栈深度的问题
51+
- Morpho和UniSwap不收Flash load费用,Aave会收
52+
53+
### 现代合约架构
54+
55+
- [现代合约架构](https://hackmd.io/@wongssh/SyIUoNqdxx#%E7%8E%B0%E4%BB%A3%E5%90%88%E7%BA%A6%E6%9E%B6%E6%9E%84)
56+
57+
58+
> 想入职DEX的,能读懂 Uniswap V3~V4的非数学库部分,就算是够到Web3的入职门槛
59+
> 想入职借贷的,读懂ERC20 -> Morpho
60+
61+
### 路线图
62+
63+
- ERC20 -> Safe -> AAVE v3
64+
- Uniswap v2 / Uniswap v3 / Uniswap v4
65+
66+
### 工具
67+
68+
- [Soldeer](https://soldeer.xyz/), the modern package manager for Solidity development.
69+
- [uv](https://github.com/astral-sh/uv) Python的环境和包管理工具
70+
- [Yul](https://docs.soliditylang.org/en/latest/yul.html) is an intermediate language that can be compiled to bytecode for different backends.
71+
- [VSCode extension: Solidity](https://marketplace.visualstudio.com/items?itemName=JuanBlanco.solidity)
72+
1873
# 2025-08-13
1974

2075
## 知识分享会

0 commit comments

Comments
 (0)