Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    M'bark Erras
    @MbarkErras
    @wereITS you didn't specify if function should be public or private
    reyen
    @reyen_gitlab
    Hi everyone
    uint[] numbers;
    numbers.push(5);
    numbers.push(10);
    numbers.push(15);
    ERROR: Expected ';' but got '.'
    numbers.push(10);
    adam
    @IMVVVVVIP
    初来乍到多多指教
    Aman Bhargava
    @thenamesmickey
    can anyone explain me the voters solidity program
    realisation
    @realisation
    Can I have remote joint sessions?
    cs19mtech11020
    @cs19mtech11020
    How to call a function in contract from a different account(other than the account from which it is deployed) ?
    Monir Shaker
    @Moniroaf
    any one has good voting blockchain or rating blockchian code no solidity
    Justin
    @gititGoro
    Hi there, ethfiddle seems to have a bug currently: in the js console window, I'm getting CORS issues and when I compile I get
    "Uncaught (in promise) abort("Assertion failed: Cannot call unknown function compileJSON, make sure it is exported"). Build with -s ASSERTIONS=1 for more info."
    XDYB
    @XDYB
    compliling....
    Always show compliing....

    pragma solidity ^0.5.10;

    contract Persion {
    uint public age;
    }

    chungbacki
    @chungbacki
    ???
    Aveesh Shetty
    @Aveesh52
    Hey
    rooat
    @rooat
    Hi
    nishantbhutani
    @nishantbhutani

    pragma solidity^0.5.1;

    contract Courier {
    enum PackageStatus {
    inTransit,
    received,
    cancelled,
    arrived,
    booked
    }

    struct Package {
        uint id;
        uint weight;
        address sender;
        PackageStatus status;
        address receiver;
    }
    uint MULTIPLIER = 1;
    mapping (uint => address payable) public packageCourierId;
    mapping (address => uint) public pendingDeliveryCharge;
    Package[] private _packages;
    event PackageBooked(uint id, address sender, address receiver, uint weight);
    event PackagePicked(uint id, address courier, address sender, address receiver);
    event PackageArrived(uint id, address courier, address sender, address receiver);
    event PackageReceived(uint id, address courier, address sender, address receiver);
    event PackageCancelled(uint id, address courier, address sender, address receiver);
    
    function addPackage(uint  _weight, address payable receiver) public payable returns (uint){
        // Multipler is the numerical factor converting weight to delivery charge
        // we are keeping it as 1 for now.  Value must be equal to
        // weight*MULTIPLIER
    
        require(msg.value == _weight*MULTIPLIER, "Incorrect amount");
    
        uint id = _packages.length;
        _packages.push(Package({
            id: id,
            weight: _weight,
            sender: msg.sender,
            status: PackageStatus.booked,
            receiver: receiver
        }));
    
    
    
        emit PackageBooked(id, msg.sender, receiver, _weight);
        pendingDeliveryCharge[msg.sender] += msg.value;
    
        return id;
    
    }
    
    function pickPackage(uint _id) public{
        // courier calls this function to indicate that he has picked up the package
        Package storage currentPackage = _packages[_id];
        require(currentPackage.status == PackageStatus.booked, "Package is already dispatched");
        currentPackage.status = PackageStatus.inTransit;
    
        packageCourierId[_id] = msg.sender;
    
        emit PackagePicked(_id, msg.sender, currentPackage.sender, currentPackage.receiver);
    
    }
    
    function arrivedPackage(uint _id) public{
        // this function will be called by the courier
        // to indicate to the receiver that he has arrived at his address
    
        Package storage currentPackage = _packages[_id];
        require(currentPackage.status == PackageStatus.inTransit, "Package was not in transit for it to arrive");
        currentPackage.status = PackageStatus.arrived;
    
        emit PackageArrived(_id, msg.sender, currentPackage.sender, currentPackage.receiver);
    }
    
    function receivedPackage(uint _id) public payable returns (bool){
        // this function will be called by the receiver
        // to indicate that he has received the package
    
    
        Package storage currentPackage = _packages[_id];
    
        require(currentPackage.receiver == msg.sender && currentPackage.status == PackageStatus.arrived, "Package arrived at wrong receiver");
        currentPackage.status = PackageStatus.received;
        uint deliveryCharge = currentPackage.weight*MULTIPLIER;
        address payable courier = packageCourierId[_id];
    
    
        if(courier.send(deliveryCharge)){
            pendingDeliveryCharge[currentPackage.sender] -= deliveryCharge;
            emit PackageReceived(_id, courier, currentPackage.sender, currentPackage.receiver);
            return true;
        }
        else {
            return false;
        }
    }
    
    function cancelPackage(uint _id) public returns (bool){
        // only sender of package has the right to cancel Package
        // Funds will be given to courier only if he has picked up the package
        Package storage currentPackage = _packages[_id];
        require(msg.sender == currentPackage.sender && (currentPackage.status == PackageStatus.inTransit || currentPackage.status == PackageStatus.booked), "You do not have authorization to cancel package"
    i am not able to deploy this
    can anyone help
    Jon Doe
    @Scalamanga_gitlab
    Hi, can anyone shed some light on why remix IDE just disappeared in the past few hours?
    pedro-ether
    @pedro-ether
    hi
    any one Here_
    ?
    Hola tengo una duda respecto a la temporalidad en solidiy
    estoy haciendo una funcion para un smart contract que bloque a un usuario si ya paso su periodo de tiempo, que es igual a 30 dias..
    CJ42
    @CJ42
    Hello is there any way or workaround to resize memory arrays inside a function in Solidity?
    git-bia19
    @git-bia19
    hii
    Si
    @firevenus
    hi
    Edson Tégila
    @tegila
    hi
    Felix H. C. Maduakor
    @fmaduakor
    Which compiler version are working with ethdiddle?
    0.7.1 is loading without any result
    Technologist
    @B_Blockchain_twitter
    Can you do things like check code instead of compile? More like make it a simulator?
    Blake Watkins
    @blkwtkns
    hi there, I just copied/pasted a contract into the fiddle, and I'm getting errors where emit is being used, anyone happen to know why this might be?
    shoot nvm this chat is dead
    blockchain developer
    @superronaldo
    Hi
    when I verify the contract on ethereum, how can I replace openzepplin...?
    OG NA$A
    @og_nasa_twitter
    ayo
    sup nerds
    is this supposed to be better than other ethereum uis
    compared to remix and others i mean like
    Anthony Huang
    @anthonyhuanggr_twitter
    how can i get the return value but not depoly ?
    CosmosLera
    @CosmosLera
    ufogreys
    @ufogreys
    hello
    i need help to create smartcotnract on tro
    tron blockchain
    Nam Trần Thanh
    @nam05062000_gitlab
    I need help:
    Give me a valid 1 about the constructor of the Voting post with
    Plssssss

    pragma solidity >=0.4.22 <0.7.0;
    contract voting {
    struct Voter {
    uint weight;
    bool if_voted;
    address delegated_to;
    uint vote;
    }
    struct Proposal {
    bytes32 name;
    uint voteCount;
    }

    address public chairperson;
      mapping(address => Voter) public voters;
      Proposal[] public proposals;
      constructor(bytes32[] memory proposalNames) public {
        chairperson = msg.sender;
        voters[chairperson].weight = 1;
    
        for (uint i = 0; i < proposalNames.length; i++) {
            proposals.push(Proposal({
                name: proposalNames[i],
                voteCount: 0
            }));
        }
    }
    function giveRightToVote(address voter) public {
        require(
            msg.sender == chairperson,
            "Only the chairperson can assign voting rights."
        );
        require(
            !voters[voter].voted,
            "The voter has used their ballot."
        );
        require(voters[voter].weight == 0);
        voters[voter].weight = 1;
    }
    function delegate(address to) public {
        Voter storage sender = voters[msg.sender];
        require(!sender.voted, "You have already voted.");
    
        require(to != msg.sender, "You can’t delegate to yourself.");
    
        while (voters[to].delegate != address(0)) {
            to = voters[to].delegate;
            require(to != msg.sender, "Found loop in delegation!");
        }
       sender.voted = true;
        sender.delegate = to;
        Voter storage delegate_ = voters[to];
        if (delegate_.voted) {
            proposals[delegate_.vote].voteCount += sender.weight;
        } else {
            delegate_.weight += sender.weight;
        }
    }
    function vote(uint proposal) public {
        Voter storage sender = voters[msg.sender];
        require(sender.weight != 0, "Cannot vote");
        require(!sender.voted, "Has voted.");
        sender.voted = true;
        sender.vote = proposal;
        proposals[proposal].voteCount += sender.weight;
    }

    function winningProposal() public view
    returns (uint winningProposal)
    {
    uint winningVoteCount = 0;
    for (uint p = 0; p < proposals.length; p++) {
    if (proposals[p].voteCount > winningVoteCount) {
    winningVoteCount = proposals[p].voteCount;
    winningProposal
    = p;
    }
    }
    }

    function winnerName() public view
            returns (bytes32 winnerName_)
    {
        winnerName_ = proposals[winningProposal()].name;
    }

    }

    creation of Voting errored: Error encoding arguments: Error: types/values length mismatch (count={"types":1,"values":3}, value={"types":["bytes32[]"],"values":["",",",""]}, code=INVALID_ARGUMENT, version=abi/5.0.7)
    Aman Arora
    @blockchainDon_twitter
    Hi everyone, I need a support for writing the base contract( abstract) having crud operations, my other contracts will inherit from them to do those operations. My other contracts have various attributes in struct, I am not finding the way to come up with this abstract contract like how it will handle those attributes of struct, can you suggest some sources or sample codes which can be similar to what i am trying to solve? Thanks