subspace/examples/embark-dapp/contracts/ranking.sol

18 lines
423 B
Solidity
Raw Normal View History

2019-08-20 18:35:58 +00:00
pragma solidity ^0.5.0;
contract Ranking {
mapping(address => uint[]) public rating;
event Rating(address sender, address addr, uint rating);
function rate(address _addr, uint _rate) external {
require(_rate >= 1, "Rating needs to be at least 1");
require(_rate <= 5, "Rating needs to be at less than or equal to 5");
rating[msg.sender].push(_rate);
emit Rating(msg.sender, _addr, _rate);
}
}