Skip to content

MynaWallet/contracts

Repository files navigation

MynaWallet

Overview

MynaWallet smart contract is a contract account that complies with ERC-4337. It approves operations described in UserOperation by verifying RSA signatures.

Preparation

Installing Foundry

MynaWallet smart contract is developed using Foundry. Please build the Foundry development environment according to the procedures in the linked page.

Cloning the Repository

Clone this repository with submodules.

git clone --recursive <Repository URL>

Setting Environment Variables

Make a copy of .env.sample and name it .env. Then, please set the environment variables according to the comments in the file. Please do not edit .env.sample directly as it is a sample file.

cp .env.sample .env
# Then edit .env with your favorite editor.

Development

Local Development

Start a local node

You can start a local node with the following command. The node will provide a JSON-RPC endpoint at http://localhost:8545 and test accounts.

anvil

Edit .env file to set PRIVATE_KEY from the given test account and reload .env file.

source .env

Deploy to local node

First, install the dependencies:

forge install

Then execute the script to deploy to the local node:

forge script script/Deploy.s.sol:DeployLocal --broadcast --rpc-url ${LOCAL_RPC_URL}

Debugging

For example, you can call accountImplementation() function to get the address of the account implementation address. Replace YOUR_DEPLOYED_FACTORY_CONTRACT_ADDRESS with the address of the deployed contract. For more information, please refer to Cast.

cast call YOUR_DEPLOYED_FACTORY_CONTRACT_ADDRESS "accountImplementation()(address)" --rpc-url ${LOCAL_RPC_URL}

Compile

forge build --sizes

Test

forge test

with printing execution traces for failing tests

forge test -vvv

with gas reporting

forge test --gas-report

Deployment

By executing the script below, you can deploy the Factory Contract of MynaWallet. You can change the network to which you deploy by changing rpc-url and etherscan-api-key.

Factory

forge script script/Deploy.s.sol:DeployFactory --broadcast --rpc-url ${SEPOLIA_RPC_URL} --verify --etherscan-api-key ${SEPOLIA_SCAN_API_KEY}

Paymaster

forge script script/Deploy.s.sol:DeployPaymaster --broadcast --rpc-url ${SEPOLIA_RPC_URL} --verify --etherscan-api-key ${SEPOLIA_SCAN_API_KEY}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •