truffle 2=>3
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
const assertJump = require('./helpers/assertJump');
|
||||
|
||||
var BasicTokenMock = artifacts.require("./helpers/BasicTokenMock.sol");
|
||||
|
||||
contract('BasicToken', function(accounts) {
|
||||
|
||||
it("should return the correct totalSupply after construction", async function() {
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
const assertJump = require('./helpers/assertJump');
|
||||
const timer = require('./helpers/timer');
|
||||
var VestedTokenMock = artifacts.require("./helpers/VestedTokenMock.sol");
|
||||
|
||||
contract('VestedToken', function(accounts) {
|
||||
let token = null
|
||||
|
||||
15
test/helpers/BasicTokenMock.sol
Normal file
15
test/helpers/BasicTokenMock.sol
Normal file
@ -0,0 +1,15 @@
|
||||
pragma solidity ^0.4.4;
|
||||
|
||||
|
||||
import '../../contracts/token/BasicToken.sol';
|
||||
|
||||
|
||||
// mock class using BasicToken
|
||||
contract BasicTokenMock is BasicToken {
|
||||
|
||||
function BasicTokenMock(address initialAccount, uint initialBalance) {
|
||||
balances[initialAccount] = initialBalance;
|
||||
totalSupply = initialBalance;
|
||||
}
|
||||
|
||||
}
|
||||
23
test/helpers/DayLimitMock.sol
Normal file
23
test/helpers/DayLimitMock.sol
Normal file
@ -0,0 +1,23 @@
|
||||
pragma solidity ^0.4.4;
|
||||
import "../../contracts/DayLimit.sol";
|
||||
|
||||
contract DayLimitMock is DayLimit {
|
||||
uint public totalSpending;
|
||||
|
||||
function DayLimitMock(uint _value) DayLimit(_value) {
|
||||
totalSpending = 0;
|
||||
}
|
||||
|
||||
function attemptSpend(uint _value) external limitedDaily(_value) {
|
||||
totalSpending += _value;
|
||||
}
|
||||
|
||||
function setDailyLimit(uint _newLimit) external {
|
||||
_setDailyLimit(_newLimit);
|
||||
}
|
||||
|
||||
function resetSpentToday() external {
|
||||
_resetSpentToday();
|
||||
}
|
||||
|
||||
}
|
||||
17
test/helpers/InsecureTargetBounty.sol
Normal file
17
test/helpers/InsecureTargetBounty.sol
Normal file
@ -0,0 +1,17 @@
|
||||
pragma solidity ^0.4.4;
|
||||
|
||||
|
||||
import {Bounty, Target} from "../../contracts/Bounty.sol";
|
||||
|
||||
|
||||
contract InsecureTargetMock is Target {
|
||||
function checkInvariant() returns(bool){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
contract InsecureTargetBounty is Bounty {
|
||||
function deployContract() internal returns (address) {
|
||||
return new InsecureTargetMock();
|
||||
}
|
||||
}
|
||||
13
test/helpers/LimitBalanceMock.sol
Normal file
13
test/helpers/LimitBalanceMock.sol
Normal file
@ -0,0 +1,13 @@
|
||||
pragma solidity ^0.4.4;
|
||||
|
||||
|
||||
import '../../contracts/LimitBalance.sol';
|
||||
|
||||
|
||||
// mock class using LimitBalance
|
||||
contract LimitBalanceMock is LimitBalance(1000) {
|
||||
|
||||
function limitedDeposit() payable limitedPayable {
|
||||
}
|
||||
|
||||
}
|
||||
12
test/helpers/MultisigWalletMock.sol
Normal file
12
test/helpers/MultisigWalletMock.sol
Normal file
@ -0,0 +1,12 @@
|
||||
pragma solidity ^0.4.4;
|
||||
import "../../contracts/MultisigWallet.sol";
|
||||
|
||||
contract MultisigWalletMock is MultisigWallet {
|
||||
uint public totalSpending;
|
||||
|
||||
function MultisigWalletMock(address[] _owners, uint _required, uint _daylimit)
|
||||
MultisigWallet(_owners, _required, _daylimit) payable { }
|
||||
|
||||
function changeOwner(address _from, address _to) external { }
|
||||
|
||||
}
|
||||
25
test/helpers/PausableMock.sol
Normal file
25
test/helpers/PausableMock.sol
Normal file
@ -0,0 +1,25 @@
|
||||
pragma solidity ^0.4.4;
|
||||
|
||||
|
||||
import '../../contracts/lifecycle/Pausable.sol';
|
||||
|
||||
|
||||
// mock class using Pausable
|
||||
contract PausableMock is Pausable {
|
||||
bool public drasticMeasureTaken;
|
||||
uint public count;
|
||||
|
||||
function PausableMock() {
|
||||
drasticMeasureTaken = false;
|
||||
count = 0;
|
||||
}
|
||||
|
||||
function normalProcess() external stopInEmergency {
|
||||
count++;
|
||||
}
|
||||
|
||||
function drasticMeasure() external onlyInEmergency {
|
||||
drasticMeasureTaken = true;
|
||||
}
|
||||
|
||||
}
|
||||
17
test/helpers/PullPaymentMock.sol
Normal file
17
test/helpers/PullPaymentMock.sol
Normal file
@ -0,0 +1,17 @@
|
||||
pragma solidity ^0.4.4;
|
||||
|
||||
|
||||
import '../../contracts/payment/PullPayment.sol';
|
||||
|
||||
|
||||
// mock class using PullPayment
|
||||
contract PullPaymentMock is PullPayment {
|
||||
|
||||
function PullPaymentMock() payable { }
|
||||
|
||||
// test helper function to call asyncSend
|
||||
function callSend(address dest, uint amount) {
|
||||
asyncSend(dest, amount);
|
||||
}
|
||||
|
||||
}
|
||||
21
test/helpers/SafeMathMock.sol
Normal file
21
test/helpers/SafeMathMock.sol
Normal file
@ -0,0 +1,21 @@
|
||||
pragma solidity ^0.4.4;
|
||||
|
||||
|
||||
import '../../contracts/SafeMath.sol';
|
||||
|
||||
|
||||
contract SafeMathMock is SafeMath {
|
||||
uint public result;
|
||||
|
||||
function multiply(uint a, uint b) {
|
||||
result = safeMul(a, b);
|
||||
}
|
||||
|
||||
function subtract(uint a, uint b) {
|
||||
result = safeSub(a, b);
|
||||
}
|
||||
|
||||
function add(uint a, uint b) {
|
||||
result = safeAdd(a, b);
|
||||
}
|
||||
}
|
||||
17
test/helpers/SecureTargetBounty.sol
Normal file
17
test/helpers/SecureTargetBounty.sol
Normal file
@ -0,0 +1,17 @@
|
||||
pragma solidity ^0.4.4;
|
||||
|
||||
|
||||
import {Bounty, Target} from "../../contracts/Bounty.sol";
|
||||
|
||||
|
||||
contract SecureTargetMock is Target {
|
||||
function checkInvariant() returns(bool) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
contract SecureTargetBounty is Bounty {
|
||||
function deployContract() internal returns (address) {
|
||||
return new SecureTargetMock();
|
||||
}
|
||||
}
|
||||
16
test/helpers/ShareableMock.sol
Normal file
16
test/helpers/ShareableMock.sol
Normal file
@ -0,0 +1,16 @@
|
||||
pragma solidity ^0.4.4;
|
||||
import "../../contracts/ownership/Shareable.sol";
|
||||
|
||||
contract ShareableMock is Shareable {
|
||||
|
||||
uint public count = 0;
|
||||
|
||||
function ShareableMock(address[] _owners, uint _required) Shareable(_owners, _required) {
|
||||
|
||||
}
|
||||
|
||||
function increaseCount(bytes32 action) onlymanyowners(action) {
|
||||
count = count + 1;
|
||||
}
|
||||
|
||||
}
|
||||
15
test/helpers/StandardTokenMock.sol
Normal file
15
test/helpers/StandardTokenMock.sol
Normal file
@ -0,0 +1,15 @@
|
||||
pragma solidity ^0.4.4;
|
||||
|
||||
|
||||
import '../../contracts/token/StandardToken.sol';
|
||||
|
||||
|
||||
// mock class using StandardToken
|
||||
contract StandardTokenMock is StandardToken {
|
||||
|
||||
function StandardTokenMock(address initialAccount, uint initialBalance) {
|
||||
balances[initialAccount] = initialBalance;
|
||||
totalSupply = initialBalance;
|
||||
}
|
||||
|
||||
}
|
||||
11
test/helpers/VestedTokenMock.sol
Normal file
11
test/helpers/VestedTokenMock.sol
Normal file
@ -0,0 +1,11 @@
|
||||
pragma solidity ^0.4.4;
|
||||
|
||||
import '../../contracts/token/VestedToken.sol';
|
||||
|
||||
// mock class using StandardToken
|
||||
contract VestedTokenMock is VestedToken {
|
||||
function VestedTokenMock(address initialAccount, uint initialBalance) {
|
||||
balances[initialAccount] = initialBalance;
|
||||
totalSupply = initialBalance;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user