Skip to content

Latest commit

 

History

History
903 lines (507 loc) · 14.2 KB

HeroCoreUpgradeable.md

File metadata and controls

903 lines (507 loc) · 14.2 KB

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

Name Type Description
_0 bytes32 undefined

DEFAULT_ADMIN_ROLE

function DEFAULT_ADMIN_ROLE() external view returns (bytes32)

Returns

Name Type Description
_0 bytes32 undefined

HERO_MODERATOR_ROLE

function HERO_MODERATOR_ROLE() external view returns (bytes32)

Returns

Name Type Description
_0 bytes32 undefined

MINTER_ROLE

function MINTER_ROLE() external view returns (bytes32)

Returns

Name Type Description
_0 bytes32 undefined

MODERATOR_ROLE

function MODERATOR_ROLE() external view returns (bytes32)

ROLES ///

Returns

Name Type Description
_0 bytes32 undefined

approve

function approve(address to, uint256 tokenId) external nonpayable

See {IERC721-approve}.

Parameters

Name Type Description
to address undefined
tokenId uint256 undefined

balanceOf

function balanceOf(address owner) external view returns (uint256)

See {IERC721-balanceOf}.

Parameters

Name Type Description
owner address undefined

Returns

Name Type Description
_0 uint256 undefined

bridgeMint

function bridgeMint(uint256 _id, address _to) external nonpayable

Parameters

Name Type Description
_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

Name Type Description
_statGenes uint256 undefined
_visualGenes uint256 undefined
_rarity enum Rarity undefined
_shiny bool undefined
_crystal HeroCrystal undefined
_crystalId uint256 undefined

Returns

Name Type Description
_0 uint256 undefined

getApproved

function getApproved(uint256 tokenId) external view returns (address)

See {IERC721-getApproved}.

Parameters

Name Type Description
tokenId uint256 undefined

Returns

Name Type Description
_0 address undefined

getHero

function getHero(uint256 _id) external view returns (struct Hero)

Gets a hero object.

Parameters

Name Type Description
_id uint256 The hero id.

Returns

Name Type Description
_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

Name Type Description
role bytes32 undefined

Returns

Name Type Description
_0 bytes32 undefined

getUserHeroes

function getUserHeroes(address _address) external view returns (struct Hero[])

Parameters

Name Type Description
_address address undefined

Returns

Name Type Description
_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

Name Type Description
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

Name Type Description
role bytes32 undefined
account address undefined

Returns

Name Type Description
_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

Name Type Description
_0 uint256 undefined

Returns

Name Type Description
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 Type Description
_name string undefined
_symbol string undefined
_statScience address undefined

isApprovedForAll

function isApprovedForAll(address owner, address operator) external view returns (bool)

See {IERC721-isApprovedForAll}.

Parameters

Name Type Description
owner address undefined
operator address undefined

Returns

Name Type Description
_0 bool undefined

name

function name() external view returns (string)

See {IERC721Metadata-name}.

Returns

Name Type Description
_0 string undefined

nextHeroId

function nextHeroId() external view returns (uint256)

Returns

Name Type Description
_0 uint256 undefined

ownerOf

function ownerOf(uint256 tokenId) external view returns (address)

See {IERC721-ownerOf}.

Parameters

Name Type Description
tokenId uint256 undefined

Returns

Name Type Description
_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

Name Type Description
_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

Name Type Description
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

Name Type Description
role bytes32 undefined
account address undefined

safeTransferFrom

function safeTransferFrom(address from, address to, uint256 tokenId) external nonpayable

See {IERC721-safeTransferFrom}.

Parameters

Name Type Description
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

Name Type Description
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

Name Type Description
operator address undefined
approved bool undefined

supportsInterface

function supportsInterface(bytes4 interfaceId) external view returns (bool)

Parameters

Name Type Description
interfaceId bytes4 undefined

Returns

Name Type Description
_0 bool undefined

symbol

function symbol() external view returns (string)

See {IERC721Metadata-symbol}.

Returns

Name Type Description
_0 string undefined

tokenByIndex

function tokenByIndex(uint256 index) external view returns (uint256)

See {IERC721Enumerable-tokenByIndex}.

Parameters

Name Type Description
index uint256 undefined

Returns

Name Type Description
_0 uint256 undefined

tokenOfOwnerByIndex

function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256)

See {IERC721Enumerable-tokenOfOwnerByIndex}.

Parameters

Name Type Description
owner address undefined
index uint256 undefined

Returns

Name Type Description
_0 uint256 undefined

tokenURI

function tokenURI(uint256 tokenId) external view returns (string)

See {IERC721Metadata-tokenURI}.

Parameters

Name Type Description
tokenId uint256 undefined

Returns

Name Type Description
_0 string undefined

totalSupply

function totalSupply() external view returns (uint256)

See {IERC721Enumerable-totalSupply}.

Returns

Name Type Description
_0 uint256 undefined

transferFrom

function transferFrom(address from, address to, uint256 tokenId) external nonpayable

See {IERC721-transferFrom}.

Parameters

Name Type Description
from address undefined
to address undefined
tokenId uint256 undefined

unpause

function unpause() external nonpayable

updateHero

function updateHero(Hero _hero) external nonpayable

Parameters

Name Type Description
_hero Hero undefined

Events

Approval

event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId)

Parameters

Name Type Description
owner indexed address undefined
approved indexed address undefined
tokenId indexed uint256 undefined

ApprovalForAll

event ApprovalForAll(address indexed owner, address indexed operator, bool approved)

Parameters

Name Type Description
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

Name Type Description
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

Name Type Description
owner indexed address undefined
heroId uint256 undefined
hero Hero undefined

Paused

event Paused(address account)

Parameters

Name Type Description
account address undefined

RoleAdminChanged

event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)

Parameters

Name Type Description
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

Name Type Description
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

Name Type Description
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

Name Type Description
from indexed address undefined
to indexed address undefined
tokenId indexed uint256 undefined

Unpaused

event Unpaused(address account)

Parameters

Name Type Description
account address undefined