diff --git a/src/DNScollateral.sol b/src/DNScollateral.sol index e69de29..8b13789 100644 --- a/src/DNScollateral.sol +++ b/src/DNScollateral.sol @@ -0,0 +1 @@ + diff --git a/src/DNSerc20.sol b/src/DNSerc20.sol index 7502c58..6341d52 100644 --- a/src/DNSerc20.sol +++ b/src/DNSerc20.sol @@ -1,3 +1,2 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - +pragma solidity ^0.8.15; diff --git a/src/DNSerc721.sol b/src/DNSerc721.sol index e69de29..48b41a6 100644 --- a/src/DNSerc721.sol +++ b/src/DNSerc721.sol @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.15; + +//dependencies +import {ERC721} from + "../lib/openzeppelin-contracts/contracts/token/ERC721/ERC721.sol"; + +contract DNSerc721 is ERC721 { + constructor(string memory name_, string memory symbol_) + ERC721(name_, symbol_) + {} + + function mint(address _to, uint256 _tokenId) internal returns (bool) { + _mint(_to, _tokenId); + } +} diff --git a/src/DNSfactory.sol b/src/DNSfactory.sol index f3f22f9..e642f05 100644 --- a/src/DNSfactory.sol +++ b/src/DNSfactory.sol @@ -1,68 +1,53 @@ +// SPDX-License-Identifier: MIT pragma solidity ^0.8.15 -interface IDNSfactory{ - constructor(){} - - /////////////////////////// STORAGE /////////////////////////////////// +//dependencies +import {DNSerc721} from "./DNSerc721.sol"; - address immutable DNSerc721; - address immutable DNSerc20; +import {Ownable} from + "../lib/openzeppelin-contracts/contracts/access/Ownable.sol"; - struct CollateralData{ - address _erc20; //160 bits - uint96 _amount; // 96 bits - } - mapping(uint256=>CollateralData) tokenIDToPosition; - mapping(address=>uint256) DNSbalance; - - - function deployERC721(){ - // to be called only once - // Deploys the parent ERC721 contract - } - - function depositCollateral(){ - // Transfers ERC20(address) to address(this) - // Updates mapping,structs - // Mints ERC721 with tokenId specifying this position - } +// interfaces +import {IERC20} from + "../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; +import {IERC721} from + "../lib/openzeppelin-contracts/contracts/token/ERC721/IERC721.sol"; - function mintERC721(){ - // To be called by depositCollateral - // Constructs tokenID from input parameters - // Calls DNSerc721 and mints the SVG NFT - } +interface DNSfactory is Ownable, DNSerc721 { + /////////////////////////// STORAGE /////////////////////////////////// + address immutable DNSerc20; - function mintDNS(){ - // Checks whether caller is owner of the given tokenID - // Reconstructs params from PositionData struct - // Takes short position of the given asset - // Calls ChainlinkFunction which returns amount of DNS to be minted - // Calls DNSerc20 and mints $DNS - } - function getPricefromChainlink(){ - // Calls AggregatorV3Interface to fetch value of the asset in USD - // Returns uint256 DNS Amount - } + mapping(uint256 => CollateralData) tokenIDToPosition; + mapping(address => uint256) DNSbalance; - function takeShortPosition(){ - // + struct CollateralData { + address _erc20; //160 bits + uint96 _amount; // 96 bits } - function burnDNS(){ - // Calls DNSerc20 and burns $DNS + constructor(string memory name_, string memory symbol_, address _DNSerc20) + DNSerc721(name_, symbol_) + { + DNSerc20 = _DNSerc20; } + ///// USER FLOW ////////////// + //// User deposits collateral //// + //// Converts data of this collateral into a position //// + //// Mints an ERC721 Specifying this position //// + //// Another function called claimDNS which takes into account this - + + function mintERC20DNS(){} + function burnERC20DNS(){} + function mintERC721DNS(){} + function calculateDNS(){} - - -} \ No newline at end of file +} diff --git a/src/DNSprice.sol b/src/DNSprice.sol index e69de29..8b13789 100644 --- a/src/DNSprice.sol +++ b/src/DNSprice.sol @@ -0,0 +1 @@ +