mirror of
https://github.com/status-im/contracts.git
synced 2025-02-24 04:28:51 +00:00
renamed openbounty
This commit is contained in:
parent
a0489c3195
commit
93fadee9b1
@ -1,5 +1,5 @@
|
||||
pragma solidity ^0.4.17;
|
||||
import "../token/Token.sol";
|
||||
import "../token/ERC20Token.sol";
|
||||
import "../token/ApproveAndCallFallBack.sol";
|
||||
import "../common/Controlled.sol";
|
||||
|
||||
@ -100,7 +100,7 @@ contract Bounty is Controlled {
|
||||
requiredState(State.OPEN)
|
||||
{
|
||||
require(_token != address(0));
|
||||
uint tokenBalance = Token(_token).balanceOf(address(this));
|
||||
uint tokenBalance = ERC20Token(_token).balanceOf(address(this));
|
||||
if (tokenBalance != balances[_token]) { //could be require
|
||||
balances[_token] = tokenBalance;
|
||||
BalanceChanged(_token, tokenBalance);
|
||||
@ -240,8 +240,8 @@ contract Bounty is Controlled {
|
||||
toPay = this.balance;
|
||||
_destination.transfer(toPay);
|
||||
} else {
|
||||
toPay = Token(_drainToken).balanceOf(address(this));
|
||||
require(Token(_drainToken).transfer(_destination, toPay));
|
||||
toPay = ERC20Token(_drainToken).balanceOf(address(this));
|
||||
require(ERC20Token(_drainToken).transfer(_destination, toPay));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -261,7 +261,7 @@ contract Bounty is Controlled {
|
||||
{
|
||||
require(_amount > 0);
|
||||
require(_token != address(0));
|
||||
require(Token(_token).transferFrom(msg.sender, address(this), _amount));
|
||||
require(ERC20Token(_token).transferFrom(msg.sender, address(this), _amount));
|
||||
contribution[keccak256(_contributor, _token)] += _amount;
|
||||
balances[_token] += _amount;
|
||||
BalanceChanged(_token, balances[_token]);
|
||||
@ -297,7 +297,7 @@ contract Bounty is Controlled {
|
||||
if (_payoutToken == address(0x0)) {
|
||||
_destination.transfer(toPay);
|
||||
} else {
|
||||
require(Token(_payoutToken).transfer(_destination, toPay));
|
||||
require(ERC20Token(_payoutToken).transfer(_destination, toPay));
|
||||
}
|
||||
}
|
||||
|
||||
@ -313,7 +313,7 @@ contract Bounty is Controlled {
|
||||
if (_refundToken == address(0)) {
|
||||
_from.transfer(amount);
|
||||
} else {
|
||||
require(Token(_refundToken).transfer(_from, amount));
|
||||
require(ERC20Token(_refundToken).transfer(_from, amount));
|
||||
}
|
||||
}
|
||||
|
||||
|
45
contracts/openbounty/BountyFactory.sol
Normal file
45
contracts/openbounty/BountyFactory.sol
Normal file
@ -0,0 +1,45 @@
|
||||
pragma solidity ^0.4.17;
|
||||
|
||||
import "../common/Controlled.sol";
|
||||
import "../deploy/Instance.sol";
|
||||
import "../BountyKernel.sol";
|
||||
|
||||
/**
|
||||
* @title BountyKernel
|
||||
* @dev Creates a Bounty to be used by Instance contract
|
||||
*/
|
||||
contract BountyFactory is Controlled {
|
||||
|
||||
event InstanceCreated(address indexed controller, address instance);
|
||||
|
||||
BountyKernel public standardBountyKernel;
|
||||
|
||||
function BountyFactory()
|
||||
public
|
||||
{
|
||||
standardBountyKernel = new BountyKernel();
|
||||
}
|
||||
|
||||
function drainKernel(address _destination, address[] _drainTokens)
|
||||
external
|
||||
onlyController
|
||||
{
|
||||
standardBountyKernel.drainBounty(_destination, _drainTokens);
|
||||
}
|
||||
|
||||
function createBounty(uint _timeout)
|
||||
external
|
||||
{
|
||||
createBounty(msg.sender, _timeout);
|
||||
}
|
||||
|
||||
function createBounty(address _controller, uint _timeout)
|
||||
public
|
||||
{
|
||||
BountyKernel instance = BountyKernel(new Instance(address(standardBountyKernel)));
|
||||
instance.initBounty(_controller, _timeout);
|
||||
InstanceCreated(_controller, address(instance));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,27 +1,27 @@
|
||||
pragma solidity ^0.4.17;
|
||||
import "../deploy/InstanceStorage.sol";
|
||||
import "./StandardBounty.sol";
|
||||
import "./Bounty.sol";
|
||||
|
||||
|
||||
/**
|
||||
* @title StandardBountyKernel
|
||||
* @dev Creates a StandardBounty to be used by Instance contract
|
||||
* @title BountyKernel
|
||||
* @dev Creates a Bounty to be used by Instance contract
|
||||
*/
|
||||
contract StandardBountyKernel is InstanceStorage, StandardBounty {
|
||||
contract BountyKernel is InstanceStorage, Bounty {
|
||||
|
||||
function StandardBountyKernel()
|
||||
StandardBounty(0)
|
||||
function BountyKernel()
|
||||
Bounty(0)
|
||||
public
|
||||
{
|
||||
state = State.FINALIZED; //enable manual recover of wrongly sent ERC20 tokens to Kernel contract
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Instance constructor for StandardBounty.
|
||||
* @param _controller The controller of the StandardBounty
|
||||
* @notice Instance constructor for Bounty.
|
||||
* @param _controller The controller of the Bounty
|
||||
* @param _timeLimit Limit for withdrawing funds from the issue after its closed
|
||||
*/
|
||||
function initStandardBounty(address _controller, uint256 _timeLimit)
|
||||
function initBounty(address _controller, uint256 _timeLimit)
|
||||
external
|
||||
{
|
||||
require(controller == address(0)); //require clean instance
|
@ -1,7 +1,7 @@
|
||||
pragma solidity ^0.4.18;
|
||||
|
||||
import "./StandardBounty.sol";
|
||||
import "./StandardBountyFactory.sol";
|
||||
import "./Bounty.sol";
|
||||
import "./BountyFactory.sol";
|
||||
import "../deploy/Instance.sol";
|
||||
import "../common/MultiSig.sol";
|
||||
|
||||
@ -9,7 +9,7 @@ contract BountyManager is MultiSig {
|
||||
|
||||
address public pivot;
|
||||
address public repoOwner;
|
||||
StandardBountyFactory factory;
|
||||
BountyFactory factory;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ -30,7 +30,7 @@ contract BountyManager is MultiSig {
|
||||
*
|
||||
*/
|
||||
modifier onlyControlled(address instance) {
|
||||
require(StandardBounty(instance).controller() == address(this));
|
||||
require(Bounty(instance).controller() == address(this));
|
||||
_;
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ contract BountyManager is MultiSig {
|
||||
require(_owners.length > 1);
|
||||
pivot = _owners[0];
|
||||
repoOwner = _owners[1];
|
||||
factory = StandardBountyFactory(_factory);
|
||||
factory = BountyFactory(_factory);
|
||||
}
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ contract BountyManager is MultiSig {
|
||||
onlyMultiSig
|
||||
onlyControlled(_instance)
|
||||
{
|
||||
StandardBounty(_instance).finalize();
|
||||
Bounty(_instance).finalize();
|
||||
}
|
||||
|
||||
function drainBounty(address _instance, address _destination, address[] _drainTokens)
|
||||
@ -85,7 +85,7 @@ contract BountyManager is MultiSig {
|
||||
onlyMultiSig
|
||||
onlyControlled(_instance)
|
||||
{
|
||||
StandardBounty(_instance).drainBounty(_destination, _drainTokens);
|
||||
Bounty(_instance).drainBounty(_destination, _drainTokens);
|
||||
}
|
||||
|
||||
///////
|
||||
@ -95,7 +95,7 @@ contract BountyManager is MultiSig {
|
||||
internal
|
||||
ownerExists(_caller)
|
||||
{
|
||||
factory.createStandardBounty(_timeout);
|
||||
factory.createBounty(_timeout);
|
||||
}
|
||||
|
||||
// Only Pivot
|
||||
@ -104,7 +104,7 @@ contract BountyManager is MultiSig {
|
||||
onlyPivot(_caller)
|
||||
onlyControlled(_instance)
|
||||
{
|
||||
StandardBounty(_instance).increaseReward(_destination, _amount);
|
||||
Bounty(_instance).increaseReward(_destination, _amount);
|
||||
}
|
||||
|
||||
function decreaseRewardBounty(address _caller, address _instance, address _destination, uint256 _amount)
|
||||
@ -112,7 +112,7 @@ contract BountyManager is MultiSig {
|
||||
onlyPivot(_caller)
|
||||
onlyControlled(_instance)
|
||||
{
|
||||
StandardBounty(_instance).decreaseReward(_destination, _amount);
|
||||
Bounty(_instance).decreaseReward(_destination, _amount);
|
||||
}
|
||||
|
||||
//Only Repo Owner
|
||||
@ -121,7 +121,7 @@ contract BountyManager is MultiSig {
|
||||
onlyRepoOwner(_caller)
|
||||
onlyControlled(_instance)
|
||||
{
|
||||
StandardBounty(_instance).close();
|
||||
Bounty(_instance).close();
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,6 +25,6 @@ contract BountyManagerKernel is BountyManagerPreSigned {
|
||||
required = _owners.length;
|
||||
pivot = _owners[0];
|
||||
repoOwner = _owners[1];
|
||||
factory = StandardBountyFactory(_factory);
|
||||
factory = BountyFactory(_factory);
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@ contract BountyManagerPreSigned is BountyManager {
|
||||
}
|
||||
|
||||
///////
|
||||
/// Token proxied calls
|
||||
/// ERC20Token proxied calls
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -1,45 +0,0 @@
|
||||
pragma solidity ^0.4.17;
|
||||
|
||||
import "../common/Controlled.sol";
|
||||
import "../deploy/Instance.sol";
|
||||
import "../StandardBountyKernel.sol";
|
||||
|
||||
/**
|
||||
* @title StandardBountyKernel
|
||||
* @dev Creates a StandardBounty to be used by Instance contract
|
||||
*/
|
||||
contract StandardBountyFactory is Controlled {
|
||||
|
||||
event InstanceCreated(address indexed controller, address instance);
|
||||
|
||||
StandardBountyKernel public standardBountyKernel;
|
||||
|
||||
function StandardBountyFactory()
|
||||
public
|
||||
{
|
||||
standardBountyKernel = new StandardBountyKernel();
|
||||
}
|
||||
|
||||
function drainKernel(address _destination, address[] _drainTokens)
|
||||
external
|
||||
onlyController
|
||||
{
|
||||
standardBountyKernel.drainBounty(_destination, _drainTokens);
|
||||
}
|
||||
|
||||
function createStandardBounty(uint _timeout)
|
||||
external
|
||||
{
|
||||
createStandardBounty(msg.sender, _timeout);
|
||||
}
|
||||
|
||||
function createStandardBounty(address _controller, uint _timeout)
|
||||
public
|
||||
{
|
||||
StandardBountyKernel instance = StandardBountyKernel(new Instance(address(standardBountyKernel)));
|
||||
instance.initStandardBounty(_controller, _timeout);
|
||||
InstanceCreated(_controller, address(instance));
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user