{"id":20536690,"url":"https://github.com/walterthesmart/sbtclend","last_synced_at":"2026-03-19T16:17:40.907Z","repository":{"id":259697539,"uuid":"862246949","full_name":"walterthesmart/sBTCLend","owner":"walterthesmart","description":"A smart contract-based lending platform built on the Stacks blockchain using Clarity. This project enables users to deposit and borrow sBTC, with automated interest calculations and a pool reserve system. Ideal for DeFi enthusiasts and developers looking to explore decentralized lending on Stacks.","archived":false,"fork":false,"pushed_at":"2024-12-30T21:56:32.000Z","size":62,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-06T03:35:54.177Z","etag":null,"topics":["blockchain","clarity","hiro","lending","smart-contracts","stacks"],"latest_commit_sha":null,"homepage":"","language":"Clarity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/walterthesmart.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-24T09:29:11.000Z","updated_at":"2024-09-24T10:09:44.000Z","dependencies_parsed_at":"2024-10-27T12:44:50.923Z","dependency_job_id":"f7201ae3-5f37-460b-9d67-8c34e49c1519","html_url":"https://github.com/walterthesmart/sBTCLend","commit_stats":null,"previous_names":["walterthesmart/sbtclend"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/walterthesmart/sBTCLend","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walterthesmart%2FsBTCLend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walterthesmart%2FsBTCLend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walterthesmart%2FsBTCLend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walterthesmart%2FsBTCLend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/walterthesmart","download_url":"https://codeload.github.com/walterthesmart/sBTCLend/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walterthesmart%2FsBTCLend/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30323235,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T01:36:58.598Z","status":"online","status_checked_at":"2026-03-10T02:00:06.579Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","clarity","hiro","lending","smart-contracts","stacks"],"created_at":"2024-11-16T00:37:30.819Z","updated_at":"2026-03-10T03:34:33.884Z","avatar_url":"https://github.com/walterthesmart.png","language":"Clarity","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lending Platform Smart Contract\n\n## Overview\n\nThis repository contains a Clarity smart contract for a decentralized lending platform on the Stacks blockchain. The contract allows users to deposit and withdraw sBTC, borrow against their deposits, and automatically applies interest to loans.\n\n## Features\n\n1. **Deposit**: Users can deposit sBTC into the platform.\n2. **Withdraw**: Users can withdraw their deposited sBTC.\n3. **Borrow**: Users can borrow sBTC against their deposits.\n4. **Interest Calculation**: Automatic interest calculation on loans.\n5. **Pool Reserve**: A pool reserve is maintained to collect interest payments.\n\n## Contract Structure\n\nThe contract uses several data structures and variables:\n\n- `deposits`: A map that tracks each user's deposits.\n- `loans`: A map that tracks each user's loans and their last interaction.\n- `total-deposits`: A variable that keeps track of the total sBTC deposited.\n- `pool-reserve`: A variable that tracks the total interest collected.\n- `loan-interest-rate`: The interest rate applied to loans (currently set at 10%).\n\n## Functions\n\n### `deposit`\n\nAllows users to deposit sBTC into the platform.\n\n```clarity\n(define-public (deposit (amount uint)))\n```\n\n### `withdraw`\n\nEnables users to withdraw their deposited sBTC.\n\n```clarity\n(define-public (withdraw (amount uint)))\n```\n\n### `borrow`\n\nAllows users to borrow sBTC against their deposits.\n\n```clarity\n(define-public (borrow (amount uint)))\n```\n\n## Error Handling\n\nThe contract includes several error constants to handle different scenarios:\n\n- `err-no-interest`: Used when there's an issue calculating interest.\n- `err-overpay`: Triggered when a user attempts to withdraw more than they've deposited.\n- `err-overborrow`: Occurs when a user tries to borrow more than their deposit allows.\n\n## Security Considerations\n\n- The contract uses the `as-contract` function to ensure that token transfers are executed with the contract's authority.\n- Assertions are used to prevent overborrowing and overwithdrawing.\n\n## Future Improvements\n\n1. Implement a repayment function for loans.\n2. Add a liquidation mechanism for undercollateralized loans.\n3. Implement variable interest rates based on utilization.\n4. Add events for important actions (deposits, withdrawals, borrows).\n\n## Testing\n\n(Note: Add information about your testing strategy and how to run tests once implemented.)\n\n## Deployment\n\n(Note: Add information about how to deploy this contract to testnet and mainnet once you've set up the deployment process.)\n\n## Contributing\n\nWe welcome contributions to improve this lending platform. Please submit pull requests with detailed descriptions of your changes.\n\n## License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwalterthesmart%2Fsbtclend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwalterthesmart%2Fsbtclend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwalterthesmart%2Fsbtclend/lists"}