Skip to content

basic lending and borrowing contract ETH/USDC for PoC usage in zkSync

Notifications You must be signed in to change notification settings

tx-bundler/basic-lending-contract

Repository files navigation

CHAT GPT-4 COMMENTS

The contract code you provided looks good. I have reviewed it and didn't find any issues with the syntax or logic. Here's a summary of the contract:

It imports the necessary OpenZeppelin contracts for ERC20 tokens, ownership, and reentrancy protection.
The contract inherits from Ownable and ReentrancyGuard.
It declares a usdcToken variable, an etherToUsdcRate, and a DECIMALS constant for USDC.
It defines two structs, LiquidityPool and UserBalance, to keep track of the pool's liquidity and each user's balance.
It initializes the LiquidityPool struct and maps addresses to UserBalance structs.
It defines events for depositing, borrowing, withdrawing, and repaying.
It has a constructor that takes an IERC20 token as a parameter.
It has a receive and fallback function that revert any direct Ether transfers.
It has functions for updating the Ether to USDC rate, depositing Ether and USDC, withdrawing shares in Ether or USDC, borrowing Ether or USDC, and repaying borrowed Ether or USDC.

Contract Address on zkSync Era Göerli: 0xA7c9A38e77290420eD06cf54d27640dE27399eB1

https://goerli.explorer.zksync.io/address/0xA7c9A38e77290420eD06cf54d27640dE27399eB1

Sample Hardhat Project

This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, and a script that deploys that contract.

Try running some of the following tasks:

npx hardhat help
npx hardhat test
REPORT_GAS=true npx hardhat test
npx hardhat node
npx hardhat run scripts/deploy.ts

About

basic lending and borrowing contract ETH/USDC for PoC usage in zkSync

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published