Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created StatBlockBase #343

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 26 additions & 15 deletions contracts/stats/StatBlock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,17 @@ pragma solidity ^0.8.0;
import {IERC1155} from "@openzeppelin-contracts/contracts/token/ERC1155/IERC1155.sol";
import {IStatBlock} from "./IStatBlock.sol";

contract StatBlock is IStatBlock {
contract StatBlockBase is IStatBlock {
string public statBlockVersion = "0.0.1";
address AdminTerminusAddress;
uint256 AdminTerminusPoolID;
// Stats are 0-indexed.
uint256 public NumStats;
mapping(uint256 => string) StatDescriptor;
mapping(address => mapping(uint256 => mapping(uint256 => uint256))) Stat;

constructor(address adminTerminusAddress, uint256 adminTerminusPoolID) {
AdminTerminusAddress = adminTerminusAddress;
AdminTerminusPoolID = adminTerminusPoolID;
}

function adminTerminusInfo() external view returns (address, uint256) {
return (AdminTerminusAddress, AdminTerminusPoolID);
}

function isAdministrator(address account) public view returns (bool) {
IERC1155 terminus = IERC1155(AdminTerminusAddress);
return terminus.balanceOf(account, AdminTerminusPoolID) > 0;
function isAdministrator(
address account
) public view virtual returns (bool) {
return false;
}

function createStat(
Expand Down Expand Up @@ -141,3 +131,24 @@ contract StatBlock is IStatBlock {
return values;
}
}

contract StatBlock is StatBlockBase {
address AdminTerminusAddress;
uint256 AdminTerminusPoolID;

constructor(address adminTerminusAddress, uint256 adminTerminusPoolID) {
AdminTerminusAddress = adminTerminusAddress;
AdminTerminusPoolID = adminTerminusPoolID;
}

function adminTerminusInfo() external view returns (address, uint256) {
return (AdminTerminusAddress, AdminTerminusPoolID);
}

function isAdministrator(
address account
) public view override returns (bool) {
IERC1155 terminus = IERC1155(AdminTerminusAddress);
return terminus.balanceOf(account, AdminTerminusPoolID) > 0;
}
}
Loading