- Problem Statement
- Acceptance Criteria
- Tools Used
- System Architecture
- Assumptions
- Implementation Details
As a Bank, I want to be able to manage account balances with values of a single currency on behalf of my Clients.
- Create a private GitHub repository and make sure to push your code into that repository and share it with us.
- Both Bank and their Clients have Ethereum addresses (Externally Owned Accounts).
- We can query for the balances of a specific Client/user by calling the balanceOf(address) function.
- Clients accounts have a balance represented by a uint256 value.
- Clients can call a deposit(toAddress, amount) function to initiate adding value to a client's balance, but each specific transaction must be approved by banks before the balance is updated.
- Clients can call a transferFrom(fromAddress, toAddress, amount) function to transfer value between Client accounts, but each specific transaction must be authorized by both the Client owner and the Bank before the balance can be updated.
- The contract(s) should be correct and secure. Include any unit tests or security specifications. You may use any testing framework you’re comfortable with, but Foundry is preferred.
- Add a README.md detailing how to run your tests from a fresh machine.
- Help your users - document the code using NatSpec, emit appropriate events.
- You may use any existing smart contract libraries or EIP standards where applicable.
- The contract should be gas efficient, but readability is still the top priority.
- Use conventional commits specification Conventional Commits
- Create an atomic swap contract that allows someone to exchange a specific amount of balance from PaymasterLedger with a specific amount of a standard ERC20 token (e.g. WETH9). You may add additional functions to the PaymasterLedger but note that existing security assumptions remain. e.g.:
- Funds cannot be moved from an account without both the Client owner and the Bank’s approval (implicit or explicit - you may list any assumptions or rationale in your README.md file).
- Solidity
- HardHat
- Sepolia TestNet
- Alchemy
- The implementation of deposit(), balanceOf() and tranferFrom() functions has been done in a single contract while a separate contract has been created for atomic swap.
- To provide a proper definition of account approval an account status parameter has been implemented which considers the 5 statuses- Not Requested, Requested, Paused, Active, Closed. If the account has requested for a deposit or transfer of amount, it's status is checked by the bank for approval purpose
- openAccount()
- approveAccount()
- pauseAccount()
- unPauseAccount()
- closeAccount()
- deposit()
- withdraw()
- transferAccount()
- getAccountStatus()
- accountBalance()
- getOwner()
- Htlc()
- onlyOwner()
- isAccountPaused()
- isAccountActive()