HeroCoreUpgradeable
Frisky Fox - Defi Kingdoms
Core contract for Heroes.
Holds the base structs, events, and data.
Methods
BRIDGE_ROLE
function BRIDGE_ROLE() external view returns (bytes32)
Returns
_0
bytes32
undefined
DEFAULT_ADMIN_ROLE
function DEFAULT_ADMIN_ROLE() external view returns (bytes32)
Returns
_0
bytes32
undefined
HERO_MODERATOR_ROLE
function HERO_MODERATOR_ROLE() external view returns (bytes32)
Returns
_0
bytes32
undefined
MINTER_ROLE
function MINTER_ROLE() external view returns (bytes32)
Returns
_0
bytes32
undefined
MODERATOR_ROLE
function MODERATOR_ROLE() external view returns (bytes32)
ROLES ///
Returns
_0
bytes32
undefined
approve
function approve(address to, uint256 tokenId) external nonpayable
See {IERC721-approve}.
Parameters
to
address
undefined
tokenId
uint256
undefined
balanceOf
function balanceOf(address owner) external view returns (uint256)
See {IERC721-balanceOf}.
Parameters
owner
address
undefined
Returns
_0
uint256
undefined
bridgeMint
function bridgeMint(uint256 _id, address _to) external nonpayable
Parameters
_id
uint256
undefined
_to
address
undefined
createHero
function createHero(uint256 _statGenes, uint256 _visualGenes, enum Rarity _rarity, bool _shiny, HeroCrystal _crystal, uint256 _crystalId) external nonpayable returns (uint256)
Parameters
_statGenes
uint256
undefined
_visualGenes
uint256
undefined
_rarity
enum Rarity
undefined
_shiny
bool
undefined
_crystal
HeroCrystal
undefined
_crystalId
uint256
undefined
Returns
_0
uint256
undefined
getApproved
function getApproved(uint256 tokenId) external view returns (address)
See {IERC721-getApproved}.
Parameters
tokenId
uint256
undefined
Returns
_0
address
undefined
getHero
function getHero(uint256 _id) external view returns (struct Hero)
Gets a hero object.
Parameters
_id
uint256
The hero id.
Returns
_0
Hero
undefined
getRoleAdmin
function getRoleAdmin(bytes32 role) external view returns (bytes32)
Returns the admin role that controls role
. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.
Parameters
role
bytes32
undefined
Returns
_0
bytes32
undefined
getUserHeroes
function getUserHeroes(address _address) external view returns (struct Hero[])
Parameters
_address
address
undefined
Returns
_0
Hero[]
undefined
grantRole
function grantRole(bytes32 role, address account) external nonpayable
Grants role
to account
. If account
had not been already granted role
, emits a {RoleGranted} event. Requirements: - the caller must have role
's admin role.
Parameters
role
bytes32
undefined
account
address
undefined
hasRole
function hasRole(bytes32 role, address account) external view returns (bool)
Returns true
if account
has been granted role
.
Parameters
role
bytes32
undefined
account
address
undefined
Returns
_0
bool
undefined
heroes
function heroes(uint256) external view returns (uint256 id, struct SummoningInfo summoningInfo, struct HeroInfo info, struct HeroState state, struct HeroStats stats, struct HeroStatGrowth primaryStatGrowth, struct HeroStatGrowth secondaryStatGrowth, struct HeroProfessions professions)
Parameters
_0
uint256
undefined
Returns
id
uint256
undefined
summoningInfo
SummoningInfo
undefined
info
HeroInfo
undefined
state
HeroState
undefined
stats
HeroStats
undefined
primaryStatGrowth
HeroStatGrowth
undefined
secondaryStatGrowth
HeroStatGrowth
undefined
professions
HeroProfessions
undefined
initialize
function initialize(string _name, string _symbol, address _statScience) external nonpayable
The initialize function is the constructor for upgradeable contracts.
Parameters
_name
string
undefined
_symbol
string
undefined
_statScience
address
undefined
isApprovedForAll
function isApprovedForAll(address owner, address operator) external view returns (bool)
See {IERC721-isApprovedForAll}.
Parameters
owner
address
undefined
operator
address
undefined
Returns
_0
bool
undefined
name
function name() external view returns (string)
See {IERC721Metadata-name}.
Returns
_0
string
undefined
nextHeroId
function nextHeroId() external view returns (uint256)
Returns
_0
uint256
undefined
ownerOf
function ownerOf(uint256 tokenId) external view returns (address)
See {IERC721-ownerOf}.
Parameters
tokenId
uint256
undefined
Returns
_0
address
undefined
pause
function pause() external nonpayable
ADMIN FUNCTION ///
paused
function paused() external view returns (bool)
Returns true if the contract is paused, and false otherwise.
Returns
_0
bool
undefined
renounceRole
function renounceRole(bytes32 role, address account) external nonpayable
Revokes role
from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked role
, emits a {RoleRevoked} event. Requirements: - the caller must be account
.
Parameters
role
bytes32
undefined
account
address
undefined
revokeRole
function revokeRole(bytes32 role, address account) external nonpayable
Revokes role
from account
. If account
had been granted role
, emits a {RoleRevoked} event. Requirements: - the caller must have role
's admin role.
Parameters
role
bytes32
undefined
account
address
undefined
safeTransferFrom
function safeTransferFrom(address from, address to, uint256 tokenId) external nonpayable
See {IERC721-safeTransferFrom}.
Parameters
from
address
undefined
to
address
undefined
tokenId
uint256
undefined
safeTransferFrom
function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) external nonpayable
See {IERC721-safeTransferFrom}.
Parameters
from
address
undefined
to
address
undefined
tokenId
uint256
undefined
_data
bytes
undefined
setApprovalForAll
function setApprovalForAll(address operator, bool approved) external nonpayable
See {IERC721-setApprovalForAll}.
Parameters
operator
address
undefined
approved
bool
undefined
supportsInterface
function supportsInterface(bytes4 interfaceId) external view returns (bool)
Parameters
interfaceId
bytes4
undefined
Returns
_0
bool
undefined
symbol
function symbol() external view returns (string)
See {IERC721Metadata-symbol}.
Returns
_0
string
undefined
tokenByIndex
function tokenByIndex(uint256 index) external view returns (uint256)
See {IERC721Enumerable-tokenByIndex}.
Parameters
index
uint256
undefined
Returns
_0
uint256
undefined
tokenOfOwnerByIndex
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256)
See {IERC721Enumerable-tokenOfOwnerByIndex}.
Parameters
owner
address
undefined
index
uint256
undefined
Returns
_0
uint256
undefined
tokenURI
function tokenURI(uint256 tokenId) external view returns (string)
See {IERC721Metadata-tokenURI}.
Parameters
tokenId
uint256
undefined
Returns
_0
string
undefined
totalSupply
function totalSupply() external view returns (uint256)
See {IERC721Enumerable-totalSupply}.
Returns
_0
uint256
undefined
transferFrom
function transferFrom(address from, address to, uint256 tokenId) external nonpayable
See {IERC721-transferFrom}.
Parameters
from
address
undefined
to
address
undefined
tokenId
uint256
undefined
unpause
function unpause() external nonpayable
updateHero
function updateHero(Hero _hero) external nonpayable
Parameters
_hero
Hero
undefined
Events
Approval
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId)
Parameters
owner indexed
address
undefined
approved indexed
address
undefined
tokenId indexed
uint256
undefined
ApprovalForAll
event ApprovalForAll(address indexed owner, address indexed operator, bool approved)
Parameters
owner indexed
address
undefined
operator indexed
address
undefined
approved
bool
undefined
HeroSummoned
event HeroSummoned(address indexed owner, uint256 heroId, uint256 summonerId, uint256 assistantId, uint256 statGenes, uint256 visualGenes)
EVENTS ///
The HeroSummoned event is fired whenever a new hero is created.
Parameters
owner indexed
address
undefined
heroId
uint256
undefined
summonerId
uint256
undefined
assistantId
uint256
undefined
statGenes
uint256
undefined
visualGenes
uint256
undefined
HeroUpdated
event HeroUpdated(address indexed owner, uint256 heroId, Hero hero)
The HeroUpdated event is fired whenever a hero is updated.
Parameters
owner indexed
address
undefined
heroId
uint256
undefined
hero
Hero
undefined
Paused
event Paused(address account)
Parameters
account
address
undefined
RoleAdminChanged
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)
Parameters
role indexed
bytes32
undefined
previousAdminRole indexed
bytes32
undefined
newAdminRole indexed
bytes32
undefined
RoleGranted
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)
Parameters
role indexed
bytes32
undefined
account indexed
address
undefined
sender indexed
address
undefined
RoleRevoked
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)
Parameters
role indexed
bytes32
undefined
account indexed
address
undefined
sender indexed
address
undefined
Transfer
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)
Parameters
from indexed
address
undefined
to indexed
address
undefined
tokenId indexed
uint256
undefined
Unpaused
event Unpaused(address account)
Parameters
account
address
undefined
Last updated
Was this helpful?