message: fix(market-matcher): use fillAt
  FillAt allows us to split and fill certificates that energy exceeded required demand
diff: @@ -24,7 +24,7 @@ describe('Market-matcher e2e tests', async () => {
  const assertMatched = (
  config: Configuration.Entity,
  demand: Demand.Entity,
  - certificate: PurchasableCertificate.Entity,
  + certificateId: string,
  requiredEnergy: number,
  done: Mocha.Done
  ) => {
  @@ -37,13 +37,18 @@ describe('Market-matcher e2e tests', async () => {
  const { _demandId, _certificateId, _amount } = event.returnValues;
  if (_demandId === demand.id) {
  + const certificate = await new PurchasableCertificate.Entity(
  + certificateId,
  + config
  + ).sync();
  +
  assert.equal(_certificateId, certificate.id);
  assert.equal(_amount, requiredEnergy);
  -
  - const updatedCertificate = await certificate.sync();
  - assert.equal(updatedCertificate.certificate.owner, demand.demandOwner);
  + assert.equal(certificate.certificate.owner, demand.demandOwner);
  done();
  + } else {
  + done('Non-matching demandId');
  }
  });
  @@ -78,7 +83,7 @@ describe('Market-matcher e2e tests', async () => {
  });
  it('certificate should be matched with existing demand', done => {
  - assertMatched(config, demand, certificate, requiredEnergy, done);
  + assertMatched(config, demand, certificate.id, requiredEnergy, done);
  }).timeout(20000);
  });
  @@ -109,7 +114,10 @@ describe('Market-matcher e2e tests', async () => {
  });
  it('certificate should be matched with existing demand', done => {
  - assertMatched(config, demand, certificate, requiredEnergy, done);
  + // here we expecting that initial certificate #0 will be split into #1 and #2
  + // #1 is expected to be matched with the demand
  + const expectedMatchedCertificateId = '1';
  + assertMatched(config, demand, expectedMatchedCertificateId, requiredEnergy, done);
  }).timeout(20000);
  });
  @@ -138,7 +146,7 @@ describe('Market-matcher e2e tests', async () => {
  });
  it('demand should be matched with existing certificate', done => {
  - assertMatched(config, demand, certificate, requiredEnergy, done);
  + assertMatched(config, demand, certificate.id, requiredEnergy, done);
  }).timeout(60000);
  });
  @@ -172,7 +180,7 @@ describe('Market-matcher e2e tests', async () => {
  });
  it('demand should be matched with existing certificate', done => {
  - assertMatched(config, demand, certificate, requiredEnergy, done);
  + assertMatched(config, demand, certificate.id, requiredEnergy, done);
  }).timeout(60000);
  });
  });
  