DCTF/contracts/Hall_of_Fame.sol

61 lines
1.5 KiB
Solidity

// SPDX-License-Identifier: GPL-3.0
// Author: six
// State: v0.1
pragma solidity ^0.8.17;
contract CCTF_Hall_of_Fame {
address fame_manager;
constructor () {
fame_manager = msg.sender; // TBA There should be more, eg. DAO-like feature.
}
modifier only_famman {
require(msg.sender == fame_manager, 'Not Fame Manager.');
_;
}
//Contributors
uint contributor_count;
struct Contributor{
uint256 id;
string name;
string skills;
uint record_date;
}
Contributor[] public contributors;
// Players
uint player_count;
struct Player{
uint256 id;
string name;
string team_name;
string skills;
uint record_date;
}
Player[] public players;
function addContributor(string memory _name, string memory _skills) external only_famman {
contributor_count = contributor_count+1;
contributors.push(Contributor(contributor_count, _name, _skills, block.timestamp));
}
// There is no remove, once someone contributed it is safu.
function addPlayer(string memory _name, string memory _skills, string memory _team_name) external only_famman {
player_count = player_count+1;
players.push(Player(contributor_count, _name, _skills, _team_name, block.timestamp));
}
function listContributors() public view returns (Contributor[] memory) {
return contributors;
}
function listTopPlayers() public view returns (Player[] memory) {
return players;
}
}