owned this note
owned this note
Published
Linked with GitHub
# Digitalax Stage 2 - Parent, Child NFTs with Auctions
## Other links
* [Stage 1 Docx](https://hackmd.io/RzmT0y91ReyRmrh084ShNA)
* [SubGraph Data Requirements](https://hackmd.io/czRBe2GjR_m7i48adTsx-Q)
## General Design
### Contracts
#### Rinkeby Deployments
```
https://thegraph.com/explorer/subgraph/digitalax/digitalaxropsten
```
```
DigitalaxAccessControls - 0x386c30961E47c38f3aa899464FF4bBc9dF9949f5
DigitalaxGenesisNFT - 0x064A6151F99ba2610f2D6600Dcb2b2Ed3a276356
DigitalaxMaterials - 0x5988db41A39F4AB0d6DeB9cf99C74F691bbD236a
DigitalaxGarment - 0xBf379898e6C392Fe2A131046B8f3daE9A8748454
DigitalaxGarmentFactory - 0x4B613A9b2a9122bDa2240011da48f9C6a6964b20
DigitalaxAuction - 0x18ff4ECCf9397C4CEF2A8611a33CbD5052f3679E
```
One click dapp for auction:https://oneclickdapp.com/garden-clark/?privateKey=0xfa6a469cb56013cfe7557e7d6c62d093c5ef21a388f713f5cde532fa1190ff85
#### Mainnet
```
https://thegraph.com/explorer/subgraph/digitalax/digitalax
```
```
TODO
```
## NFTs
* `ERC721` can own a bunch of `ERC1155` tokens, composed together losely based on `ERC998` standard
* To get access to the 1155 child tokens, the owner must burn the NFT.
```
Parent (ERC-721) a.k.a masters
|
▼
Child (ERC-1155) a.k.a. strands
```
### Auction
* Auctions are for primary sales only, once sold cannot be listed again
* Auctions are for the `721` tokens, any child `1155` tokens held by this token do not move as the owner of the `master` token also has ownership of the 1155 tokens composed within.
#### ABI
##### Bidder functions
* Open to `all`, auction rules are enforced
```solidity
function placeBid(uint256 _garmentTokenId)
function withdrawBid(uint256 _garmentTokenId)
```
```json
{
"inputs": [
{
"internalType": "uint256",
"name": "_garmentTokenId",
"type": "uint256"
}
],
"name": "placeBid",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_garmentTokenId",
"type": "uint256"
}
],
"name": "withdrawBid",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
```
##### Resulting functions
* Requires `admin` or `smart contract` role
```solidity
function resultAuction(uint256 _garmentTokenId)
function cancelAuction(uint256 _garmentTokenId)
```
```json
{
"inputs": [
{
"internalType": "uint256",
"name": "_garmentTokenId",
"type": "uint256"
}
],
"name": "resultAuction",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_garmentTokenId",
"type": "uint256"
}
],
"name": "cancelAuction",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
```
#### Minting functions
* Requires `minter` role
```solidity
function createAuction(uint256 _garmentTokenId, uint256 _reservePrice, uint256 _startTime, uint256 _endTime)
```
```json
{
"inputs": [
{
"internalType": "uint256",
"name": "_garmentTokenId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_reservePrice",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_startTime",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_endTime",
"type": "uint256"
}
],
"name": "createAuction",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
```
### GarmentFactory
```
TODO
```
### SubGraph Entities
#### Garment / Designer stuff
```
DigitalaxGarment - the master 721 token
DigitalaxMaterial - the 1155 tokens
DigitalaxCollector - a collector/user in the Digitalax system
DigitalaxGarmentDesigner - a designer in the Digitalax system
```
#### Auction stuff
```
DigitalaxAuctionContract - global auction config
DigitalaxGarmentAuction - auction details
DigitalaxGarmentAuctionHistory - auction history
```
### Sample queries
* Get all garments
```
{
digitalaxGarments {
id
designer
owner
primarySalePrice
tokenUri
children {
amount
tokenUri
parentId
childId
contract
tokenUri
id
}
}
}
```
* Get all live (live resulted) auctions
```gql
{
digitalaxGarmentAuctions(where:{resulted_not_in:[true]}) {
id
reservePrice
endTime
startTime
resultedTime
resulted
topBidder {
id
}
topBid
lastBidTime
}
}
```
* Get auction details
```
{
digitalaxGarmentAuctions {
id
startTime
endTime
resulted
resultedTime
topBidder {
id
}
topBid
designer {
id
}
garment {
id
designer
owner
primarySalePrice
tokenUri
children {
id
childId
amount
tokenUri
}
}
}
}
```
* Get token auction history
```gql
{
digitalaxGarmentAuctionHistories(where:{token_in:["3"]}) {
id
eventName
timestamp
transactionHash
bidder {
id
}
value
token {
id
owner
primarySalePrice
tokenUri
children {
id
amount
tokenUri
parentId
childId
tokenUri
}
}
}
}
```
* Get garments owned by collector
```
{
digitalaxCollectors {
id
childrenOwned {
id
childId
amount
owner
tokenUri
}
parentsOwned {
id
tokenUri
designer
primarySalePrice
children {
id
}
}
}
}
```
* Get listings for garment designer
```
{
digitalaxGarmentDesigners {
id
listings {
reservePrice
startTime
endTime
resulted
topBidder {
id
}
topBid
lastBidTime
}
}
}
```
* Auction global config
```
{
digitalaxAuctionContracts {
minBidIncrement
bidWithdrawalLockTime
platformFee
platformFeeRecipient
totalSales
}
}
```
* Get history for days
```
{
days{
id
totalBidValue
totalWithdrawalValue
totalNetBidActivity
}
}
```