mirror of https://github.com/vacp2p/minime.git
parent
b899e5a8ec
commit
d6ce59e502
|
@ -0,0 +1,9 @@
|
|||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
/// @title Approve And Call Fallback Token Interface
|
||||
/// @dev This interface must be implemented by other contracts
|
||||
/// wishing to accept approve and call from MiniMe token contracts.
|
||||
abstract contract ApproveAndCallFallBack {
|
||||
function receiveApproval(address from, uint256 _amount, address _token, bytes memory _data) public virtual;
|
||||
}
|
|
@ -39,12 +39,10 @@ error ControllerNotSet();
|
|||
|
||||
import { Controlled } from "./Controlled.sol";
|
||||
import { TokenController } from "./TokenController.sol";
|
||||
import { ApproveAndCallFallBack } from "./ApproveAndCallFallBack.sol";
|
||||
import { MiniMeTokenFactory } from "./MiniMeTokenFactory.sol";
|
||||
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
||||
|
||||
abstract contract ApproveAndCallFallBack {
|
||||
function receiveApproval(address from, uint256 _amount, address _token, bytes memory _data) public virtual;
|
||||
}
|
||||
|
||||
/// @dev The actual token contract, the default controller is the msg.sender
|
||||
/// that deploys the contract, so usually this token will be deployed by a
|
||||
/// token controller contract, which Giveth will call a "Campaign"
|
||||
|
@ -500,47 +498,3 @@ contract MiniMeToken is Controlled, IERC20 {
|
|||
event ClaimedTokens(address indexed _token, address indexed _controller, uint256 _amount);
|
||||
event NewCloneToken(address indexed _cloneToken, uint256 _snapshotBlock);
|
||||
}
|
||||
|
||||
////////////////
|
||||
// MiniMeTokenFactory
|
||||
////////////////
|
||||
|
||||
/// @dev This contract is used to generate clone contracts from a contract.
|
||||
/// In solidity this is the way to create a contract from a contract of the
|
||||
/// same class
|
||||
contract MiniMeTokenFactory {
|
||||
/// @notice Update the DApp by creating a new token with new functionalities
|
||||
/// the msg.sender becomes the controller of this clone token
|
||||
/// @param _parentToken Address of the token being cloned
|
||||
/// @param _snapshotBlock Block of the parent token that will
|
||||
/// determine the initial distribution of the clone token
|
||||
/// @param _tokenName Name of the new token
|
||||
/// @param _decimalUnits Number of decimals of the new token
|
||||
/// @param _tokenSymbol Token Symbol for the new token
|
||||
/// @param _transfersEnabled If true, tokens will be able to be transferred
|
||||
/// @return The address of the new token contract
|
||||
function createCloneToken(
|
||||
MiniMeToken _parentToken,
|
||||
uint256 _snapshotBlock,
|
||||
string memory _tokenName,
|
||||
uint8 _decimalUnits,
|
||||
string memory _tokenSymbol,
|
||||
bool _transfersEnabled
|
||||
)
|
||||
public
|
||||
returns (MiniMeToken)
|
||||
{
|
||||
MiniMeToken newToken = new MiniMeToken(
|
||||
this,
|
||||
_parentToken,
|
||||
_snapshotBlock,
|
||||
_tokenName,
|
||||
_decimalUnits,
|
||||
_tokenSymbol,
|
||||
_transfersEnabled
|
||||
);
|
||||
|
||||
newToken.changeController(payable(msg.sender));
|
||||
return newToken;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
import "./MiniMeToken.sol";
|
||||
|
||||
/// @title MiniMeToken Factory Contract
|
||||
/// @dev This contract is used to generate clone contracts from a contract.
|
||||
/// In solidity this is the way to create a contract from a contract of the
|
||||
/// same class
|
||||
contract MiniMeTokenFactory {
|
||||
/// @notice Update the DApp by creating a new token with new functionalities
|
||||
/// the msg.sender becomes the controller of this clone token
|
||||
/// @param _parentToken Address of the token being cloned
|
||||
/// @param _snapshotBlock Block of the parent token that will
|
||||
/// determine the initial distribution of the clone token
|
||||
/// @param _tokenName Name of the new token
|
||||
/// @param _decimalUnits Number of decimals of the new token
|
||||
/// @param _tokenSymbol Token Symbol for the new token
|
||||
/// @param _transfersEnabled If true, tokens will be able to be transferred
|
||||
/// @return The address of the new token contract
|
||||
function createCloneToken(
|
||||
MiniMeToken _parentToken,
|
||||
uint256 _snapshotBlock,
|
||||
string memory _tokenName,
|
||||
uint8 _decimalUnits,
|
||||
string memory _tokenSymbol,
|
||||
bool _transfersEnabled
|
||||
)
|
||||
public
|
||||
returns (MiniMeToken)
|
||||
{
|
||||
MiniMeToken newToken = new MiniMeToken(
|
||||
this,
|
||||
_parentToken,
|
||||
_snapshotBlock,
|
||||
_tokenName,
|
||||
_decimalUnits,
|
||||
_tokenSymbol,
|
||||
_transfersEnabled
|
||||
);
|
||||
|
||||
newToken.changeController(payable(msg.sender));
|
||||
return newToken;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
error NotAuthorized();
|
||||
|
||||
/// @dev `Owned` is a base level contract that assigns an `owner` that can be
|
||||
/// later changed
|
||||
contract Owned {
|
||||
/// @dev `owner` is the only address that can call a function with this
|
||||
/// modifier
|
||||
modifier onlyOwner() {
|
||||
if (msg.sender != owner) revert NotAuthorized();
|
||||
_;
|
||||
}
|
||||
|
||||
address public owner;
|
||||
|
||||
/// @notice The Constructor assigns the message sender to be `owner`
|
||||
constructor() {
|
||||
owner = msg.sender;
|
||||
}
|
||||
|
||||
/// @notice `owner` can step down and assign some other address to this role
|
||||
/// @param _newOwner The address of the new owner. 0x0 can be used to create
|
||||
/// an ublock.timestampned neutral vault, however that cannot be undone
|
||||
function changeOwner(address _newOwner) public onlyOwner {
|
||||
owner = _newOwner;
|
||||
}
|
||||
}
|
|
@ -25,8 +25,9 @@ pragma solidity ^0.8.0;
|
|||
/// funds for non-profit causes, but it can be customized for any variety of
|
||||
/// purposes.
|
||||
|
||||
import { MiniMeToken } from "./MiniMeToken.sol";
|
||||
import { TokenController } from "./TokenController.sol";
|
||||
import { MiniMeToken } from "../MiniMeToken.sol";
|
||||
import { TokenController } from "../TokenController.sol";
|
||||
import { Owned } from "./Owned.sol";
|
||||
|
||||
error NotAuthorized();
|
||||
error InvalidParameters();
|
||||
|
@ -35,31 +36,6 @@ error TransferFailed(address destination);
|
|||
error TokenMintFailed();
|
||||
error FundingPeriodNotOver();
|
||||
|
||||
/// @dev `Owned` is a base level contract that assigns an `owner` that can be
|
||||
/// later changed
|
||||
contract Owned {
|
||||
/// @dev `owner` is the only address that can call a function with this
|
||||
/// modifier
|
||||
modifier onlyOwner() {
|
||||
if (msg.sender != owner) revert NotAuthorized();
|
||||
_;
|
||||
}
|
||||
|
||||
address public owner;
|
||||
|
||||
/// @notice The Constructor assigns the message sender to be `owner`
|
||||
constructor() {
|
||||
owner = msg.sender;
|
||||
}
|
||||
|
||||
/// @notice `owner` can step down and assign some other address to this role
|
||||
/// @param _newOwner The address of the new owner. 0x0 can be used to create
|
||||
/// an ublock.timestampned neutral vault, however that cannot be undone
|
||||
function changeOwner(address _newOwner) public onlyOwner {
|
||||
owner = _newOwner;
|
||||
}
|
||||
}
|
||||
|
||||
/// @dev This is designed to control the issuance of a MiniMe Token for a
|
||||
/// non-profit Campaign. This contract effectively dictates the terms of the
|
||||
/// funding round.
|
Loading…
Reference in New Issue