Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tomasdarquier/pawnsystem
https://github.com/tomasdarquier/pawnsystem
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/tomasdarquier/pawnsystem
- Owner: TomasDarquier
- Created: 2021-12-08T01:20:41.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-11-25T23:12:45.000Z (about 2 months ago)
- Last Synced: 2024-11-26T00:23:30.531Z (about 2 months ago)
- Language: Solidity
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NFT Pawn Shop Smart Contract
This repository contains a Solidity smart contract that enables using NFTs as collateral for loans. It allows users to pawn NFTs, propose loans, and manage repayments.
---
## ✨ Features
- **Approve NFT Collections**: Only approved collections can be pawned, ensuring security and value.
- **Create Pawn Proposals**: Users list NFTs as collateral for potential loans.
- **Submit Loan Offers**: Lenders propose terms such as loan amount, interest rate, and duration.
- **Accept Offers**: NFT owners choose offers and lock their NFTs as collateral.
- **Repay Loans**: Owners repay within the agreed duration to recover their NFTs.
- **Claim Collateral**: Lenders claim NFTs if borrowers default.---
## ⚙️ Technical Details
- **Solidity Version**: `0.8.7`
- **Dependencies**: [OpenZeppelin ERC1155 Contracts](https://docs.openzeppelin.com/contracts/4.x/erc1155)
- **State Management**:
- **Enum `Estado`**: Tracks the pawn lifecycle (`CREATED`, `ACCEPTED`, `PAID`, `CANCELLED`, `EXPIRED`).
- **Structs**:
- **`Propuesta`**: Stores NFT details and proposal status.
- **`OfertaDePrestamo`**: Records loan offer details like lender, amount, and interest.---
## 🛠️ How It Works
1. **Approve Collections**: Contract owner specifies allowed NFT collections.
2. **List NFTs**: Owners transfer approved NFTs to the contract for listing.
3. **Make Offers**: Lenders propose loan terms (amount, interest, duration).
4. **Accept Offers**: Borrowers accept an offer and lock their NFT as collateral.
5. **Repayment**: Borrowers repay loans with interest to retrieve their NFTs.
6. **Default**: Lenders claim NFTs if loans are not repaid on time.---
## 🚀 Deployment
1. Install dependencies for Solidity 0.8.7 and OpenZeppelin libraries.
2. Compile the contract using a compatible IDE or CLI tool.
3. Deploy the contract to an Ethereum-compatible network.---
## ⚠️ Disclaimer
This contract is for **educational purposes** only. Use at your own risk. Test thoroughly before deploying to a production environment.