2

I added these pallets into runtime Cargo.toml :

pallet-contracts = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git",  " branch" = "polkadot-v0.9.35" }
pallet-contracts-primitives = { version = "7.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git",  " branch" = "polkadot-v0.9.35" }

And added this codes into the lib.rs:

construct_runtime!(
    pub struct Runtime
    where
        Block = Block,
        NodeBlock = opaque::Block,
        UncheckedExtrinsic = UncheckedExtrinsic,
    {
        DEX: pallet_dex,
        Contracts: pallet_contracts,

    }
);

config :

parameter_types! {
    pub const DepositPerItem: Balance = deposit(1, 0);
    pub const DepositPerByte: Balance = deposit(0, 1);
    pub const DeletionQueueDepth: u32 = 128;
    pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO * BlockWeights::get().max_block;
    pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();
  }

impl pallet_contracts::Config for Runtime {
    type Time = Timestamp;
    type Randomness = RandomnessCollectiveFlip;
    type Currency = Balances;
    type RuntimeEvent = RuntimeEvent;
    type RuntimeCall = RuntimeCall;
    type CallFilter = Nothing;
    type WeightPrice = pallet_transaction_payment::Pallet<Self>;
    type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;
    type ChainExtension = ();
    type Schedule = Schedule;
    type CallStack = [pallet_contracts::Frame<Self>; 31];
    type DeletionQueueDepth = DeletionQueueDepth;
    type DeletionWeightLimit = DeletionWeightLimit;
    type DepositPerByte = DepositPerByte;
    type DepositPerItem = DepositPerItem;
    type AddressGenerator = pallet_contracts::DefaultAddressGenerator;
    type MaxCodeLen = ConstU32<{ 256 * 1024 }>;
    type MaxDebugBufferLen = ConstU32<{ 256 * 1024 }>;

    type MaxStorageKeyLen = ConstU32<{ 512 * 1024 }>;
    type UnsafeUnstableInterface = ConstBool<true>;
}

In the next step I want to upload a smart contract in this enviroment :

https://contracts-ui.substrate.io/instantiate

enter image description here

**** But the next button isn't active, and also I can't find the contract address.

What's the problem? How can I solve this problem???

1
  • Can you share your repo link here. Jun 12, 2023 at 16:18

1 Answer 1

2

It looks like is an issue with the version. See the alert from the Substrate Contracts UI repository:

❗Only compatible with nodes that use WeightV2. For older nodes use this deployment❗

Try to deploy the smart contract in using this link: https://weightv1--contracts-ui.netlify.app/

Or try to update your node using the last version of Polkadot. For testing you can try to run the last version of substrate-contracts-node and see if your contract can be deployed here.

4
  • thanks for answer but i want to use my substrate node , not using the substrate-contract-node .
    – Mr Coder
    Feb 2, 2023 at 16:39
  • 1
    Yes, it was just to test. With your node as I said in the response try to upload your contract in weightv1--contracts-ui.netlify.app or update the version of your node.
    – Alex Bean
    Feb 2, 2023 at 16:42
  • man sorry for this but i still dont undrestand . let me explain my project . i want to implement dex in substrate . user can upload them smart contract and add that contract address into the my dex . know if i use ` substrate-contracts-node` for upload the smart contract , can i access to that smart contract for transfer token or any thing in my substrate node or not ?
    – Mr Coder
    Feb 2, 2023 at 17:06
  • Your issue here is that the next button isn't active, so you can not deploy the smart contract, isn't it? Try to upload using the link I mention before instead of the contracts-ui.substrate.io
    – Alex Bean
    Feb 2, 2023 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.