@0x/contracts-zero-ex: Address audit feedback.

This commit is contained in:
Lawrence Forman
2020-06-04 16:15:38 -04:00
parent cb2cc05cac
commit ebfa62637e
26 changed files with 258 additions and 321 deletions

View File

@@ -23,6 +23,7 @@ blockchainTests.resets('Full migration', env => {
let zeroEx: ZeroExContract;
let features: FullFeatures;
let migrator: TestFullMigrationContract;
const transformerDeployer = randomAddress();
before(async () => {
[owner] = await env.getAccountAddressesAsync();
@@ -34,7 +35,7 @@ blockchainTests.resets('Full migration', env => {
artifacts,
env.txDefaults.from as string,
);
const deployCall = migrator.deploy(owner, toFeatureAdddresses(features));
const deployCall = migrator.deploy(owner, toFeatureAdddresses(features), { transformerDeployer });
zeroEx = new ZeroExContract(await deployCall.callAsync(), env.provider, env.txDefaults);
await deployCall.awaitTransactionSuccessAsync();
});
@@ -52,7 +53,9 @@ blockchainTests.resets('Full migration', env => {
it('Non-deployer cannot call deploy()', async () => {
const notDeployer = randomAddress();
const tx = migrator.deploy(owner, toFeatureAdddresses(features)).callAsync({ from: notDeployer });
const tx = migrator
.deploy(owner, toFeatureAdddresses(features), { transformerDeployer })
.callAsync({ from: notDeployer });
return expect(tx).to.revertWith('FullMigration/INVALID_SENDER');
});
@@ -63,7 +66,13 @@ blockchainTests.resets('Full migration', env => {
},
TransformERC20: {
contractType: ITransformERC20Contract,
fns: ['transformERC20', '_transformERC20', 'createTransformWallet', 'getTransformWallet'],
fns: [
'transformERC20',
'_transformERC20',
'createTransformWallet',
'getTransformWallet',
'setTransformerDeployer',
],
},
};
@@ -162,4 +171,16 @@ blockchainTests.resets('Full migration', env => {
return expect(allowanceTarget.authorized(zeroEx.address).callAsync()).to.become(true);
});
});
describe('TransformERC20', () => {
let feature: ITransformERC20Contract;
before(async () => {
feature = new ITransformERC20Contract(zeroEx.address, env.provider, env.txDefaults);
});
it('has the correct transformer deployer', async () => {
return expect(feature.getTransformerDeployer().callAsync()).to.become(transformerDeployer);
});
});
});