Questions tagged [openbrush]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
15 views

Is there a library similar to ERC-165, In OpenBrush or Ink smart contracts, used to identify the implemented interfaces of a smart contract?

"I'm working on developing smart contracts using OpenBrush and the Ink programming language, and I'm in need of a mechanism to detect and identify the interfaces that a particular smart contract ...
UPENDRA SINGH's user avatar
0 votes
0 answers
39 views

How to write upgradable smart contracts in rust (changing the storage)?

I am writing a smart contract in Rust using the Openbrush library. I am using version 3.0.0. pub const STORAGE_KEY: u32 = openbrush::storage_unique_key!(metaData); #[openbrush::upgradeable_storage(...
Shivam Varshney's user avatar
1 vote
3 answers
58 views

How to call PSP22::approve function from Frontend

Any guidance on how to call my psp22 approve function from the front end ? This is currently how I'm doing it but it doesn't seem to give increased allowance (although its successful) : import { ...
0xD1x0n's user avatar
  • 119
1 vote
1 answer
59 views

How to mint multiple characters randomly?

Let me give scenario, let's say: There are 2 types of playable characters Chickens (90% chance to mint) Foxes (10% chance to mint) and total supply is 15,000 units : 13,500 chickens 1,500 foxes ...
Ganesh11's user avatar
  • 1,208
0 votes
1 answer
27 views

"TooManyTopics" Dispatch Error and Contract Revert when Minting in OpenBrush PSP37 Smart Contract

I am facing an issue with the OpenBrush PSP37 smart contract while calling the mint function. I receive a Contract Reverted! error with a TooManyTopics dispatch error. However, upon inspecting the ...
UPENDRA SINGH's user avatar
1 vote
1 answer
62 views

Getting "Contract Reverted!" error with "TooManyTopics" dispatch error when calling mint function in OpenBrush PSP37 smart contract

I'm working on adding events to an OpenBrush PSP37 smart contract and deploying it using Substrate Contract UI. However, when I try to call the mint function, I encounter the following error: Contract ...
UPENDRA SINGH's user avatar
2 votes
2 answers
652 views

What is the purpose of installing cargo-contract and using it to create Ink! Rust smart contracts?

What's the deal with installing cargo-contract to make Ink! Rust smart contracts? Is it the contract compiler, or is it ructc? Why do we even need it?
UPENDRA SINGH's user avatar
3 votes
2 answers
179 views

Specialization impl does not specialize any associated items

I'm fairly new to Rust and ink! itself. I'm trying to compile and build an extremely basic PSP22 Contract. I get the following error when I compile & build: (running cargo +nightly contract build) ...
0xD1x0n's user avatar
  • 119
1 vote
1 answer
67 views

Explain components of Mapping used by Openbrush. Mainly placeholders for the actual type used in the code. Like ApprovalsKey used in bellow example

I am trying to understand the working of upgradeble storage used by openbrush libraries. I am unable to understand Mapping used in impls of psp34 trait eg pub operator_approvals: Mapping<(Owner,...
UPENDRA SINGH's user avatar
1 vote
1 answer
45 views

Why we use empty struct named as key of particular lib name in mapping while using it in storage of openbrush libraries

When you go through the openbrush smart contract library. You will notice they are using upgradeable smart contract storage and while defining storage they are using some empty struct as key of ...
UPENDRA SINGH's user avatar
2 votes
1 answer
39 views

Missing trait items: `__ink_TraitInfo`, `pausedOutput`

I copied the pausable ink example and am running into the following error (here is the repo/diamond-pattern branch): error[E0046]: not all trait items implemented, missing: `__ink_TraitInfo`, `...
Snowmead's user avatar
  • 605
2 votes
2 answers
237 views

Do ink compiler automatically generate getter function for state variable ( if declared as public ) like solidity language?

In the case of solidity language - In smart contracts, state variables can be made public to allow for easy access and visibility of the data stored in the contract. When a state variable is declared ...
UPENDRA SINGH's user avatar
2 votes
1 answer
71 views

PSP34 Get Attribute Null Value

I Already write code with openbrush.io and set Attribute on constructor here my code : #![cfg_attr(not(feature = "std"), no_std)] #![feature(min_specialization)] #[openbrush::...
jupiter zhuo's user avatar
1 vote
3 answers
113 views

Unable to deploy the open-brush contracts build using toolchain nightly-2023-02-07 on substrate node

As you can see in following link . I was not able to build contract using latest rust nighly ( rustc 1.70.0-nightly (17c116721 2023-03-29)) toolchain. ERROR: Loading of original wasm failed I got the ...
UPENDRA SINGH's user avatar
1 vote
1 answer
54 views

What is the significance of default in open brush contracts traits implementation?

I was going through the code of open brush implementation for different tokens, and was confused at a point in PSP22 contract where there is a word written default, as shown below default fn ...
Shubham Gupta's user avatar
0 votes
1 answer
35 views

Can I make a cross-contract call with constructor (function with "#[ink(constuctor)]" attribute) in ink! contract?

I've been trying to implement cross contract calls in constrcutor but somehow I can't seem to make it right. Is the following code executable? #[openbrush::contract] pub mod contract { #[ink(storage)...
linnefromice's user avatar
3 votes
1 answer
89 views

ContractTrapped, transfer_from CalleeTrapped

DispatchError: ContractTrapped DispatchError docs: Contract trapped during execution. Debug message: panicked at 'encountered error while calling <AccountId as PSP22>::transfer_from: ...
Rodrigo Paredes's user avatar
2 votes
4 answers
97 views

ink-e2e: Metadata artifacts not generated when importing crate

Context: I am trying to detach end-to-end tests from my main contract lib.rs. I created a new module in tests_e2e.rs. I import the module in main contract like so: lib.rs...vvv #[cfg(all(test, feature ...
blairmunroakusa's user avatar
0 votes
1 answer
52 views

Difference between {Contract}Ref and Hash?

while contract instantiation inside constructor new function parameter, we can find {Contract}Ref and Hash. If new function accepts {Contract}Ref as parameter, then type is AccountId and if new ...
Ganesh11's user avatar
  • 1,208
0 votes
2 answers
154 views

Traits with "#[openbrush::trait_definition]" cannot be referenced

I want to implement a base contract that multiple contracts should implement. I decided to use "#[openbrush::trait_definition]" because "[#ink(message)]" cannot be added in the ...
s.Takahashi's user avatar
1 vote
1 answer
85 views

What is new way to implement custom data structs (in ink! 4)?

I am trying to upgrade then compile a token contract (employing openbrush) from ink!3 to ink!4. My understanding is that SpreadAllocate, StorageLayout, etc. have been removed from the ink!4 release. ...
blairmunroakusa's user avatar
1 vote
2 answers
118 views

PSP22 cross-contract call to get metadata such as token decimals and token name using ink!

I have a little problem here. I have the address of a contract (PSP22 token) with the {}Ref associated with it. I want to make a cross-contract call to get the decimals of the contract. Its Ref is use ...
Edinyanga Ottoho's user avatar
3 votes
1 answer
72 views

Best practices for handling my own errors and openbrush's errors?

I am using ink! to implement the contract. I have implemented my own error, and the contract function has this own error as a return value. For example, suppose that function implements openbrush's ...
s.Takahashi's user avatar
1 vote
1 answer
73 views

What is the 'wasm' argument in CodePromise?

I'm building an application that allows anyone to deploy PSP34 using Openbrush contract. I want to allow users to deploy a new contract from the UI and upload an image to mint the NFT. I have ...
Steve's user avatar
  • 83
0 votes
1 answer
77 views

PSP34Mintable::mint() as payable function

I'm using PSP34 from openbrush in ink! contract and want to override mint() function that comes with PSP34Mintable trait. Since this contract should accept payments for the mint() call, a payable is ...
Maario's user avatar
  • 659
2 votes
1 answer
355 views

How to implement cross contract calls correctly?

I've been trying for a few days now to implement cross contract calls but somehow I can't seem to make it right. So here is my code and I hope one of you can point out my mistake to me. I want to call ...
rajohs's user avatar
  • 491