Skip to content

Instantly share code, notes, and snippets.

@cupOJoseph
Created July 24, 2024 13:59
Show Gist options
  • Save cupOJoseph/66e5f92b726e16ea9f6a72a14c5e7593 to your computer and use it in GitHub Desktop.
Save cupOJoseph/66e5f92b726e16ea9f6a72a14c5e7593 to your computer and use it in GitHub Desktop.
Similar to mortgage backed securities: tradable loans implemented as NFTs for wildcat protocol. Trade your WBS to trade ownership of debt liability or deposits.
// SPDX-License-Identifier: MIT
// Compatible with OpenZeppelin Contracts ^5.0.0
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
//import wildcat market interfaces
import "https://raw.githubusercontent.com/wildcat-finance/wildcat-protocol/main/src/interfaces/IWildcatMarketController.sol";
import "https://raw.githubusercontent.com/wildcat-finance/wildcat-protocol/488b30d08c73a93be3e4bf99128c774997411d3a/src/market/WildcatMarket.sol";
contract WildcatBackedSecurity is ERC721, Ownable {
uint256 private _nextTokenId;
constructor(address initialOwner)
ERC721("WildcatBackedSecurity", "WBS")
Ownable(initialOwner)
{}
function _baseURI() internal pure override returns (string memory) {
return "ipfs://Qm123456789";
}
function createTradableLoan(address marketAddress, uint depositMax) public {
uint256 tokenId = _nextTokenId++;
IWildcatMarket market = IWildcatMarket(marketAddress);
market.depositUpTo(depositMax);
_safeMint(msg.sender, tokenId);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment