-
Notifications
You must be signed in to change notification settings - Fork 53
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
NFTStorefront v1 & v2 Cadence 1.0 Refactor #89
Conversation
* update go lib * ci: update emulator version the version specified wasn't released
Basic cleanups to set stage for more coming
* add functionality of ghost listing * add testing for the function * fix flow.json * minor fix * Typos hunter * change function name --------- Co-authored-by: Álvaro Lillo Igualada <[email protected]>
* add documentation related to the ghost listing * Update docs/documentation.md Co-authored-by: Joshua Hannan <[email protected]> * Update scripts/has_listing_become_ghosted.cdc Co-authored-by: Joshua Hannan <[email protected]> * Update scripts/has_listing_become_ghosted.cdc Co-authored-by: Joshua Hannan <[email protected]> * Update scripts/has_listing_become_ghosted.cdc Co-authored-by: Joshua Hannan <[email protected]> * Update docs/documentation.md Co-authored-by: j pimmel <[email protected]> * add a recomendation to use cleanup ghost listing * Update docs/documentation.md Co-authored-by: j pimmel <[email protected]> * Update docs/documentation.md Co-authored-by: j pimmel <[email protected]> * Update docs/documentation.md Co-authored-by: j pimmel <[email protected]> * minor fixes --------- Co-authored-by: Joshua Hannan <[email protected]> Co-authored-by: j pimmel <[email protected]>
* update the core contracts * fix test cases * minor fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like v2 still needs some work, so I can come back to this review once you have the tests passing
Progress on this PR is blocked until flow-ft and flow-nft repos have fully functional stable cadence branches, especially the former. |
…Also add new cadence testing framework for storefrontv2 testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good! Just a few small comments about style and stuff. I only have reviewed the contract changes so far but I can get to the transactions and stuff later after you've addressed my initial comments.
Remember to update to all the latest versions of the emulator, cadence, and CLI so that we can be sure that we're testing with the most up to date versions. I left some comments where that would apply for CI and the Go tests, but I'm not sure where the dependencies are imported for the JS tests. You might need to update those too
…v1. And update some documentation for cadence 1.0.
@joshuahannan thanks for the comments, newest update should address all of them. I also removed the go testing entirely which makes the version issue not a problem. The previous go testing was very simple testing targeted only towards storefrontv1, and so I've replaced it with new cadence testing for storefrontv1. |
I'm using the stable cadence version of NFTStorefront and borrowNFT is always reverting for me here: Commenting this line makes it work obviously |
Taking a look at this - In create listing we're using the following code: |
I think a test covering borrowNFT would be sufficient |
Thanks for bringing this up. I added a new script and test case to cover borrowNFT now, also updated the previewnet build to reflect the fix needed to properly check the nft type. If you run into any more issues please keep them coming here! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a couple more comments. Basically just entitlement naming and some view functions. I'd really like to get all of these deployed on previewnet and staged on testnet soon. Right now it only looks like V2 is staged. Community members have been bugging us about it. Let me know when you think you'll be able to get to these and do the staging/deployments.
I updated all the dependencies, addressed all my previous comments on this PR, and got the cadence tests passing. NFTStorefront is staged on testnet, but NFTStorefrontV2 is not staged on testnet because we are still looking for the key information for the account. Missing key information for previewnet also Any more reviews here would be much appreciated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left comments, but nothing that can't be addressed in a follow up - no reason to block. I can't leave an approval since I originally submitted the PR, but LGTM ✅
/// Buyer of the listing (,i.e. underling NFT) would authorize and sign the | ||
/// transaction and if purchase happens then transacted NFT would store in | ||
/// buyer's collection. | ||
|
||
transaction(listingResourceID: UInt64, storefrontAddress: Address, commissionRecipient: Address?) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're moving to a generalized interface for NFT & FT transactions, it'd be worth making this transaction compatible with any standard asset instead of the statically declared ExampleToken & ExampleNFT IMO
// withdraw the NFT from the owner's collection | ||
let nft <- self.collectionRef.withdraw(withdrawID: id) | ||
|
||
destroy nft |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be nice to see Burner.burn
used here
// // Create the royalty details | ||
// var count = 0 | ||
// var royalties: [MetadataViews.Royalty] = [] | ||
// while royaltyBeneficiaries.length > count { | ||
// let beneficiary = royaltyBeneficiaries[count] | ||
// let beneficiaryCapability = getAccount(beneficiary).capabilities.get<&{FungibleToken.Receiver}>( | ||
// MetadataViews.getRoyaltyReceiverPublicPath() | ||
// ) ?? panic("Beneficiary does not have Receiver configured at RoyaltyReceiverPublicPath") | ||
|
||
// royalties.append( | ||
// MetadataViews.Royalty( | ||
// receiver: beneficiaryCapability, | ||
// cut: cuts[count], | ||
// description: royaltyDescriptions[count] | ||
// ) | ||
// ) | ||
// count = count + 1 | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this can be uncommented
transaction( | ||
saleItemID: UInt64, | ||
saleItemPrice: UFix64, | ||
customID: String?, | ||
commissionAmount: UFix64, | ||
expiry: UInt64, | ||
marketplacesAddress: [Address] | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above about generalizing the transaction interface for use with any NFT & FT
@sisyphusSmiling I addressed your comments about the contracts and pushed my changes. I created an issue for the transaction changes that I am going to come back to later |
Closes: #87
This PR targets the existing
stable-cadence
branch, so includes some updates from main. The idea is to usestable-cadence
as the working Stable Cadence branch moving forward.Dependencies pulled from respective repo's stable-cadence branches:
The changes against NFTStorefront and accompanying transactions & scripts have been made to conform to Cadence 1.0 language updates.
Note: It looks like the test suite is running the current version of Cadence as tests are not passing.
TODO: