Move contracts to subdirectories (#1253)
* Move contracts to subdirectories Fixes #1177. This Change also removes the LimitBalance contract. * fix import * move MerkleProof to cryptography * Fix import
This commit is contained in:
committed by
Francisco Giordano
parent
964bc4044a
commit
2441fd7d17
@ -2,8 +2,8 @@ const { ethGetBalance, ethSendTransaction } = require('./helpers/web3');
|
||||
const expectEvent = require('./helpers/expectEvent');
|
||||
const { assertRevert } = require('./helpers/assertRevert');
|
||||
|
||||
const SecureTargetBounty = artifacts.require('SecureTargetBounty');
|
||||
const InsecureTargetBounty = artifacts.require('InsecureTargetBounty');
|
||||
const SecureInvariantTargetBounty = artifacts.require('SecureInvariantTargetBounty');
|
||||
const InsecureInvariantTargetBounty = artifacts.require('InsecureInvariantTargetBounty');
|
||||
|
||||
require('chai')
|
||||
.use(require('chai-bignumber')(web3.BigNumber))
|
||||
@ -17,10 +17,10 @@ const sendReward = async (from, to, value) => ethSendTransaction({
|
||||
|
||||
const reward = new web3.BigNumber(web3.toWei(1, 'ether'));
|
||||
|
||||
contract('Bounty', function ([_, owner, researcher, nonTarget]) {
|
||||
contract('BreakInvariantBounty', function ([_, owner, researcher, nonTarget]) {
|
||||
context('against secure contract', function () {
|
||||
beforeEach(async function () {
|
||||
this.bounty = await SecureTargetBounty.new({ from: owner });
|
||||
this.bounty = await SecureInvariantTargetBounty.new({ from: owner });
|
||||
});
|
||||
|
||||
it('can set reward', async function () {
|
||||
@ -53,7 +53,7 @@ contract('Bounty', function ([_, owner, researcher, nonTarget]) {
|
||||
|
||||
context('against broken contract', function () {
|
||||
beforeEach(async function () {
|
||||
this.bounty = await InsecureTargetBounty.new();
|
||||
this.bounty = await InsecureInvariantTargetBounty.new();
|
||||
|
||||
const result = await this.bounty.createTarget({ from: researcher });
|
||||
const event = expectEvent.inLogs(result.logs, 'TargetCreated');
|
||||
@ -1,59 +0,0 @@
|
||||
const { assertRevert } = require('./helpers/assertRevert');
|
||||
const { ethGetBalance } = require('./helpers/web3');
|
||||
|
||||
const LimitBalanceMock = artifacts.require('LimitBalanceMock');
|
||||
|
||||
const BigNumber = web3.BigNumber;
|
||||
|
||||
require('chai')
|
||||
.use(require('chai-bignumber')(BigNumber))
|
||||
.should();
|
||||
|
||||
contract('LimitBalance', function () {
|
||||
let limitBalance;
|
||||
|
||||
beforeEach(async function () {
|
||||
limitBalance = await LimitBalanceMock.new();
|
||||
});
|
||||
|
||||
const LIMIT = 1000;
|
||||
|
||||
it('should expose limit', async function () {
|
||||
const limit = await limitBalance.limit();
|
||||
limit.should.be.bignumber.equal(LIMIT);
|
||||
});
|
||||
|
||||
it('should allow sending below limit', async function () {
|
||||
const amount = 1;
|
||||
await limitBalance.limitedDeposit({ value: amount });
|
||||
|
||||
const balance = await ethGetBalance(limitBalance.address);
|
||||
balance.should.be.bignumber.equal(amount);
|
||||
});
|
||||
|
||||
it('shouldnt allow sending above limit', async function () {
|
||||
const amount = 1110;
|
||||
await assertRevert(limitBalance.limitedDeposit({ value: amount }));
|
||||
});
|
||||
|
||||
it('should allow multiple sends below limit', async function () {
|
||||
const amount = 500;
|
||||
await limitBalance.limitedDeposit({ value: amount });
|
||||
|
||||
const balance = await ethGetBalance(limitBalance.address);
|
||||
balance.should.be.bignumber.equal(amount);
|
||||
|
||||
await limitBalance.limitedDeposit({ value: amount });
|
||||
const updatedBalance = await ethGetBalance(limitBalance.address);
|
||||
updatedBalance.should.be.bignumber.equal(amount * 2);
|
||||
});
|
||||
|
||||
it('shouldnt allow multiple sends above limit', async function () {
|
||||
const amount = 500;
|
||||
await limitBalance.limitedDeposit({ value: amount });
|
||||
|
||||
const balance = await ethGetBalance(limitBalance.address);
|
||||
balance.should.be.bignumber.equal(amount);
|
||||
await assertRevert(limitBalance.limitedDeposit({ value: amount + 1 }));
|
||||
});
|
||||
});
|
||||
@ -1,7 +1,7 @@
|
||||
const { signMessage, toEthSignedMessageHash } = require('../helpers/sign');
|
||||
const { expectThrow } = require('../helpers/expectThrow');
|
||||
|
||||
const ECRecoveryMock = artifacts.require('ECRecoveryMock');
|
||||
const ECDSAMock = artifacts.require('ECDSAMock');
|
||||
|
||||
require('chai')
|
||||
.should();
|
||||
@ -9,9 +9,9 @@ require('chai')
|
||||
const TEST_MESSAGE = web3.sha3('OpenZeppelin');
|
||||
const WRONG_MESSAGE = web3.sha3('Nope');
|
||||
|
||||
contract('ECRecovery', function ([_, anyone]) {
|
||||
contract('ECDSA', function ([_, anyone]) {
|
||||
beforeEach(async function () {
|
||||
this.mock = await ECRecoveryMock.new();
|
||||
this.mock = await ECDSAMock.new();
|
||||
});
|
||||
|
||||
it('recover v0', async function () {
|
||||
Reference in New Issue
Block a user