Closed Unique-Divine closed 3 months ago
[!WARNING]
Review failed
The pull request is closed.
The changes refactor the Nibiru EVM module to enhance the management and functionality of precompiled contracts. Key elements include the introduction of a FunToken
precompile for ERC20 token transfers, new methods in the Keeper
struct, removal of the HasCustomPrecompiles
function, and the addition of tests for FunToken functionalities. These alterations streamline the process of sending ERC20 tokens to Nibiru base accounts as bank coins.
File / Group | Change Summary |
---|---|
x/evm/keeper/precompiles.go | Refactor precompile management by replacing AvailablePrecompiles with PrecompileSet and AddPrecompiles . Update function signatures to use gethcommon.Address . |
x/evm/params.go | Remove the HasCustomPrecompiles function. |
x/evm/precompile/.gitignore | Add exclusions for various files and folders related to Hardhat and TypeChain. |
x/evm/precompile/README.md | Add sample Hardhat project showcasing basic use cases and instructions. |
x/evm/precompile/funtoken.go | Introduce FunToken precompiled contract for handling ERC20 token transfers to Nibiru sdk.AccAddress as bank coins. |
x/evm/precompile/funtoken_test.go | Add test cases for the FunToken precompile, including creation, existence checks, ERC20 operations, and token transfers. |
x/evm/precompile/precompile.go | Add functionality for initializing and managing precompiled contracts, combining Ethereum and Nibiru precompiles. |
x/oracle/keeper/app_test.go | Change package name to keeper_test and replace WaitForHeight with WaitForNextBlock . |
CHANGELOG.md | Document the new feature enabling ERC20 transfers to Nibiru accounts as Ethereum transactions. |
app/app.go | Add import for precompile and initialize/add precompiles to the EvmKeeper . |
app/keepers.go | Refactor AppKeepers struct to include keepers.PublicKeepers and modify the keepers list. |
sequenceDiagram
participant User
participant NibiruEVM
participant FunTokenPrecompile
participant EVM
participant Bank
User->>NibiruEVM: Submit EthereumTx (ERC20 transfer)
NibiruEVM->>FunTokenPrecompile: Invoke FunToken precompile run method
FunTokenPrecompile->>EVM: Execute contract logic
EVM->>Bank: Send ERC20 token as Nibiru bank coin
Bank->>User: Receive confirmation of transfer
Objective | Addressed | Explanation |
---|---|---|
Implement a way to send ERC20 tokens to a Nibiru base account as bank coins (#1944). | ✅ | |
Prerequisite: Requires completing FunToken creation methods (#1941, #1942). | ✅ |
In the world of code, where bytes transact,
FunTokens bridge, in smart contract act.
From Ethereum realms, to Nibiru's might,
Coins now transfer, guided by code's light.
Precompiles woven, magic unfolds,
ERC20's journey, to new realms it beholds. 🪄
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Attention: Patch coverage is 53.10345%
with 136 lines
in your changes missing coverage. Please review.
Project coverage is 65.31%. Comparing base (
5bc18fe
) to head (71f0f4e
).
Purpose / Abstract
Summary by CodeRabbit
New Features
precompileFunToken
contract to handle ERC20 token operations.Bug Fixes
SetupTest
function inx/oracle/keeper/app_test.go
to improve test reliability.Documentation
README.md
in thex/evm/precompile
directory with instructions for a sample Hardhat project.Chores
.gitignore
to thex/evm/precompile
directory to exclude various development-related files and folders.Refactor
app/keepers.go
.Tests