{"id":15456910,"url":"https://github.com/masaun/watch-nft-based-cdp","last_synced_at":"2025-04-10T03:56:55.863Z","repository":{"id":52971030,"uuid":"353855781","full_name":"masaun/watch-nft-based-cdp","owner":"masaun","description":"This is a smart contract that allow a user to borrow the WatchSignals Token ($WST) by depositing a watch owned (Watch NFT) as a collateral. The watch prices are retrieved via chainlink oracle.","archived":false,"fork":false,"pushed_at":"2021-04-11T23:56:01.000Z","size":385,"stargazers_count":4,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-10T03:56:51.884Z","etag":null,"topics":["arbitrum","chainlink","defi","layer2","nft","solidity","truffle","web3js"],"latest_commit_sha":null,"homepage":"","language":"Solidity","has_issues":false,"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/masaun.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}},"created_at":"2021-04-01T23:55:52.000Z","updated_at":"2023-11-21T06:02:54.000Z","dependencies_parsed_at":"2022-09-03T04:51:06.960Z","dependency_job_id":null,"html_url":"https://github.com/masaun/watch-nft-based-cdp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masaun%2Fwatch-nft-based-cdp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masaun%2Fwatch-nft-based-cdp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masaun%2Fwatch-nft-based-cdp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masaun%2Fwatch-nft-based-cdp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/masaun","download_url":"https://codeload.github.com/masaun/watch-nft-based-cdp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248154998,"owners_count":21056542,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["arbitrum","chainlink","defi","layer2","nft","solidity","truffle","web3js"],"created_at":"2024-10-01T22:40:44.247Z","updated_at":"2025-04-10T03:56:55.838Z","avatar_url":"https://github.com/masaun.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Watch NFT-based CDP (Collateralized Debt Position)\n\n***\n## 【Introduction of the Luxury Watch NFT-based CDP (Collateralized Debt Position)】\n- This is a smart contract that allow a user to borrow the WatchSignals Token (WST) by depositing the own luxury watch (Watch NFT) as a collateral.\n  - A user create a `Watch NFT` based on their own luxury watch and its luxury watch price.\n    - Current luxury watch price is retrieved by the `WatchSignals Luxury Watch Price Oracle` via chainlink.\n\n  - A user deposit a `Watch NFT` into the WatchCDP Pool.\n\n  - By depositing a `Watch NFT`, a user can borrow the WatchSignals Token (WST) from the WatchCDP Pool.\n    - A user can borrow WST `until 60% of the watch price of the collateralized-watch NFT` .\n    - This depositing (collateral) and borrowing structure is simlar to MakerDAO's CDP (MCD).\n\n  - When a user above repay, a user repay the WatchSignals Token (include `principal + interest` ) to the WatchCDP Pool. \n    - Once a user finish to repay, a user can withdraw deposited-watch NFT from the WatchCDP Pool. \n\n\u003cbr\u003e\n\n- The `WatchSignals Token (WST)` is `ERC20 token` that is original token of the WatchSignals.\n\n\u003cbr\u003e\n\n- Use the WatchSignals Luxury Watch Price Oracle via chainlink for retrieving the watch price data.\n    https://docs.chain.link/docs/watchsignals#config\n\n\u0026nbsp;\n\n***\n\n## 【Workflow】\n- Diagram of workflow\n  (※ The WatchCDP contract is also the WatchCDP Pool)\n![【Diagram】Watch NFT-based CDP (Collateralized Debt Position)](https://user-images.githubusercontent.com/19357502/114325486-541e2600-9b6b-11eb-828f-b85976da759b.jpg)\n\n\u0026nbsp;\n\n***\n\n## 【Versions】\n- Version for following the `Chainlink (v0.6)` smart contract\n  - Solidity (Solc): v0.6.12\n  - Truffle: v5.1.60\n  - web3.js: v1.2.9\n  - openzeppelin-solidity: v3.2.0\n  - ganache-cli: v6.9.1 (ganache-core: 2.10.2)\n\n\n\u0026nbsp;\n\n***\n\n## 【Setup】\n### ③ Prepare for execution script\n- 1: Get API-key from Infura  \nhttps://infura.io/\n\n\u003cbr\u003e\n\n- 2: Add `.env` to the root directory by referencing from `.env.example`\n  You need to set 3 things below in your .env:\n  - Mnemonic (MNEMONIC)\n  - Infura key (INFURA_KEY)\n  - Deployer address (DEPLOYER_ADDRESS)\n\n\u003cbr\u003e\n\n### ② Install modules\n- Install npm modules in the root directory\n```\n$ npm install\n```\n\n\u003cbr\u003e\n\n### ③ Compile \u0026 migrate contracts (on Kovan testnet)\n```\n$ npm run migrate:kovan\n```\n\n\u003cbr\u003e\n\n### ④ Scripts (for testing whole process) on Kovan \n- 1: Process are that:\n  - Creating a Watch NFT\n  - Deposit a Watch NFT as a collateral into the WatchCDP Pool.\n  - Borrow the WatchSignals Token (WST)\n```\n$ npm run script:WatchCDP-borrow\n```\n\n\u003cbr\u003e\n\n- 2: Process are that:\n  - Repay the WatchSignals Token (include `principal + interest` ) to the WatchCDP Pool. \n  - Withdraw the deposited-watch NFT from the WatchCDP Pool. \n```\n$ npm run script:WatchCDP-repay\n```\n(※ In case you want to execute again after scripts above is executed, you must migrate (Process③) again. Then you need to execute Step 1~2 above)\n\n\n\u003cbr\u003e\n\n### 【Video demo】\n- Video demo for executing scripts above (on Kovan testnet):  \nhttps://youtu.be/W8of0SZCuAs\n\n\u003cbr\u003e\n\n### 【Remarks】\n- Arbitrum verison\n  - In progress.\n\n\u003cbr\u003e\n\n- The WatchCDP contract is also the WatchCDP Pool.\n\n\u003cbr\u003e\n\n- Another Scripts (Each parts)\n  - Script for calling oracle by using the WatchSignals Luxury Watch Price Oracle via chainlink\n    `$ npm run script:WatchSignalsLuxuryWatchPriceOracle`\n\n  - Script for creating the Watch NFT\n    `$ npm run script:WatchNFTFactory`\n\n\u003cbr\u003e\n\n***\n\n## 【References】\n- WatchSignals Luxury Watch Price Oracle via chainlink\n  - Article: https://watchsignals.com/watch-blog/luxury-watch-data-on-blockchain-chainlink.html\n  - Doc: https://docs.chain.link/docs/watchsignals#config\n\n- Chainlink\n  - @chainlink/contracts (v0.1.6) =\u003e include solidity v0.6 based package\n    https://www.npmjs.com/package/@chainlink/contracts\n\n- Arbitrum\n  - Public Testnet（Kovan =\u003e Arbitrum）: https://developer.offchainlabs.com/docs/public_testnet\n  - How to deploy on Arbitrum by using Truffle: https://developer.offchainlabs.com/docs/contract_deployment\n\n- Chainlink Virtual Hackathon Spring 2021\nhttps://chainlink-2021.devpost.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasaun%2Fwatch-nft-based-cdp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmasaun%2Fwatch-nft-based-cdp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasaun%2Fwatch-nft-based-cdp/lists"}