ERC884 Crowdsale: Revert on function `buyTokens()` for verified token holders


@nventuro - seeking additional help on the topic about ERC884 Crowdsales I previously posted about here:

For context, this crowdsale should revert when calling buyTokens() from an unverified account on the ERC884 contract, but deliver tokens when calling buyTokens() from a verified account.

In my truffle tests, I am able to verify a thirdParty account, then send ETH from that account to the crowdsale to successfully acquire tokens.

However when I deploy to Rinkeby and verify a thirdParty account after deployment, the function buyTokens() reverts. What is interesting here is that, accounts verified at the point of deployment can buy tokens by sending ETH or calling _buyTokens, however accounts verified after deployment are unable to be beneficiaries of these tokens.

The issue seems to come from the function _deliverTokens() calling the token.safeTransfer() method. However the transfer method is overwritten in the ERC884 specification to check if the address is approved first.

What would be the best way to troubleshoot this? I am antsy about overriding the _deliverTokens method, but I think this may be the issue here.

1 Like


That should be fine, since safeTransfer() will simply call the overridden method.

Tests working on truffle but failing to pass on a testnet are usually a symptom of a misconfiguration of the test suite: typically, leaving the sender of a transaction to be the default address. Are you sure that the reverting transactions come from a verified account (via isVerified)?

1 Like