Skip to content

Commit

Permalink
woww
Browse files Browse the repository at this point in the history
  • Loading branch information
proxima424 committed Dec 18, 2022
1 parent dd9aca5 commit 05ce9d7
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 50 deletions.
1 change: 1 addition & 0 deletions src/DNScollateral.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

3 changes: 1 addition & 2 deletions src/DNSerc20.sol
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

pragma solidity ^0.8.15;
16 changes: 16 additions & 0 deletions src/DNSerc721.sol
Original file line number Diff line number Diff line change
@@ -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);
}
}
81 changes: 33 additions & 48 deletions src/DNSfactory.sol
Original file line number Diff line number Diff line change
@@ -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(){}







}
}
1 change: 1 addition & 0 deletions src/DNSprice.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

0 comments on commit 05ce9d7

Please sign in to comment.