MynaWallet smart contract is a contract account that complies with ERC-4337. It approves operations described in UserOperation
by verifying RSA signatures.
MynaWallet smart contract is developed using Foundry. Please build the Foundry development environment according to the procedures in the linked page.
Clone this repository with submodules.
git clone --recursive <Repository URL>
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.
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
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}
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}
forge build --sizes
forge test
forge test -vvv
forge test --gas-report
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
.
forge script script/Deploy.s.sol:DeployFactory --broadcast --rpc-url ${SEPOLIA_RPC_URL} --verify --etherscan-api-key ${SEPOLIA_SCAN_API_KEY}
forge script script/Deploy.s.sol:DeployPaymaster --broadcast --rpc-url ${SEPOLIA_RPC_URL} --verify --etherscan-api-key ${SEPOLIA_SCAN_API_KEY}