2

I am getting an error attempting to deploy my delegator smart contract. Not sure how to debug this issue.

I use the deploy.sh to upload all smart contract code hashes and pass it afterwards to the instantiate cargo command to deploy the delegator contract. I copied this script originally from the ink-examples repository.

Here is the error I get when attempting to instantiate the delegator contract

$ cargo contract instantiate --manifest-path=Cargo.toml -x --suri //Alice --args 0 0 0x2dc77005d1e64e51910fec8553abeb84d40bd28b1b7871e317e6ee062fe6a236 0x5138b191f83404c1a8d1c1c2a965558aa413868cae54be657d5522f4942c1b41 0xfd7c89608968d6da96747ea70f92909656982832818b227dfd99b74252741a24

 Dry-running new (skip with --skip-dry-run)
          Result ModuleError: Contracts::ContractTrapped: ["Contract trapped during execution."]
    Gas Consumed Weight { ref_time: 1866330052, proof_size: 86246 }
    Gas Required Weight { ref_time: 5231342013, proof_size: 646971 }
 Storage Deposit StorageDeposit::Charge(8060300000000000000)
   Debug Message panicked at 'Cross-contract instantiation failed with TransferFailed', /home/snowmead/.cargo/registry/src/github.com-1ecc6299db9ec823/ink_env-4.2.0/src/call/create_builder.rs:260:17

Here is the github repo

1 Answer 1

2

The following changes to the endowment parameter value fixed the problem. it would be good to know what endowment is and why it made my build fail. endowment documentation is really not clear.

.endowment(total_balance / 4) to .endowment(0)

let accumulator = AccumulatorRef::new(init_value)
                .endowment(0)
                .code_hash(accumulator_code_hash)
                .salt_bytes(salt)
                .instantiate();
2

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.