goblockchain / GBL

Proposals GoBlockchain Labs
0 stars 0 forks source link

GBL-Reputation #1

Open falehenrique opened 5 years ago

falehenrique commented 5 years ago

Author: Henrique Leite

Category: Smart Contract

Why

The objective in this proposal is a smart contract to control the reputation of collaborators in GoBlockchain. The base of a trust is a reputation, because that were created intermediary to establish relationships of trust between people. When people join a GoBlockchain to make projects or give class, they need to getting points through tasks as participate of creation projects, events, class, etc.

How:

contract Reputation {
    /**
    * contract address
    */
    PersonIdentity public personIdentity;
    /**
    * Profile by collaborators
    */
    enum TypeProfile{COLAB, AMBASSADOR, ESPECIALIST, ADVISOR}
    TypeProfile public typeProfile;

    /**
    * map with id profile and range of reputation
    */
    mapping (uint8 => Profile) mapProfile;

    /**
    * map with the colab address and your profile
    */
    mapping (address => ProfileColab) mapProfileColab;    

    /**
    * Range of reputation, ex:
    * 1 until 100 is a collaborator
    * 101 until 300 is a ambassador    
    */
    struct RangeReputation {
        uint64 start;
        uint64 end;
    }
    /**
    * Profile of collaborators
    */
    struct Profile {
        TypeProfile typeProfile;
        RangeReputation range;
        bool status;
    }

    /**
    * Colab profile with the total points
    */
    struct ProfileColab {
        address addresssColab;
        Profile profile;
        int points;
    }    

    /**
    * @dev setIdentityContract Add a address of indentity to check if a address is a collaborator.
    * @param address is the contract Identity
    */        
    function setIdentityContract(address _contractAddress) public;

    /**
    * @dev addReputation. Add a reputation with the range, ex: Ambassador = 100, 200
    * @param _type is the type of profile
    * @param _start the number of start range 
    * @param _end the number of end range 
    */    
    function addReputation(TypeProfile _type, uint64 _start, uint64 _end) public;

    /**
    * @dev removeReputation. Remove a reputation, change the status to false
    */    
    function removeReputation(TypeProfile _type) public;

    /**
    * @dev addPersonReputation. Add a reputation in a person
    * @TODO change the modifiers to a vote
    */       
    function addPersonReputation(address _addressColab, int8 _points);

    /**
    * @dev removePersonReputation. Remove a reputation of the person
    * @TODO change the modifiers to a vote
    */   
    function removePersonReputation(address _addressColab, int8 _points);
}

Date Created:

15/09/2018

Requires:

Link used to study:

https://github.com/pandoraboxchain/token-1329-hackathon/blob/master/contracts/reputation/ReputationIssuable.sol

guisantos commented 5 years ago

What if we change the TypeProfile to an array or some sort of structed data, so we can create different types of profiles. Instead of being limited to "COLAB, AMBASSADOR, ESPECIALIST, ADVISOR" we can have some flexibility to create and setup new kinds of profiles when we need.