-
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.
BaseNFT interfaces and helper contracts (#19)
- Loading branch information
1 parent
cc2c3c0
commit 54a12b2
Showing
36 changed files
with
1,648 additions
and
396 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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules/ | ||
coverage.lcov | ||
coverage.lcov | ||
.DS_Store |
Large diffs are not rendered by default.
Oops, something went wrong.
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,192 @@ | ||
[ | ||
{ | ||
"type": "Dictionary", | ||
"value": [ | ||
{ | ||
"key": { | ||
"type": "String", | ||
"value": "dropDetails" | ||
}, | ||
"value": { | ||
"type": "Struct", | ||
"value": { | ||
"id": "A.f8d6e0586b0a20c7.FlowtyDrops.DropDetails", | ||
"fields": [ | ||
{ | ||
"name": "display", | ||
"value": { | ||
"type": "Struct", | ||
"value": { | ||
"id": "A.f8d6e0586b0a20c7.MetadataViews.Display", | ||
"fields": [ | ||
{ | ||
"name": "name", | ||
"value": { | ||
"type": "String", | ||
"value": "My First Drop" | ||
} | ||
}, | ||
{ | ||
"name": "description", | ||
"value": { | ||
"type": "String", | ||
"value": "This is a description for my first drop" | ||
} | ||
}, | ||
{ | ||
"name": "thumbnail", | ||
"value": { | ||
"type": "Struct", | ||
"value": { | ||
"id": "A.f8d6e0586b0a20c7.MetadataViews.IPFSFile", | ||
"fields": [ | ||
{ | ||
"name": "cid", | ||
"value": { | ||
"type": "String", | ||
"value": "QmWWLhnkPR3ejavNtzeJcdG9fwcBHKwBVEP4pZ9rGbdHEM" | ||
} | ||
}, | ||
{ | ||
"name": "path", | ||
"value": { | ||
"type": "Optional", | ||
"value": null | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "medias", | ||
"value": { | ||
"type": "Optional", | ||
"value": null | ||
} | ||
}, | ||
{ | ||
"name": "totalMinted", | ||
"value": { | ||
"type": "Int", | ||
"value": "0" | ||
} | ||
}, | ||
{ | ||
"name": "minters", | ||
"value": { | ||
"type": "Dictionary", | ||
"value": [] | ||
} | ||
}, | ||
{ | ||
"name": "commissionRate", | ||
"value": { | ||
"type": "UFix64", | ||
"value": "0.05" | ||
} | ||
}, | ||
{ | ||
"name": "nftType", | ||
"value": { | ||
"type": "String", | ||
"value": "A.f8d6e0586b0a20c7.MyCollection.NFT" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
{ | ||
"key": { | ||
"type": "String", | ||
"value": "phaseDetails" | ||
}, | ||
"value": { | ||
"type": "Array", | ||
"value": [ | ||
{ | ||
"type": "Struct", | ||
"value": { | ||
"id": "A.f8d6e0586b0a20c7.FlowtyDrops.PhaseDetails", | ||
"fields": [ | ||
{ | ||
"name": "switcher", | ||
"value": { | ||
"type": "Struct", | ||
"value": { | ||
"id": "A.f8d6e0586b0a20c7.FlowtySwitchers.AlwaysOn", | ||
"fields": [] | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "display", | ||
"value": { | ||
"type": "Optional", | ||
"value": null | ||
} | ||
}, | ||
{ | ||
"name": "pricer", | ||
"value": { | ||
"type": "Struct", | ||
"value": { | ||
"id": "A.f8d6e0586b0a20c7.FlowtyPricers.FlatPrice", | ||
"fields": [ | ||
{ | ||
"name": "price", | ||
"value": { | ||
"type": "UFix64", | ||
"value": "1.0" | ||
} | ||
}, | ||
{ | ||
"name": "paymentTokenType", | ||
"value": { | ||
"type": "String", | ||
"value": "A.0ae53cb6e3f42a79.FlowToken.Vault" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "addressVerifier", | ||
"value": { | ||
"type": "Struct", | ||
"value": { | ||
"id": "A.f8d6e0586b0a20c7.FlowtyAddressVerifiers.AllowAll", | ||
"fields": [ | ||
{ | ||
"name": "maxPerMint", | ||
"value": { | ||
"type": "Int", | ||
"value": "100" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "data", | ||
"value": { | ||
"type": "Dictionary", | ||
"value": [] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
] |
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,47 @@ | ||
import "FlowToken" | ||
import "FungibleToken" | ||
|
||
access(all) contract ContractManager { | ||
access(all) let StoragePath: StoragePath | ||
access(all) let PublicPath: PublicPath | ||
|
||
access(all) entitlement Manage | ||
|
||
access(all) resource Manager { | ||
access(self) let acct: Capability<auth(Storage, Contracts, Keys, Inbox, Capabilities) &Account> | ||
|
||
access(Manage) fun borrowContractAccount(): auth(Contracts) &Account { | ||
return self.acct.borrow()! | ||
} | ||
|
||
access(all) fun addFlowTokensToAccount(_ tokens: @FlowToken.Vault) { | ||
self.acct.borrow()!.storage.borrow<&{FungibleToken.Receiver}>(from: /storage/flowTokenVault)!.deposit(from: <-tokens) | ||
} | ||
|
||
access(all) fun getAccount(): &Account { | ||
return getAccount(self.acct.address) | ||
} | ||
|
||
init(tokens: @FlowToken.Vault) { | ||
pre { | ||
tokens.balance >= 0.001: "minimum balance of 0.001 required for initialization" | ||
} | ||
|
||
let acct = Account(payer: ContractManager.account) | ||
self.acct = acct.capabilities.account.issue<auth(Storage, Contracts, Keys, Inbox, Capabilities) &Account>() | ||
assert(self.acct.check(), message: "failed to setup account capability") | ||
|
||
acct.storage.borrow<&{FungibleToken.Receiver}>(from: /storage/flowTokenVault)!.deposit(from: <-tokens) | ||
} | ||
} | ||
|
||
access(all) fun createManager(tokens: @FlowToken.Vault): @Manager { | ||
return <- create Manager(tokens: <- tokens) | ||
} | ||
|
||
init() { | ||
let identifier = "ContractManager_".concat(self.account.address.toString()) | ||
self.StoragePath = StoragePath(identifier: identifier)! | ||
self.PublicPath = PublicPath(identifier: identifier)! | ||
} | ||
} |
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
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
Oops, something went wrong.