2021-12-18 20:10:53 +00:00
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Authors: Moonstream Engineering (engineering@moonstream.to)
|
|
|
|
* GitHub: https://github.com/bugout-dev/dao
|
|
|
|
*
|
|
|
|
* This is an implementation of the ERC20 governance token for the Moonstream DAO.
|
|
|
|
*/
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
|
|
import "./ERC1155WithTerminusStorage.sol";
|
|
|
|
import "./LibTerminus.sol";
|
|
|
|
import "../diamond/libraries/LibDiamond.sol";
|
|
|
|
|
|
|
|
contract TerminusFacet is ERC1155WithTerminusStorage {
|
|
|
|
constructor() {}
|
|
|
|
|
2021-12-18 20:30:09 +00:00
|
|
|
function terminusController() external view returns (address) {
|
2021-12-18 20:25:54 +00:00
|
|
|
return LibTerminus.terminusStorage().controller;
|
|
|
|
}
|
|
|
|
|
2021-12-18 20:10:53 +00:00
|
|
|
function setURI(uint256 poolID, string memory poolURI) external {
|
|
|
|
LibTerminus.enforcePoolIsController(poolID, _msgSender());
|
|
|
|
LibTerminus.TerminusStorage storage ts = LibTerminus.terminusStorage();
|
|
|
|
ts.poolURI[poolID] = poolURI;
|
|
|
|
}
|
|
|
|
|
2021-12-18 20:20:55 +00:00
|
|
|
function totalPools() external view returns (uint256) {
|
|
|
|
return LibTerminus.terminusStorage().currentPoolID;
|
|
|
|
}
|
|
|
|
|
|
|
|
function createPool() external returns (uint256) {
|
|
|
|
return LibTerminus.createPool();
|
|
|
|
}
|
|
|
|
|
2021-12-18 20:42:21 +00:00
|
|
|
function terminusPoolController(uint256 poolID)
|
|
|
|
external
|
|
|
|
view
|
|
|
|
returns (address)
|
|
|
|
{
|
|
|
|
return LibTerminus.terminusStorage().poolController[poolID];
|
|
|
|
}
|
|
|
|
|
2021-12-18 20:10:53 +00:00
|
|
|
function mint(
|
|
|
|
address to,
|
|
|
|
uint256 poolID,
|
|
|
|
uint256 amount,
|
|
|
|
bytes memory data
|
|
|
|
) external {
|
|
|
|
LibTerminus.enforcePoolIsController(poolID, msg.sender);
|
|
|
|
_mint(to, poolID, amount, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
function mintBatch(
|
|
|
|
address to,
|
|
|
|
uint256[] memory poolIDs,
|
|
|
|
uint256[] memory amounts,
|
|
|
|
bytes memory data
|
|
|
|
) external {
|
|
|
|
for (uint256 i = 0; i < poolIDs.length; i++) {
|
|
|
|
LibTerminus.enforcePoolIsController(poolIDs[i], _msgSender());
|
|
|
|
}
|
|
|
|
_mintBatch(to, poolIDs, amounts, data);
|
|
|
|
}
|
|
|
|
}
|