Skip to content

Latest commit

 

History

History
270 lines (223 loc) · 6.69 KB

BankContract.md

File metadata and controls

270 lines (223 loc) · 6.69 KB

BankContract

/** @title Bank contract Is the contract handler

Functions

constructor

  function constructor(
    address PawnAddress,
    address BoardAddress,
    address PropAddress,
    address MonoAddress,
    address LinkAddress,
    address StakingAddress
  ) public

Constructor ADMIN_ROLE, BANKER_ROLE are given to deployer

requirements :

  • all parameters addresses must not be address(0)*/

Parameters:

Name Type Description
PawnAddress address address
BoardAddress address address
PropAddress address address
MonoAddress address address
LinkAddress address address
StakingAddress address address

buyPawn

  function buyPawn(
  ) external

buy a pawn (mandatory to play)

requirements :

  • MONO transfer*/

locatePlayer

  function locatePlayer(
    uint16 _edition
  ) public returns (struct BoardContract.PawnInfo p_)
  • locate pawn on game's board

requirements :

  • edition is valid
  • player has a pawn
  • pawn is registered at this edition

Parameters:

Name Type Description
_edition uint16 edition number

Return Values:

Name Type Description
p_ uint16 Board contract pawn information struct*/

enrollPlayer

  function enrollPlayer(
    uint16 _edition
  ) public
  • To enroll a player to a board, required to play.

requirements :

  • contract has allowance to spend enroll fee
  • player has a pawn
  • pawn is registered at this edition

Parameters:

Name Type Description
_edition uint16 board edition*/

rollDices

  function rollDices(
    uint16 _edition
  ) external
  • To throw the dices and request a random number.

requirements :

  • round is completed
  • player has a pawn
  • pawn is registered at this edition
  • Board contract has enough LINK to pay ChainLink fee to request VRF

Parameters:

Name Type Description
_edition uint16 board edition*/

buyMono

  function buyMono(
  ) public
  • To buy Mono with the Token network.*/

buyProp

  function buyProp(
    uint16 _edition
  ) public
  • buy PROP

requirements :

  • Round must be uncompleted

  • MONO transfer ok

  • PROP is valid

Parameters:

Name Type Description
_edition uint16 board edition*/

payRent

  function payRent(
    uint16 _edition
  ) public
  • pay property rent

requirements :

  • Round must be uncompleted

  • MONO transfer ok

  • PROP is valid

Parameters:

Name Type Description
_edition uint16 board edition*/

getPriceOfProp

  function getPriceOfProp(
    uint16 _edition,
    uint8 _land,
    uint8 _rarity
  ) external returns (uint256 price)
  • get a property price

requirements :

  • property mus be valid

Parameters:

Name Type Description
_edition uint16 edition ID
_land uint8 land ID
_rarity uint8 rarity

setPriceOfProp

  function setPriceOfProp(
    uint16 _edition,
    uint8 _land,
    uint8 _rarity,
    uint256 _price
  ) public
  • set a property price

requirements :

  • must have BANKER role
  • property mus be valid

Parameters:

Name Type Description
_edition uint16 edition ID
_land uint8 land ID
_rarity uint8 rarity
_price uint256 amount*/

withdraw

  function withdraw(
    address _to,
    uint256 _value
  ) external
  • withdraw

requirements :

  • must have BANKER role
  • MONO transfer

Parameters:

Name Type Description
_to address address
_value uint256 amount*/

onERC721Received

  function onERC721Received(
  ) external returns (bytes4)

setPrices

  function setPrices(
    uint16 _editionId,
    uint8 _maxLands,
    uint8 _maxLandRarities,
    uint16 _rarityMultiplier,
    uint256[] _commonLandPrices
  ) external
  • set properties prices, useful to add an edition from admin

Parameters:

Name Type Description
_editionId uint16 edition ID
_maxLands uint8 max lands
_maxLandRarities uint8 max land rarity
_rarityMultiplier uint16 rarity multiplier
_commonLandPrices uint256[] common land rarity price*/

propertyTransfer

  function propertyTransfer(
    address _from,
    address _to,
    uint256 _tokenId,
    uint256 _salePrice
  ) external
  • Transfer property ERC721 and royalties to receiver. Useful for our Marketplace

requirements :

  • only BANKER role

  • buyer MONO balance must be greater than sell price

  • This contract must be allowed contract for transfer

  • MONO transfer sell price

Parameters:

Name Type Description
_from address the seller
_to address the buyer
_tokenId uint256 the Property token id
_salePrice uint256 the sale price */