mirror of https://github.com/vacp2p/minime.git
parent
c8581cd22d
commit
b899e5a8ec
|
@ -2,3 +2,6 @@
|
||||||
branch = "v1"
|
branch = "v1"
|
||||||
path = lib/forge-std
|
path = lib/forge-std
|
||||||
url = https://github.com/foundry-rs/forge-std
|
url = https://github.com/foundry-rs/forge-std
|
||||||
|
[submodule "lib/openzeppelin-contracts"]
|
||||||
|
path = lib/openzeppelin-contracts
|
||||||
|
url = https://github.com/OpenZeppelin/openzeppelin-contracts
|
||||||
|
|
|
@ -39,6 +39,7 @@ error ControllerNotSet();
|
||||||
|
|
||||||
import { Controlled } from "./Controlled.sol";
|
import { Controlled } from "./Controlled.sol";
|
||||||
import { TokenController } from "./TokenController.sol";
|
import { TokenController } from "./TokenController.sol";
|
||||||
|
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
||||||
|
|
||||||
abstract contract ApproveAndCallFallBack {
|
abstract contract ApproveAndCallFallBack {
|
||||||
function receiveApproval(address from, uint256 _amount, address _token, bytes memory _data) public virtual;
|
function receiveApproval(address from, uint256 _amount, address _token, bytes memory _data) public virtual;
|
||||||
|
@ -47,7 +48,7 @@ abstract contract ApproveAndCallFallBack {
|
||||||
/// @dev The actual token contract, the default controller is the msg.sender
|
/// @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
|
/// that deploys the contract, so usually this token will be deployed by a
|
||||||
/// token controller contract, which Giveth will call a "Campaign"
|
/// token controller contract, which Giveth will call a "Campaign"
|
||||||
contract MiniMeToken is Controlled {
|
contract MiniMeToken is Controlled, IERC20 {
|
||||||
string public name; //The Token's name: e.g. DigixDAO Tokens
|
string public name; //The Token's name: e.g. DigixDAO Tokens
|
||||||
uint8 public decimals; //Number of decimals of the smallest unit
|
uint8 public decimals; //Number of decimals of the smallest unit
|
||||||
string public symbol; //An identifier: e.g. REP
|
string public symbol; //An identifier: e.g. REP
|
||||||
|
@ -481,14 +482,13 @@ contract MiniMeToken is Controlled {
|
||||||
/// sent tokens to this contract.
|
/// sent tokens to this contract.
|
||||||
/// @param _token The address of the token contract that you want to recover
|
/// @param _token The address of the token contract that you want to recover
|
||||||
/// set to 0 in case you want to extract ether.
|
/// set to 0 in case you want to extract ether.
|
||||||
function claimTokens(MiniMeToken _token) public onlyController {
|
function claimTokens(IERC20 _token) public onlyController {
|
||||||
//TODO: change is to generic ERC20 interface
|
|
||||||
if (address(_token) == address(0)) {
|
if (address(_token) == address(0)) {
|
||||||
controller.transfer(address(this).balance);
|
controller.transfer(address(this).balance);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MiniMeToken token = _token;
|
IERC20 token = _token;
|
||||||
uint256 balance = token.balanceOf(address(this));
|
uint256 balance = token.balanceOf(address(this));
|
||||||
token.transfer(controller, balance);
|
token.transfer(controller, balance);
|
||||||
emit ClaimedTokens(address(_token), controller, balance);
|
emit ClaimedTokens(address(_token), controller, balance);
|
||||||
|
@ -498,9 +498,7 @@ contract MiniMeToken is Controlled {
|
||||||
// Events
|
// Events
|
||||||
////////////////
|
////////////////
|
||||||
event ClaimedTokens(address indexed _token, address indexed _controller, uint256 _amount);
|
event ClaimedTokens(address indexed _token, address indexed _controller, uint256 _amount);
|
||||||
event Transfer(address indexed _from, address indexed _to, uint256 _amount);
|
|
||||||
event NewCloneToken(address indexed _cloneToken, uint256 _snapshotBlock);
|
event NewCloneToken(address indexed _cloneToken, uint256 _snapshotBlock);
|
||||||
event Approval(address indexed _owner, address indexed _spender, uint256 _amount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////
|
////////////////
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit fd81a96f01cc42ef1c9a5399364968d0e07e9e90
|
|
@ -1 +1,2 @@
|
||||||
forge-std/=lib/forge-std/src/
|
forge-std/=lib/forge-std/src/
|
||||||
|
@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts
|
Loading…
Reference in New Issue