`@0x/contracts-zero-ex`: `bootstrap()` de-registers itself and self-destructs once it's called. `@0x/contracts-zero-ex`: `bootstrap()` now takes arbitrary call data, but the callee is fixed in an immutable. `@0x/contracts-zero-ex`: `bootstrap()` caller is fixed in an immutable. `@0x/contracts-zero-ex`: `bootstrap()` only calls a single target. `@0x/contracts-zero-ex`: Renamed `BasicMigration` to `InitialMigration`. `@0x/contracts-zero-ex`: `InitialMigration` is now the bootstrap target and multiplexes to the initial features. `@0x/contracts-zero-ex`: Add `Migrate` feature and tests. `@0x/contracts-zero-ex`: Re-organize contract locatins (remove `interfaces` folder).
58 lines
2.1 KiB
TypeScript
58 lines
2.1 KiB
TypeScript
import { blockchainTests, expect } from '@0x/contracts-test-utils';
|
|
import { ZeroExRevertErrors } from '@0x/utils';
|
|
|
|
import { artifacts } from './artifacts';
|
|
import { IBootstrapContract, IOwnableContract, TestInitialMigrationContract, ZeroExContract } from './wrappers';
|
|
|
|
blockchainTests.resets('Initial migration', env => {
|
|
let owner: string;
|
|
let zeroEx: ZeroExContract;
|
|
let migrator: TestInitialMigrationContract;
|
|
let bootstrapFeature: IBootstrapContract;
|
|
|
|
before(async () => {
|
|
[owner] = await env.getAccountAddressesAsync();
|
|
migrator = await TestInitialMigrationContract.deployFrom0xArtifactAsync(
|
|
artifacts.TestInitialMigration,
|
|
env.provider,
|
|
env.txDefaults,
|
|
artifacts,
|
|
);
|
|
bootstrapFeature = new IBootstrapContract(
|
|
await migrator.bootstrapFeature().callAsync(),
|
|
env.provider,
|
|
env.txDefaults,
|
|
{},
|
|
);
|
|
const deployCall = migrator.deploy(owner);
|
|
zeroEx = new ZeroExContract(await deployCall.callAsync(), env.provider, env.txDefaults);
|
|
await deployCall.awaitTransactionSuccessAsync();
|
|
});
|
|
|
|
describe('bootstrapping', () => {
|
|
it('Migrator cannot call bootstrap() again', async () => {
|
|
const tx = migrator.callBootstrap(zeroEx.address).awaitTransactionSuccessAsync();
|
|
const selector = bootstrapFeature.getSelector('bootstrap');
|
|
return expect(tx).to.revertWith(new ZeroExRevertErrors.Proxy.NotImplementedError(selector));
|
|
});
|
|
});
|
|
|
|
describe('Ownable feature', () => {
|
|
let ownable: IOwnableContract;
|
|
|
|
before(async () => {
|
|
ownable = new IOwnableContract(zeroEx.address, env.provider, env.txDefaults);
|
|
});
|
|
|
|
it('has the correct owner', async () => {
|
|
const actualOwner = await ownable.getOwner().callAsync();
|
|
expect(actualOwner).to.eq(owner);
|
|
});
|
|
});
|
|
|
|
it('bootstrap feature self destructs after deployment', async () => {
|
|
const codeSize = await migrator.getCodeSizeOf(bootstrapFeature.address).callAsync();
|
|
expect(codeSize).to.bignumber.eq(0);
|
|
});
|
|
});
|