-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
General Review of Contracts #58
Comments
Follow up actions to the comments. PackNFT.cdc
28:
60:
64:
70:
83:
97:
121:
174:
204:
228..229: let c <- create Collection()
233:
PDS.cdc
60:
92:
186:
193:
208:
|
These are looking good! Some more fine-grained comments...
PackNFT.cdc
See Recommendation: Include Interfaces In Implementation Contracts #54 .
See Recommendation: Include NFT Collection Public Interface Methods in Type-Specific Public Interface #55 .
see Recommendation: Prefer Borrowing To Withdrawing and Depositing #56 .
28:
pub fun mint(commitHash: String, issuer: Address) {
60:
pub var status: String
64:
pub fun getCommitHash(): String {
commitHash
ispub let
, so this function is not needed.70:
return self._verify(nfts: self.NFTs, salt: self.salt!, commitHash: self.commitHash)
!
will panic/crash if salt is not set. You could useif let
to check if the salt is set, and if not return false if that would make sense. Or if transactions should fail when the salt isn't set this is fine.83:
pub fun getSalt(): String? {
salt
ispub let
, so this function is not needed.97:
let hash = HashAlgorithm.SHA2_256.hash(hashString.utf8)
121:
panic("commitHash was not verified")
assert()
at line 115.174:
let nonfungibleToken <- token
204:
pub fun borrowPackNFT(id: UInt64): &IPackNFT.NFT {
borrow
function return an optional, see: https://github.com/onflow/kitty-items/blob/master/cadence/contracts/KittyItems.cdc#L117228..229: let c <- create Collection()
return <- c
return <- create Collection()
.233:
adminAccount: AuthAccount,
PDS.cdc
See Recommendation: Include Interfaces In Implementation Contracts #54 .
See Recommendation: Prefer Borrowing To Withdrawing and Depositing #56 .
See Simplify hashString() #57 .
60:
pub fun mintPackNFT(commitHashes: [String], issuer: Address){
92:
pub var DistId: UInt64
nextDistId
ordistCount
.186:
if !pdsCollection.check(){
assert()
.193:
access(contract) fun releaseEscrow(nftIds: [UInt64], owner: Address) {
208:
pub fun createPackIssuer (): @PackIssuer{
PackIssuer
s or should this be an admin capability within aDistributionCreator
or some other constraint? It's fine if not, I just wanted to check. :-)The text was updated successfully, but these errors were encountered: