removed changing tokens
This commit is contained in:
parent
1bed8bf2a9
commit
d9c348f9b8
|
@ -464,32 +464,6 @@ contract StandardBounties {
|
|||
BountyChanged(_bountyId);
|
||||
}
|
||||
|
||||
/// @dev changeBountyPaysTokens(): allows the issuer to change a bounty's issuer
|
||||
/// @param _bountyId the index of the bounty
|
||||
/// @param _newPaysTokens the new bool for whether the contract pays tokens
|
||||
/// @param _newTokenContract the new address of the token
|
||||
function changeBountyPaysTokens(uint _bountyId, bool _newPaysTokens, address _newTokenContract)
|
||||
public
|
||||
validateBountyArrayIndex(_bountyId)
|
||||
onlyIssuer(_bountyId)
|
||||
isAtStage(_bountyId, BountyStages.Draft)
|
||||
{
|
||||
HumanStandardToken oldToken = tokenContracts[_bountyId];
|
||||
bool oldPaysTokens = bounties[_bountyId].paysTokens;
|
||||
bounties[_bountyId].paysTokens = _newPaysTokens;
|
||||
tokenContracts[_bountyId] = HumanStandardToken(_newTokenContract);
|
||||
if (bounties[_bountyId].balance > 0){
|
||||
uint oldBalance = bounties[_bountyId].balance;
|
||||
bounties[_bountyId].balance = 0;
|
||||
if (oldPaysTokens){
|
||||
require(oldToken.transfer(bounties[_bountyId].issuer, oldBalance));
|
||||
} else {
|
||||
bounties[_bountyId].issuer.transfer(oldBalance);
|
||||
}
|
||||
}
|
||||
BountyChanged(_bountyId);
|
||||
}
|
||||
|
||||
modifier newFulfillmentAmountIsIncrease(uint _bountyId, uint _newFulfillmentAmount) {
|
||||
require(bounties[_bountyId].fulfillmentAmount < _newFulfillmentAmount);
|
||||
_;
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
0 info it worked if it ends with ok
|
||||
1 verbose cli [ '/Users/Mark/.nvm/versions/node/v7.6.0/bin/node',
|
||||
1 verbose cli '/Users/Mark/.nvm/versions/node/v7.6.0/bin/npm',
|
||||
1 verbose cli 'run',
|
||||
1 verbose cli 'test' ]
|
||||
2 info using npm@4.1.2
|
||||
3 info using node@v7.6.0
|
||||
4 verbose run-script [ 'pretest', 'test', 'posttest' ]
|
||||
5 info lifecycle StandardBounties@0.1.0~pretest: StandardBounties@0.1.0
|
||||
6 silly lifecycle StandardBounties@0.1.0~pretest: no script for pretest, continuing
|
||||
7 info lifecycle StandardBounties@0.1.0~test: StandardBounties@0.1.0
|
||||
8 verbose lifecycle StandardBounties@0.1.0~test: unsafe-perm in lifecycle true
|
||||
9 verbose lifecycle StandardBounties@0.1.0~test: PATH: /Users/Mark/.nvm/versions/node/v7.6.0/lib/node_modules/npm/bin/node-gyp-bin:/Users/Mark/Desktop/StandardBounties/node_modules/.bin:/Users/Mark/.nvm/versions/node/v7.6.0/bin:/Users/Mark/.nix-profile/bin:/Users/Mark/.nix-profile/sbin:/opt/local/bin:/opt/local/sbin:“/Library/Frameworks/Python.framework/Versions/3.4/bin:/Users/Mark/Downloads/go-ethereum-1.3.5/build/bin:/Applications/XAMPP/xamppfiles/bin/php-5.5.24:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/XAMPP/xamppfiles/bin/php:/Library/TeX/texbin”
|
||||
10 verbose lifecycle StandardBounties@0.1.0~test: CWD: /Users/Mark/Desktop/StandardBounties
|
||||
11 silly lifecycle StandardBounties@0.1.0~test: Args: [ '-c', 'truffle test' ]
|
||||
12 silly lifecycle StandardBounties@0.1.0~test: Returned: code: 112 signal: null
|
||||
13 info lifecycle StandardBounties@0.1.0~test: Failed to exec test script
|
||||
14 verbose stack Error: StandardBounties@0.1.0 test: `truffle test`
|
||||
14 verbose stack Exit status 112
|
||||
14 verbose stack at EventEmitter.<anonymous> (/Users/Mark/.nvm/versions/node/v7.6.0/lib/node_modules/npm/lib/utils/lifecycle.js:279:16)
|
||||
14 verbose stack at emitTwo (events.js:106:13)
|
||||
14 verbose stack at EventEmitter.emit (events.js:192:7)
|
||||
14 verbose stack at ChildProcess.<anonymous> (/Users/Mark/.nvm/versions/node/v7.6.0/lib/node_modules/npm/lib/utils/spawn.js:40:14)
|
||||
14 verbose stack at emitTwo (events.js:106:13)
|
||||
14 verbose stack at ChildProcess.emit (events.js:192:7)
|
||||
14 verbose stack at maybeClose (internal/child_process.js:890:16)
|
||||
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
|
||||
15 verbose pkgid StandardBounties@0.1.0
|
||||
16 verbose cwd /Users/Mark/Desktop/StandardBounties
|
||||
17 error Darwin 16.7.0
|
||||
18 error argv "/Users/Mark/.nvm/versions/node/v7.6.0/bin/node" "/Users/Mark/.nvm/versions/node/v7.6.0/bin/npm" "run" "test"
|
||||
19 error node v7.6.0
|
||||
20 error npm v4.1.2
|
||||
21 error code ELIFECYCLE
|
||||
22 error StandardBounties@0.1.0 test: `truffle test`
|
||||
22 error Exit status 112
|
||||
23 error Failed at the StandardBounties@0.1.0 test script 'truffle test'.
|
||||
23 error Make sure you have the latest version of node.js and npm installed.
|
||||
23 error If you do, this is most likely a problem with the StandardBounties package,
|
||||
23 error not with npm itself.
|
||||
23 error Tell the author that this fails on your system:
|
||||
23 error truffle test
|
||||
23 error You can get information on how to open an issue for this project with:
|
||||
23 error npm bugs StandardBounties
|
||||
23 error Or if that isn't available, you can get their info via:
|
||||
23 error npm owner ls StandardBounties
|
||||
23 error There is likely additional logging output above.
|
||||
24 verbose exit [ 1, true ]
|
|
@ -1089,55 +1089,6 @@ contract('StandardBounties', function(accounts) {
|
|||
|
||||
});
|
||||
|
||||
it("[ETH] verifies that I can change a bounty with no balance from paying in ETH to paying in Tokens", async () => {
|
||||
let registry = await StandardBounties.new(accounts[0]);
|
||||
|
||||
await registry.issueBounty(accounts[0],
|
||||
2528821098,
|
||||
"data",
|
||||
1000,
|
||||
0x0,
|
||||
false,
|
||||
0x0,
|
||||
{from: accounts[0]});
|
||||
let bounty = await registry.getBounty(0);
|
||||
assert(bounty[3] == false);
|
||||
|
||||
await registry.changeBountyPaysTokens(0, true, 0x0, {from: accounts[0]});
|
||||
bounty = await registry.getBounty(0);
|
||||
balance = await web3.eth.getBalance(registry.address);
|
||||
assert(bounty[3] == true);
|
||||
assert(bounty[5] == 0);
|
||||
assert(balance == 0);
|
||||
|
||||
});
|
||||
|
||||
it("[ETH] verifies that I can change a bounty with a balance from paying in ETH to paying in Tokens", async () => {
|
||||
let registry = await StandardBounties.new(accounts[0]);
|
||||
|
||||
await registry.issueBounty(accounts[0],
|
||||
2528821098,
|
||||
"data",
|
||||
1000,
|
||||
0x0,
|
||||
false,
|
||||
0x0,
|
||||
{from: accounts[0]});
|
||||
await registry.contribute(0, 3000, {from: accounts[0], value: 3000});
|
||||
var bounty = await registry.getBounty(0);
|
||||
var balance = await web3.eth.getBalance(registry.address);
|
||||
assert(bounty[5] == 3000);
|
||||
assert(balance == 3000);
|
||||
|
||||
await registry.changeBountyPaysTokens(0, true, 0x0, {from: accounts[0]});
|
||||
bounty = await registry.getBounty(0);
|
||||
balance = await web3.eth.getBalance(registry.address);
|
||||
assert(bounty[3] == true);
|
||||
assert(bounty[5] == 0);
|
||||
assert(balance == 0);
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
|
|
@ -1218,94 +1218,7 @@ contract('StandardBounties', function(accounts) {
|
|||
|
||||
});
|
||||
|
||||
it("[TOKENS] verifies that I can change a bounty with no balance from paying in Tokens to paying in ETH", async () => {
|
||||
let registry = await StandardBounties.new(accounts[0]);
|
||||
let bountyToken = await HumanStandardToken.new(1000000000, "Bounty Token", 18, "BOUNT");
|
||||
|
||||
await registry.issueBounty(accounts[0],
|
||||
2528821098,
|
||||
"data",
|
||||
1000,
|
||||
0x0,
|
||||
true,
|
||||
0x0,
|
||||
{from: accounts[0]});
|
||||
let bounty = await registry.getBounty(0);
|
||||
assert(bounty[3] == true);
|
||||
|
||||
await registry.changeBountyPaysTokens(0, false, 0x0, {from: accounts[0]});
|
||||
bounty = await registry.getBounty(0);
|
||||
balance = await bountyToken.balanceOf(registry.address);
|
||||
assert(bounty[3] == false);
|
||||
assert(bounty[5] == 0);
|
||||
assert(balance == 0);
|
||||
|
||||
});
|
||||
|
||||
it("[TOKENS] verifies that I can change a bounty with a balance from paying in Tokens to paying in ETH", async () => {
|
||||
let registry = await StandardBounties.new(accounts[0]);
|
||||
let bountyToken = await HumanStandardToken.new(1000000000, "Bounty Token", 18, "BOUNT");
|
||||
|
||||
await registry.issueBounty(accounts[0],
|
||||
2528821098,
|
||||
"data",
|
||||
1000,
|
||||
0x0,
|
||||
true,
|
||||
bountyToken.address,
|
||||
{from: accounts[0]});
|
||||
await bountyToken.approve(registry.address, 3000, {from: accounts[0]});
|
||||
await registry.contribute(0, 3000, {from: accounts[0]});
|
||||
var bounty = await registry.getBounty(0);
|
||||
var balance = await bountyToken.balanceOf(registry.address);
|
||||
assert(bounty[5] == 3000);
|
||||
assert(balance == 3000);
|
||||
|
||||
await registry.changeBountyPaysTokens(0, false, 0x0, {from: accounts[0]});
|
||||
bounty = await registry.getBounty(0);
|
||||
balance = await bountyToken.balanceOf(registry.address);
|
||||
assert(bounty[3] == false);
|
||||
assert(bounty[5] == 0);
|
||||
let error = "new balance: " + balance.toString();
|
||||
assert(balance == 0, error);
|
||||
|
||||
});
|
||||
|
||||
it("[TOKENS] verifies that I can change a bounty with a balance from paying in one Tokens to another", async () => {
|
||||
let registry = await StandardBounties.new(accounts[0]);
|
||||
let bountyToken = await HumanStandardToken.new(1000000000, "Bounty Token", 18, "BOUNT");
|
||||
let bountyToken2 = await HumanStandardToken.new(1000000000, "Bounty Token", 18, "BOUNT");
|
||||
|
||||
await registry.issueBounty(accounts[0],
|
||||
2528821098,
|
||||
"data",
|
||||
1000,
|
||||
0x0,
|
||||
true,
|
||||
bountyToken.address,
|
||||
{from: accounts[0]});
|
||||
await bountyToken.approve(registry.address, 3000, {from: accounts[0]});
|
||||
await registry.contribute(0, 3000, {from: accounts[0]});
|
||||
var bounty = await registry.getBounty(0);
|
||||
var balance = await bountyToken.balanceOf(registry.address);
|
||||
assert(bounty[5] == 3000);
|
||||
assert(balance == 3000);
|
||||
|
||||
await registry.changeBountyPaysTokens(0, true, bountyToken2.address, {from: accounts[0]});
|
||||
bounty = await registry.getBounty(0);
|
||||
balance = await bountyToken.balanceOf(registry.address);
|
||||
assert(bounty[3] == true);
|
||||
assert(bounty[5] == 0);
|
||||
assert(balance == 0);
|
||||
|
||||
await bountyToken2.approve(registry.address, 3000, {from: accounts[0]});
|
||||
await registry.contribute(0, 3000, {from: accounts[0]});
|
||||
var bounty = await registry.getBounty(0);
|
||||
var balance = await bountyToken2.balanceOf(registry.address);
|
||||
assert(bounty[5] == 3000);
|
||||
assert(balance == 3000);
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue