-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dd9aca5
commit 05ce9d7
Showing
5 changed files
with
52 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(){} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|