This repository contains a simple contract as a proposed solution for the KipuBank module activity from the Blockchain course provided by ETH Kipu.
In order to develop for this repository you will need the following:
You will also need an account in MetaMask, Alchemy, and Etherscan.
First, clone this repository:
git clone https://github.com/moonstar-x/eth-kipu-bankAnd install the dependencies:
npm installTo run unit tests for this project, run the following command:
npm run testYou may also run tests in Solidity only with:
npm run test:solidityOr only in Node.js with:
npm run test:tsTo run the linter, use:
npm run lintAnd to auto-fix issues, use:
npm run lint:fixTo run the formatter, use:
npm run formatAnd to auto-fix issues, use:
npm run format:fixFollow these steps to deploy and verify this contract.
First, copy the .env.sample file into a .env file and fill out the values as necessary:
KIPU_BANK_CAP=300
KIPU_BANK_MAX_SINGLE_WITHDRAW_LIMIT=150
KIPU_BANK_OWNER_ADDRESS=0xA9A7c8E80D6A6b7ca89bB1d34f160acb62de457A
KIPU_BANK_ETH_USD_PRICE_FEED=0x694AA1769357215DE4FAC081bf1f309aDC325306
KIPU_BANK_USDC_TOKEN_ADDRESS=0xf08A50178dfcDe18524640EA6618a1f965821715
Feel free to change any variables to your liking.
As for the next variables:
SEPOLIA_RPC_URLshould be set to the RPC URL to deploy this contract to. For more information on how to get this value feel free to check this guide from the Alchemy's documentation page.SEPOLIA_PRIVATE_KEYshould be set to your MetaMask's private key. For more information on how to get this value feel free to check this guide on MetaMask's documentation page.ETHERSCAN_API_KEYshould be set to your Etherscan's API key. For more information on how to get this value feel free to check this guide on Etherscan's documentation page.
Once you have your .env file ready, you're ready to deploy the contract by running the following command:
npm run deploy:sepoliaThis will deploy the contract to the Sepolia testnet and will give you a contract address.
Once this is done, you can verify the contract with:
npm run verify:sepoliaThis will verify the contract on Etherscan.
First, head over to the Etherscan page of the contract and copy the ABI content.
Next, head over to the Remix IDE and paste the ABI content into a .abi file with any name and leave this file open in the editor.
In the Deploy & Run Transactions page, Injected Provider - MetaMask in the Environment option and connect your wallet, make sure to enable only the Sepolia network when granting access.
Next, in the At Address textbox insert the contract's address and click the At Address button. You will receive a modal asking whether to load the contract with the ABI specification loaded, click Accept and you'll now have some buttons to interact with the contract.