flow-hydraulics / flow-pds

This repository is currently not maintained
4 stars 8 forks source link

General Review of Contracts #58

Closed rheaplex closed 2 years ago

rheaplex commented 2 years ago

These are looking good! Some more fine-grained comments...

PackNFT.cdc

28: pub fun mint(commitHash: String, issuer: Address) {

60: pub var status: String

64: pub fun getCommitHash(): String {

70: return self._verify(nfts: self.NFTs, salt: self.salt!, commitHash: self.commitHash)

83: pub fun getSalt(): String? {

97: let hash = HashAlgorithm.SHA2_256.hash(hashString.utf8)

121: panic("commitHash was not verified")

174: let nonfungibleToken <- token

204: pub fun borrowPackNFT(id: UInt64): &IPackNFT.NFT {

228..229: let c <- create Collection() return <- c

233: adminAccount: AuthAccount,

PDS.cdc

60: pub fun mintPackNFT(commitHashes: [String], issuer: Address){

92: pub var DistId: UInt64

186: if !pdsCollection.check(){

193: access(contract) fun releaseEscrow(nftIds: [UInt64], owner: Address) {

208: pub fun createPackIssuer (): @PackIssuer{

whalelephant commented 2 years ago

Follow up actions to the comments.

PackNFT.cdc

Please see comments

28: pub fun mint(commitHash: String, issuer: Address) {

Please See https://github.com/flow-hydraulics/flow-pds/pull/74

60: pub var status: String

64: pub fun getCommitHash(): String {

No longer applicable

70: return self._verify(nfts: self.NFTs, salt: self.salt!, commitHash: self.commitHash)

This shoud crash without salt

83: pub fun getSalt(): String? {

No longer applicable

97: let hash = HashAlgorithm.SHA2_256.hash(hashString.utf8)

Please see comment on #57

121: panic("commitHash was not verified")

Please See https://github.com/flow-hydraulics/flow-pds/pull/74

174: let nonfungibleToken <- token

Please See https://github.com/flow-hydraulics/flow-pds/pull/74

204: pub fun borrowPackNFT(id: UInt64): &IPackNFT.NFT {

Please See https://github.com/flow-hydraulics/flow-pds/pull/74

228..229: let c <- create Collection() return <- c

Please See https://github.com/flow-hydraulics/flow-pds/pull/74

233: adminAccount: AuthAccount,

Please See https://github.com/flow-hydraulics/flow-pds/pull/74

PDS.cdc

Please see comments

60: pub fun mintPackNFT(commitHashes: [String], issuer: Address){

Please See https://github.com/flow-hydraulics/flow-pds/pull/74

92: pub var DistId: UInt64

Please See https://github.com/flow-hydraulics/flow-pds/pull/74

186: if !pdsCollection.check(){

Please See https://github.com/flow-hydraulics/flow-pds/pull/74

193: access(contract) fun releaseEscrow(nftIds: [UInt64], owner: Address) {

Please See https://github.com/flow-hydraulics/flow-pds/pull/74

208: pub fun createPackIssuer (): @PackIssuer{

The PackIssuer should be created by anyone as a capability receiver for DistCap