Repository navigation
contracts: instrument NFT, one catalogue per publisher, sales left to marketplaces - #269
Draft
petersalomonsen wants to merge 2 commits into
Draft
petersalomonsen wants to merge 2 commits into
petersalomonsen wants to merge 2 commits into
Conversation
…plits Publishing stores the source in contract state and mints a token whose ID is the source hash. Songs name their instruments, and a sale credits those tokens, so earnings follow the instrument's current owner. JavaScript can customize the split, while Rust enforces the limits and holds the money. Tested against a NEAR sandbox, which CI runs too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Deploying webassemblymusic with
|
| Latest commit: |
7233b3c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://625e971f.webassemblymusic.pages.dev |
| Branch Preview URL: | https://instrument-nfts.webassemblymusic.pages.dev |
Removes buy, listings, earnings and publishing deposits, so the contract holds no sale money. Only the owner publishes and posts JavaScript, and Rust caps whatever the script returns at the work's declared royalty. Songs can credit instruments in other contracts through a fixed payee. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a NEAR contract that is one publisher's catalogue of Faust instruments and songs, with their source on-chain. When a song sells on a marketplace, its royalty goes to the owners of the instruments it credits.
This is a draft: the contract is tested, but it isn't on mainnet and the app doesn't use it yet.
What's here
contracts/instrument-nft/src/lib.rs: the contract. See the README for its calls and limits.contracts/instrument-nft/e2e/contract.test.mjs: 19 tests against a real NEAR sandbox.instrument-nftjob in.github/workflows/main.yml: builds from scratch and runs those tests.Design decisions to review
buy, listings or held earnings. Marketplaces use NEP-178 approvals and NEP-199 payouts, so the contract holds no sale money.webassemblymusic.nearstays untouched, because holding any token there grants other things, including git proxy access.Trade-offs
payee, because a view call can't read that contract's owner. Within one contract, they follow the NFT.Measured
publish_instrumentnft_transfer_payout, default rulenft_transfer_payout, JS ruleThe contract is 1.15 MB, which locks 11.54 NEAR.
Testing
All 19 sandbox tests pass locally. CI is running on this commit.
Testnet rehearsal on
wm-instruments-mw87md4p.testnet: a song was sold for 1 NEAR on Mintbase's testnet market (market-v2-beta.mintspace2.testnet), with a 30% royalty crediting an instrument that had been transferred to a new owner. The instrument's new owner received 0.297 NEAR and the seller 0.703, and the song moved to the buyer. Paras's testnet market refused the contract because it isn't on its approved list.A JS rule hasn't been through a real marketplace yet, only through the sandbox tests.
Before this leaves draft
instruments.webassemblymusic.neardecided (a deploy needs separate approval)🤖 Generated with Claude Code