diff --git a/src/IRaidGeld.sol b/src/IRaidGeld.sol new file mode 100644 index 0000000..3a9ef2b --- /dev/null +++ b/src/IRaidGeld.sol @@ -0,0 +1,92 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; + +import {Army, Player, Boss, LastBossResult} from "./RaidGeldStructs.sol"; + +/** + * @title IRaidGeld + * @dev Interface for the RaidGeld contract + */ +interface IRaidGeld { + /** + * @notice Registers ETH for the player + */ + function registerEth() external payable; + + /** + * @notice Registers DAO tokens for the player + */ + function registerDaoToken() external payable; + + /** + * @notice Initiates a raid + */ + function raid() external; + + /** + * @notice Adds units to the player's army + * @param unit The type of unit to add + * @param n_units The number of units to add + */ + function addUnit(uint8 unit, uint16 n_units) external; + + /** + * @notice Initiates a battle with the boss + * @return hasWonOrAscended An array indicating if the player has won or ascended + */ + function battleWithBoss() external returns (bool[2] memory hasWonOrAscended); + + /** + * @notice Gets the player information + * @param addr The address of the player + * @return Player The player information + */ + function getPlayer(address addr) external view returns (Player memory); + + /** + * @notice Gets the army information of the player + * @param addr The address of the player + * @return Army The army information + */ + function getArmy(address addr) external view returns (Army memory); + + /** + * @notice Gets the boss information + * @param addr The address of the boss + * @return Boss The boss information + */ + function getBoss(address addr) external view returns (Boss memory); + + /** + * @notice Gets the result of the last boss battle + * @param addr The address of the player + * @return LastBossResult The result of the last boss battle + */ + function getLastBossResult(address addr) external view returns (LastBossResult memory); + + /** + * @notice Checks if the player is registered + * @param addr The address of the player + * @return bool True if the player is registered, false otherwise + */ + function isRegistered(address addr) external view returns (bool); + + /** + * @notice Sets the buy-in amount for DAO tokens + * @param newAmount The new buy-in amount + */ + function setDaoTokenBuyInAmount(uint256 newAmount) external; + + /** + * @notice Deploys a swap pool with specified amounts of GELD and DAO tokens + * @param _geldAmount The amount of GELD tokens + * @param _daoTokenAmount The amount of DAO tokens + */ + function deploySwapPool(uint256 _geldAmount, uint256 _daoTokenAmount) external; + + /** + * @notice Sets the DAO address + * @param _dao The new DAO address + */ + function setDaoAddress(address _dao) external; +} \ No newline at end of file diff --git a/src/RaidGeld.sol b/src/RaidGeld.sol index 2a255d9..7ab5d96 100644 --- a/src/RaidGeld.sol +++ b/src/RaidGeld.sol @@ -10,11 +10,13 @@ import { IERC20, TransferHelper } from "@uniswap/v3-periphery/contracts/librarie import { INonfungiblePositionManager } from "./lib/INonfungiblePositionManager.sol"; import { CustomMath} from "./lib/CustomMath.sol"; +import { IRaidGeld } from "./IRaidGeld.sol"; import {RaidGeldUtils } from "../src/RaidGeldUtils.sol"; import {Army, Player, Raider, Boss, LastBossResult} from "../src/RaidGeldStructs.sol"; import { Constants} from "../src/Constants.sol"; -contract RaidGeld is ERC20, Ownable, Constants { + +contract RaidGeld is ERC20, Ownable, Constants, IRaidGeld { uint256 public constant MANTISSA = 1e4; uint256 public constant BUY_IN_AMOUNT = 0.00045 ether; uint256 public BUY_IN_DAO_TOKEN_AMOUNT;