inkdevhub / marketplace Goto Github PK
View Code? Open in Web Editor NEWExample NFT marketplace project using ink! smart contract.
License: Apache License 2.0
Example NFT marketplace project using ink! smart contract.
License: Apache License 2.0
I have problems with calling factory
function on the marketplace contract.
I though first time that I did not set contract hash but the error is still there.
Built with latest main at hash 0xedf9dde8b7c52a23ef3972268217a92f3c356707388aaa68a3952e31973797c3
Failed Txs
https://shibuya.subscan.io/account/Z7rYZFFCFt9B2cv692TSWnxTKM1CYnoukBhxUd39ajsYWTe
Example of call:
The supplied hash of RMRK smart contract
0xd22f1aabf3d04bfba1ef5d0b5a5e1fa4764df7224afd1ee1422a8344a54b490f
I was trying to build the project #5
but seems like some dependency is missing
2023-01-22T19:20:30.472966Z INFO cargo_contract::util: Invoking cargo: "/Users/vikival/.rustup/toolchains/nightly-2022-08-15-aarch64-apple-darwin/bin/cargo" "build" "--target=wasm32-unknown-unknown" "-Zbuild-std" "--no-default-features" "--release" "--target-dir=/Users/vikival/Documents/Work/KodaDot/marketplace/target/ink/marketplace" "--features=ink_env/ink-debug"
Updating crates.io index
Updating git repository `https://github.com/Supercolony-net/openbrush-contracts`
Updating git repository `https://github.com/Supercolony-net/pallet-assets-chain-extension`
Updating git repository `https://github.com/swanky-dapps/nft`
error: no matching package named `pallet_payable_mint` found
location searched: https://github.com/swanky-dapps/nft
required by package `shiden34 v0.2.0 (/private/var/folders/tw/g2bzmzdn51q9v0z03y3nb9fr0000gn/T/cargo-contract_YmbDpK/contracts/shiden34)`
... which satisfies path dependency `shiden34` of package `pallet_marketplace v0.2.0 (/private/var/folders/tw/g2bzmzdn51q9v0z03y3nb9fr0000gn/T/cargo-contract_YmbDpK/logics)`
... which satisfies path dependency `pallet_marketplace` of package `marketplace v0.2.0 (/private/var/folders/tw/g2bzmzdn51q9v0z03y3nb9fr0000gn/T/cargo-contract_YmbDpK/contracts/marketplace)`
ERROR: `"/Users/vikival/.rustup/toolchains/nightly-2022-08-15-aarch64-apple-darwin/bin/cargo" "build" "--target=wasm32-unknown-unknown" "-Zbuild-std" "--no-default-features" "--release" "--target-dir=~/marketplace/target/ink/marketplace" "--features=ink_env/ink-debug"` failed with exit code: Some(101)
The exported data told me there is no event emitted for the whole marketplace.
The minimum I have out of my head
/// should be also emitted for unlist
#[ink(event)]
pub struct TokenListed {
#[ink(topic)]
contract: AccountId,
#[ink(topic)]
id: Id,
#[ink(topic)]
price: Option<Balance>,
}
/// price 'cause user can send more
#[ink(event)]
pub struct TokenBought {
#[ink(topic)]
contract: AccountId,
#[ink(topic)]
id: Id,
#[ink(topic)]
price: Balance,
}
/// can be also emitted for factory
#[ink(event)]
pub struct CollectionRegistered {
#[ink(topic)]
contract: AccountId,
metadada: Bytes
}
export type Event = never
export type Message = Message_MarketplaceSale_unlist | Message_MarketplaceSale_register | Message_MarketplaceSale_buy | Message_MarketplaceSale_set_marketplace_fee | Message_MarketplaceSale_set_fee_recipient | Message_MarketplaceSale_get_price | Message_MarketplaceSale_list | Message_MarketplaceSale_factory | Message_MarketplaceSale_get_max_fee | Message_MarketplaceSale_get_registered_collection | Message_MarketplaceSale_get_marketplace_fee | Message_MarketplaceSale_set_nft_contract_hash | Message_MarketplaceSale_get_fee_recipient | Message_MarketplaceSale_set_contract_metadata | Message_MarketplaceSale_nft_contract_hash
Not sure if this is implemented but the marketplace contract should emit CollectionRegistered
when the factory
method is called
Is this compatible with Substrate node?
My node is running and all installation is completed. However, when run yarn test
I failed all of the cases.
Marketplace tests
2023-01-27 21:36:24 API/INIT: RPC methods not decorated: transaction_unstable_submitAndWatch, transaction_unstable_unwatch
1) setup and mint works
2023-01-27 21:36:25 API/INIT: RPC methods not decorated: transaction_unstable_submitAndWatch, transaction_unstable_unwatch
2) setMarketplaceFee works
2023-01-27 21:36:25 API/INIT: RPC methods not decorated: transaction_unstable_submitAndWatch, transaction_unstable_unwatch
3) register contract works for the Marketplace owner
2023-01-27 21:36:25 API/INIT: RPC methods not decorated: transaction_unstable_submitAndWatch, transaction_unstable_unwatch
4) register contract fails if fee is too high
2023-01-27 21:36:25 API/INIT: RPC methods not decorated: transaction_unstable_submitAndWatch, transaction_unstable_unwatch
5) list / unlist works
2023-01-27 21:36:25 API/INIT: RPC methods not decorated: transaction_unstable_submitAndWatch, transaction_unstable_unwatch
6) list fails if not a nft owner
2023-01-27 21:36:25 API/INIT: RPC methods not decorated: transaction_unstable_submitAndWatch, transaction_unstable_unwatch
7) list fails if token is already listed
2023-01-27 21:36:25 API/INIT: RPC methods not decorated: transaction_unstable_submitAndWatch, transaction_unstable_unwatch
8) unlist fails if token is not listed
2023-01-27 21:36:25 API/INIT: RPC methods not decorated: transaction_unstable_submitAndWatch, transaction_unstable_unwatch
9) buy works
2023-01-27 21:36:26 API/INIT: RPC methods not decorated: transaction_unstable_submitAndWatch, transaction_unstable_unwatch
10) setContractMetadata works
2023-01-27 21:36:26 API/INIT: RPC methods not decorated: transaction_unstable_submitAndWatch, transaction_unstable_unwatch
11) setContractMetadata returns error if no contract
2023-01-27 21:36:26 API/INIT: RPC methods not decorated: transaction_unstable_submitAndWatch, transaction_unstable_unwatch
12) setNftContractHash works
2023-01-27 21:36:26 API/INIT: RPC methods not decorated: transaction_unstable_submitAndWatch, transaction_unstable_unwatch
13) setNftContractHash fails if not an owner
2023-01-27 21:36:26 API/INIT: RPC methods not decorated: transaction_unstable_submitAndWatch, transaction_unstable_unwatch
14) factory works
0 passing (2s)
14 failing
Marketplace tests
setup and mint works:
Error: The runtime does not expose api.tx.contracts.instantiateWithCode with storageDepositLimit
at new Base (node_modules/@polkadot/api-contract/cjs/base/Base.js:17:13)
at new Code (node_modules/@polkadot/api-contract/cjs/base/Code.js:29:5)
at new CodePromise (node_modules/@polkadot/api-contract/cjs/promise/index.js:20:5)
at Constructors.new (types/constructors/marketplace.ts:32:16)
at setup (tests/marketplace.spec.ts:61:59)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Context. (tests/marketplace.spec.ts:73:5)
Marketplace tests
setMarketplaceFee works:
Error: The runtime does not expose api.tx.contracts.instantiateWithCode with storageDepositLimit
at new Base (node_modules/@polkadot/api-contract/cjs/base/Base.js:17:13)
at new Code (node_modules/@polkadot/api-contract/cjs/base/Code.js:29:5)
at new CodePromise (node_modules/@polkadot/api-contract/cjs/promise/index.js:20:5)
at Constructors.new (types/constructors/marketplace.ts:32:16)
at setup (tests/marketplace.spec.ts:61:59)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Context. (tests/marketplace.spec.ts:82:5)
Marketplace tests
register contract works for the Marketplace owner:
Error: The runtime does not expose api.tx.contracts.instantiateWithCode with storageDepositLimit
at new Base (node_modules/@polkadot/api-contract/cjs/base/Base.js:17:13)
at new Code (node_modules/@polkadot/api-contract/cjs/base/Code.js:29:5)
at new CodePromise (node_modules/@polkadot/api-contract/cjs/promise/index.js:20:5)
at Constructors.new (types/constructors/marketplace.ts:32:16)
at setup (tests/marketplace.spec.ts:61:59)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Context. (tests/marketplace.spec.ts:90:5)
Marketplace tests
register contract fails if fee is too high:
Error: The runtime does not expose api.tx.contracts.instantiateWithCode with storageDepositLimit
at new Base (node_modules/@polkadot/api-contract/cjs/base/Base.js:17:13)
at new Code (node_modules/@polkadot/api-contract/cjs/base/Code.js:29:5)
at new CodePromise (node_modules/@polkadot/api-contract/cjs/promise/index.js:20:5)
at Constructors.new (types/constructors/marketplace.ts:32:16)
at setup (tests/marketplace.spec.ts:61:59)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at runNextTicks (node:internal/process/task_queues:64:3)
at processImmediate (node:internal/timers:446:9)
at async Context. (tests/marketplace.spec.ts:101:5)
Marketplace tests
list / unlist works:
Error: The runtime does not expose api.tx.contracts.instantiateWithCode with storageDepositLimit
at new Base (node_modules/@polkadot/api-contract/cjs/base/Base.js:17:13)
at new Code (node_modules/@polkadot/api-contract/cjs/base/Code.js:29:5)
at new CodePromise (node_modules/@polkadot/api-contract/cjs/promise/index.js:20:5)
at Constructors.new (types/constructors/marketplace.ts:32:16)
at setup (tests/marketplace.spec.ts:61:59)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Context. (tests/marketplace.spec.ts:111:5)
Marketplace tests
list fails if not a nft owner:
Error: The runtime does not expose api.tx.contracts.instantiateWithCode with storageDepositLimit
at new Base (node_modules/@polkadot/api-contract/cjs/base/Base.js:17:13)
at new Code (node_modules/@polkadot/api-contract/cjs/base/Code.js:29:5)
at new CodePromise (node_modules/@polkadot/api-contract/cjs/promise/index.js:20:5)
at Constructors.new (types/constructors/marketplace.ts:32:16)
at setup (tests/marketplace.spec.ts:61:59)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Context. (tests/marketplace.spec.ts:132:5)
Marketplace tests
list fails if token is already listed:
Error: The runtime does not expose api.tx.contracts.instantiateWithCode with storageDepositLimit
at new Base (node_modules/@polkadot/api-contract/cjs/base/Base.js:17:13)
at new Code (node_modules/@polkadot/api-contract/cjs/base/Code.js:29:5)
at new CodePromise (node_modules/@polkadot/api-contract/cjs/promise/index.js:20:5)
at Constructors.new (types/constructors/marketplace.ts:32:16)
at setup (tests/marketplace.spec.ts:61:59)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Context. (tests/marketplace.spec.ts:144:5)
Marketplace tests
unlist fails if token is not listed:
Error: The runtime does not expose api.tx.contracts.instantiateWithCode with storageDepositLimit
at new Base (node_modules/@polkadot/api-contract/cjs/base/Base.js:17:13)
at new Code (node_modules/@polkadot/api-contract/cjs/base/Code.js:29:5)
at new CodePromise (node_modules/@polkadot/api-contract/cjs/promise/index.js:20:5)
at Constructors.new (types/constructors/marketplace.ts:32:16)
at setup (tests/marketplace.spec.ts:61:59)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Context. (tests/marketplace.spec.ts:159:5)
Marketplace tests
buy works:
Error: The runtime does not expose api.tx.contracts.instantiateWithCode with storageDepositLimit
at new Base (node_modules/@polkadot/api-contract/cjs/base/Base.js:17:13)
at new Code (node_modules/@polkadot/api-contract/cjs/base/Code.js:29:5)
at new CodePromise (node_modules/@polkadot/api-contract/cjs/promise/index.js:20:5)
at Constructors.new (types/constructors/marketplace.ts:32:16)
at setup (tests/marketplace.spec.ts:61:59)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Context. (tests/marketplace.spec.ts:171:5)
Marketplace tests
setContractMetadata works:
Error: The runtime does not expose api.tx.contracts.instantiateWithCode with storageDepositLimit
at new Base (node_modules/@polkadot/api-contract/cjs/base/Base.js:17:13)
at new Code (node_modules/@polkadot/api-contract/cjs/base/Code.js:29:5)
at new CodePromise (node_modules/@polkadot/api-contract/cjs/promise/index.js:20:5)
at Constructors.new (types/constructors/marketplace.ts:32:16)
at setup (tests/marketplace.spec.ts:61:59)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Context. (tests/marketplace.spec.ts:217:5)
Marketplace tests
setContractMetadata returns error if no contract:
Error: The runtime does not expose api.tx.contracts.instantiateWithCode with storageDepositLimit
at new Base (node_modules/@polkadot/api-contract/cjs/base/Base.js:17:13)
at new Code (node_modules/@polkadot/api-contract/cjs/base/Code.js:29:5)
at new CodePromise (node_modules/@polkadot/api-contract/cjs/promise/index.js:20:5)
at Constructors.new (types/constructors/marketplace.ts:32:16)
at setup (tests/marketplace.spec.ts:61:59)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Context. (tests/marketplace.spec.ts:229:5)
Marketplace tests
setNftContractHash works:
Error: The runtime does not expose api.tx.contracts.instantiateWithCode with storageDepositLimit
at new Base (node_modules/@polkadot/api-contract/cjs/base/Base.js:17:13)
at new Code (node_modules/@polkadot/api-contract/cjs/base/Code.js:29:5)
at new CodePromise (node_modules/@polkadot/api-contract/cjs/promise/index.js:20:5)
at Constructors.new (types/constructors/marketplace.ts:32:16)
at setup (tests/marketplace.spec.ts:61:59)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Context. (tests/marketplace.spec.ts:239:5)
Marketplace tests
setNftContractHash fails if not an owner:
Error: The runtime does not expose api.tx.contracts.instantiateWithCode with storageDepositLimit
at new Base (node_modules/@polkadot/api-contract/cjs/base/Base.js:17:13)
at new Code (node_modules/@polkadot/api-contract/cjs/base/Code.js:29:5)
at new CodePromise (node_modules/@polkadot/api-contract/cjs/promise/index.js:20:5)
at Constructors.new (types/constructors/marketplace.ts:32:16)
at setup (tests/marketplace.spec.ts:61:59)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at runNextTicks (node:internal/process/task_queues:64:3)
at processImmediate (node:internal/timers:446:9)
at async Context. (tests/marketplace.spec.ts:251:5)
Marketplace tests
factory works:
Error: The runtime does not expose api.tx.contracts.instantiateWithCode with storageDepositLimit
at new Base (node_modules/@polkadot/api-contract/cjs/base/Base.js:17:13)
at new Code (node_modules/@polkadot/api-contract/cjs/base/Code.js:29:5)
at new CodePromise (node_modules/@polkadot/api-contract/cjs/promise/index.js:20:5)
at Constructors.new (types/constructors/marketplace.ts:32:16)
at setup (tests/marketplace.spec.ts:61:59)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Context. (tests/marketplace.spec.ts:262:5)
error Command failed with exit code 14.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.