Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Anubhav Gupta
    @array-addu

    Can someone suggest me how to use estimateGas for function calls like below:

    await (MyContract.methods.addDoc(id,sha256hash).send({from: coinbase[0],gas: 1000000})

    rushabh parmar
    @parmarrushabh
    hello everyone
    any go developer who wants to work as a freelancer please fill free to contact me
    Retrofred
    @retrofred1_twitter
    looking to implement smart contracts to IOT devices, any experienced devs with this?
    rushabh parmar
    @parmarrushabh
    image.png
    vikramvaishnav
    @vikramvaishnav
    Hello, I am new to dapp. I am trying to create my first dapp through truffle pet-shop but i got error in testing contract please help.
    Here is Error
    TypeError: Member "adopt" not found or not visible after argument-dependent lookup in type(contract Adoption).
    uint returnPetId=Adoption.adopt(expectedPetId);
    ^------------^
    Thanks in Advance
    Brian Liotti
    @bliotti
    @vikramvaishnav add your first test function after the expectedPetID and expectedAdopter declarations
    Shivam Srivastava
    @shivam3746
    Hey can anyone help me in writing javascript tests for my smart contract
    As i am little bit confused
    Evan Conrad
    @Flaque
    Hi, if I had a generic non-truffle-specific question about dapp's/ERC specs, could I ask that here? Or is there a better place?
    Micu Emerson
    @MicuEmerson
    codeyfour
    @codeyfour
    hi - i have a newbie question. I've built a solidity smart contract with nodejs front end, its all hooked in and communicating. How do I actually send values between the front end and backend?
    Micu Emerson
    @MicuEmerson
    constructor(string memory _firstName, string memory _lastName, string memory _SID) public {
            owner = msg.sender;
            firstName = _firstName;
            lastName = _lastName;
            SID = _SID;
        }
    
        modifier checkAccess(bool access) {
            require(
                access == true, 
                "Access denied"
            );
            _;
        }
    
        function getAccess() public view returns(bool access){
            if(msg.sender == owner){
                access = true;
            }
            else{
                access = false;
            }
        }
    
        function getFirstName() public view checkAccess(this.getAccess()) returns (string memory _firstName){
            _firstName = firstName;
        }
    even if the getAccess gives me true, the modifier checkAccess don't let me use the function, someone have some idea?
    Balaji Pachai
    @balajipachai

    @MicuEmerson

    pragma solidity ^0.5.2;
    
    contract Test {
        bool public access;
        address public owner;
        string public _firstName = "";
    
        constructor() public  {
            owner = msg.sender;
        }
       modifier checkAccess(bool _access) {
            require(
                access == _access, 
                "Access denied"
            );
            _;
        }
    
        function getAccess() public returns (bool success){
            if(msg.sender == owner){
                access = true;
            }
            else{
                access = false;
            }
        }
    
        function getFirstName() public checkAccess(this.getAccess()) returns (string memory firstName){
            return (_firstName);
        }
    
        function setFirstName(string memory name) public {
            _firstName = name;
        }
    
    }

    Since in your case you are using public view getAccess and view functions do not modify the state, thus even if you were getting true for that instance, however it was not persisted in the state, thus, you were getting a transaction revert.
    I have tested above code on Remix compiler and it works as expected.

    cedric walter
    @cedricwalter
    @codeyfour you use https://github.com/ethereum/web3.js/ to connect to your smart contract
    Achille NDTAMA
    @NNAF98

    pragma solidity ^0.5.4;

    contract Hello {
    string greeting;

    constructor() public{
    greeting = "hello !";
    }

    function getGreeting() public view returns (string) {
    return greeting;
    }
    function setGreeting(string _greeting) public {
    greeting = _greeting;
    }
    }

    truffle(develop)> migrate
    Compiling .\contracts\HelloWorld.sol...
    Compiling .\contracts\Migrations.sol...

    /C/Users/NNAF98/repo/contracts/HelloWorld.sol:10:47: TypeError: Data location must be "memory" for return parameter in function, but none was given.
    function getGreeting() public view returns (string) {
    ^----^
    ,/C/Users/NNAF98/repo/contracts/HelloWorld.sol:13:24: TypeError: Data location must be "memory" for parameter in function, but none was given.
    function setGreeting(string _greeting) public {
    ^--------------^
    Compilation failed. See above. THOSE SOMEBODY CAN HELP ME TO SOLVE THIS ERROR??? THANK YOU...

    Alejandro Rodriguez Zavala
    @alexHope26
    Hi @NNAF98 you need chance in the methods
    string by string memory
    function getGreeting() public view returns (string memory) {
    return greeting;
    }
    function setGreeting(string memory _greeting) public {
    greeting = _greeting;
    }
    because you have storage var, and you need work with memory var
    Achille NDTAMA
    @NNAF98
    @alexHope26 thank you much
    Thank you very much, you really take me off a big thorn, I can now continue my training @alexHope26
    Alejandro Rodriguez Zavala
    @alexHope26
    Great !! Good luck!! @NNAF98
    Achille NDTAMA
    @NNAF98
    Thank you•√√
    Ayush Gupta
    @ayushgupta0610
    I'm facing a problem of deploying my smart contract on Remix. When I try to deploy the contract, for some reason the library that my main smart contract uses gets deployed instead of the smart contract. I make sure that the main contract is selected in the drop down as well. Has anyone faced a similar issue?
    Ayush Gupta
    @ayushgupta0610
    How can we check if the input address is a contract address or a user wallet address in the smart contract?
    Fed
    @Fedman78
    Hi guys, How can i calculate the cost of interacting with a smart contract? is theer any tool calculator online?
    Alejandro Rodriguez Zavala
    @alexHope26
    @Fedman78 i suppose that you could test it in remix and see in the stats when you interacting with this contract
    Fed
    @Fedman78
    @alexHope26 Thanks
    cedric walter
    @cedricwalter
    @Fedman78 i personnaly use the mocha test reporter.... quite accurate add https://www.npmjs.com/package/eth-gas-reporter you can see how it would cost in ETH or Fiat to run some scenarios
    Fed
    @Fedman78
    @cedricwalter thanks!
    Sundeep Kumar
    @next2sundeep
    where can i find articles on new security vulnerabilities
    Ayush Gupta
    @ayushgupta0610
    How to achieve the action of approving by a user from a function in another contract (Let's say B) rather than calling the function from the token contract itself (Let's say A)?
    Isn't there any other approach other than inheriting the token contract (A) by the other contract (B), since that's extending the byte code more than the size limit allowed.
    k243
    @k243
    WAnt to develop a BlockChain Based Payments App. ANy suggestions?
    Achille NDTAMA
    @NNAF98
    @Lordcero : ExploitDB
    Srinivas
    @Sriniva63328880_twitter
    Hi all
    Sathish Varman
    @sathish060799
    Anyone here:
    1. Has links to tutorials OR
    2. Knows third party tools OR
    3. Knows companies OR
    4. Knows a friend OR
    5. You yourself
      can teach how to develop a software that is blockchain agnostic( software is compatible with various blockchains instead of being compatible with only one)? I tried searching the Net, but I could not find a single tutorial on this topic. The closest that I came across was this: https://www.youtube.com/watch?v=g-QK9tSo9_s. Thanks in advance.
    Achille NDTAMA
    @NNAF98
    image.png
    who had the same problem as me in compiling the smart contract ballot locally? please need help.
    Hello here..
    Xiao Liang
    @yxliang01
    @NNAF98 Maybe you want to paste the source code here?
    Xiao Liang
    @yxliang01
    Hi there, anyone aware of any tool that can show which statement was covered by a transaction?
    Balaji Pachai
    @balajipachai
    @yxliang01
    This will help you to check which statements were covered
    https://www.npmjs.com/package/solidity-coverage
    Xiao Liang
    @yxliang01
    @balajipachai Thanks for your reply. I am aware of solidity-coverage. However, it's meant to generate coverage report for Truffle test cases, not a generic transaction...
    damianlluch
    @damianlluch

    Hi guys. I developed a SC with Solidity and I have a script that loads the blockchain with test data and when execute first time, It's ok, but when execute other times I get this message:

    VM Exception while processing transaction: revert.

    how can capture this error in try - catch and return my custom message for frontend?.

    thanks!

    this is my code:

    try {
    await deed.create(_serialNumber1, _manufacturer1, _owner1);
    await deed.create(_serialNumber2, _manufacturer2, _owner2);
    await deed.create(_serialNumber3, _manufacturer3, _owner3);
    await deed.create(_serialNumber4, _manufacturer4, _owner4);
    await deed.create(_serialNumber5, _manufacturer5, _owner5);
    await deed.create(_serialNumber6, _manufacturer6, _owner6);
    await deed.create(_serialNumber7, _manufacturer7, _owner7);
    } catch (error) {
    console.log("Error");
    console.log(error.message);
    }

    fredlacs
    @fredlacs
    Newer ganache versions return the revert message
    scarlettouyang
    @scarlettouyang
    Hi guys, if anyone know where could I find all of the open-source contracts/DAPP/DAO templates?
    Xiao Liang
    @yxliang01
    What kind of template are you looking for?