Skip to content

This repository contains the Solidity code for a Decentralized-Finance-DeFi-Protocol smart contract designed for Ethereum-like blockchains.

Notifications You must be signed in to change notification settings

gavriles/DeFi

 
 

Repository files navigation

Decentralized-Finance-DeFi-Protocol

DeFi Protocol README This is a decentralized finance (DeFi) protocol contract written in Solidity. It allows users to deposit tokens, withdraw tokens, borrow tokens, and repay borrowed tokens.

Functionalities Deposit Tokens

Function: deposit(uint256 amount) Description: Allows users to deposit tokens into the protocol. Parameters: amount - The amount of tokens to deposit. Withdraw Tokens

Function: withdraw(uint256 amount) Description: Allows users to withdraw deposited tokens from the protocol. Parameters: amount - The amount of tokens to withdraw. Borrow Tokens

Function: borrow(uint256 amount) Description: Allows users to borrow tokens from the protocol, provided there is sufficient liquidity. Parameters: amount - The amount of tokens to borrow. Repay Borrowed Tokens

Function: repay(uint256 amount) Description: Allows users to repay borrowed tokens to the protocol. Parameters: amount - The amount of tokens to repay. Get Deposit Details

Function: getDepositDetails(address account) external view returns (uint256 amount, uint256 depositTime) Description: Allows users to get details of their deposits, including the deposited amount and the deposit time. Parameters: account - The address of the account to get deposit details for. Get Borrow Details

Function: getBorrowDetails(address account) external view returns (uint256 amount, uint256 borrowTime) Description: Allows users to get details of their borrowings, including the borrowed amount and the borrowing time. Parameters: account - The address of the account to get borrow details for. Additional Notes Ensure that the ERC20 token contract address is provided as a constructor parameter when deploying this contract. This is a simplified version of a DeFi protocol and does not include advanced features like interest rates, collateral management, or liquidation mechanisms. Users should approve the contract to transfer tokens on their behalf before interacting with the protocol. Carefully review the code and ensure it meets your project's requirements before deployment.

About

This repository contains the Solidity code for a Decentralized-Finance-DeFi-Protocol smart contract designed for Ethereum-like blockchains.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Solidity 100.0%