I have a crowdsale contract that inherits RefundableCrowdsale.sol
from OpenZeppelin. I was using their v1.10.0 initially, but now revamping it using v1.12.0.
contract TestTokenCrowdsale is Crowdsale, MintedCrowdsale, CappedCrowdsale, TimedCrowdsale, WhitelistedCrowdsale, RefundableCrowdsale { ... }
and wrote a test script to test refunds.
In v1.10.0 this worked:
const RefundVault = artifacts.require('./RefundVault');
contract('TestTokenCrowdsale', function(accounts) {
beforeEach(async function () {
...
this.goal = ether(50);
this.crowdsale = await TestTokenCrowdsale.new(
...
this.goal
);
// Track refund vault
this.vaultAddress = await this.crowdsale.vault();
this.vault = RefundVault.at(this.vaultAddress);
)};
describe('during crowdsale', function() {
it('prevents other accounts from claiming refund', async function() {
await this.vault.refund(accounts[2], { from: accounts[2]}).should.be.rejectedWith(EVMRevert);
});
});
}
But in v1.12.0 RefundVault.sol
has changed to RefundEscrow.sol
.
Before, I could track refund vault in beforeEach
.
this.vaultAddress = await this.crowdsale.vault();
this.vault = RefundVault.at(this.vaultAddress);
This was possible because this.crowdsale.vault()
is public in v1.10.0. However, since in v1.12.0 escrow
became private, I'm not sure how to modify it accordingly.
this.vault.refund
won't work either because they removed refund
in v1.12.0 as well.
How can I change to test prevents other accounts from claiming refund
in v1.12.0?