List view
- No due date•6/10 issues closed
Exactly everything required by ERC20 🤔 ## 1. WebAssembly Still far away to complete the MVP instructions of WASM, once we have implemented all of these, we can archive that **any WASM program works for EVM**. ### 1.1. Memory Allocator The main blocker of compiling Zink projects EVM contracts in real world is that that we are currently missing the implementation of memory allocator: Since EVM uses 32-byte as the basic unit for memory management, we need to implement our own memory allocator to align the compiled memory operations in WASM to EVM, see [alloc::GlobalAlloc][global_allocator] ### 1.2. Tests of Vector This is what we can get directly from the implementation of `1.1`, require tests for custom vector operations. ### 1.3. Instructions reference to [wasm-ops][wasm-ops], complete the MVP instructions, - Control Flow: `select`, `br_table`, `call_indirect` - Data & State: `global` related instructions - Memory: tests of `loadN`, `storeN` - Comparison : tests for integers - Bitwise: implement missed bitwise operations in EVM - Arithmetic: `div` and `rem` are not tested - Data Conversions: almost missing all of them ## 2. Contract Interfaces To be a EVM contract : ) ### 2.1. Selector The selector implementation is free to go since EVM simply starts from the first byte of EVM binaries which is the main function in general. The question is that shall we align our selector implementation to solidity? Guess the answer is yes and no, it is really necessary to adapt the current infrastructure, but, we can do it better with the rust ecosystem, the most simple way to go is that we provide an external function `select` or just `main` in the compiled WASM, make it the main function, actually a jump table, jumping to specified function by the selector. The problem needs to be solved is that, how we detect that if the selected function is called as a transaction or just a internal call? requires research on it. ### 2.2. Storage Basically, we need to implement globals to reach this demand, besides, the storage operations require the implementation of host functions since it is out of basic instructions that we can translate from WASM to EVM bytecode. ### 2.3. Events Events operations are similar to the storage implementation, however, it requires customized types as well. ## 3. Example for `v0.2.0` `ERC20` is reasonable, just do it! ref: [OpenZeppelin/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol][ERC20] [global_allocator]: https://doc.rust-lang.org/std/alloc/trait.GlobalAlloc.html [wasm-ops]: https://pengowray.github.io/wasm-ops/ [ERC20]: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol
No due date•38/66 issues closed