forked from CCTF/DCTF
1
0
Fork 0
DCTF/contracts/Hall_of_Fame.sol

61 lines
1.5 KiB
Solidity
Raw Permalink Normal View History

2023-08-25 07:04:53 +00:00
// 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;
2023-08-25 07:34:13 +00:00
function addContributor(string memory _name, string memory _skills) external only_famman {
2023-08-25 07:04:53 +00:00
contributor_count = contributor_count+1;
contributors.push(Contributor(contributor_count, _name, _skills, block.timestamp));
}
// There is no remove, once someone contributed it is safu.
2023-08-25 07:34:13 +00:00
function addPlayer(string memory _name, string memory _skills, string memory _team_name) external only_famman {
2023-08-25 07:04:53 +00:00
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;
}
}