Military
Inherits: IMilitary
State Variables
PRECISION
uint256 public constant PRECISION = 1e18;
_char
IChar public immutable _char;
_bank
address public immutable _bank;
_totalPower
uint256 public _totalPower;
_lastUpdate
uint256 public _lastUpdate;
_goldPerPower
uint256 public _goldPerPower = 1;
_firstExpiringDeposit
uint256 public _firstExpiringDeposit;
_totalDeposited
uint256 public _totalDeposited;
_goldPerPowerByCharId
mapping(uint256 => uint256) public _goldPerPowerByCharId;
_deposits
Deposit[] public _deposits;
Functions
onlyCharacter
modifier onlyCharacter();
constructor
constructor(IChar character_, address bank_);
deposit
function deposit(uint256 amount_) external override;
join
function join(uint256 charId_) external override;
leave
function leave(uint256 charId_) external override returns (uint256);
leave
function leave(uint256 charId_, address owner_, uint256 charPower_) external override onlyCharacter;
increasePower
function increasePower(uint256 charId_, address owner_, uint256 oldPower_, uint256 powerIncrease_)
external
override
onlyCharacter;
getRewards
function getRewards(uint256 charId_) external override returns (uint256 rewards_);
previewRewards
function previewRewards(uint256 charId_) external view override returns (uint256);
isCharEnlisted
function isCharEnlisted(uint256 charId_) public view override returns (bool);
_leave
function _leave(uint256 charId_, address owner_, uint256 charPower_) internal returns (uint256 rewards_);
_validateCharOwner
function _validateCharOwner(uint256 charId_, address owner_) internal view;
_onlyCharacter
function _onlyCharacter() internal view;
_checkExpiredDeposits
function _checkExpiredDeposits()
internal
view
returns (
uint256 totalDeposited_,
uint256 firstExpiringDeposit_,
uint256 goldPerPower_,
uint256 lastUpdate_,
uint256 goldToburn_
);
_updateExpiredDeposits
function _updateExpiredDeposits() internal returns (uint256 goldPerPower_);