I have developed a small contract which is calling another contract to mine some standard ERC20 token (OpenZeppelin contract v2.5).
On ganache it worked always fine.
Deoyed Sunday on Kovan, got a transaction id after contract .send(), then it stayed forever in ‘pending’ state.
Deployed it Monday on Rinkeby , initiated a transaction, and it worked fine, confirmed within 20 sec.
Doing the same again today on Rinkeby, now here as well the transaction stays in ‘pending’ state !
actually its just a contract which stores the deployed address of the OZ ErC20 token, cals .mint (owner, amout) and writes some data to its own datafield on the blockchain).
I increased gas price to 50 GWei, did not help.
Strangely when I had the problem already on kovan on Sunday, even the call from remix to the deployed contract was not mined … so yes, it looks like its actually something with the.contract (not the UI)
function addItem(
string memory _fileHash,
uint _productAmount,
string memory _productName,
uint _mintAmount,
string memory _metadata)
public
{
// check if any parameter is too long / out of scope
// check if item does not already exist
require(itemByHash[_fileHash].registrar == address(0), "item hash is already registered");
// TODO implement payable contract
// require(msg.value (uint) == price, "amount sent does not match price"); // number of wei sent with the message
// check if a token contract has been set
require(address(tokenContract) != address(0), 'No token contract defined');
bool tokenMintResult = tokenContract.mint(tx.origin, _mintAmount);
require(tokenMintResult, "Token mint process failed");
Item memory item = Item({
id : itemCount,
registrar : msg.sender, // tx.origin ? https://solidity.readthedocs.io/en/v0.5.3/security-considerations.html#tx-origin
blockTimestamp : block.timestamp, // do we actually have to store that explicitly? TODO?
productName : _productName,
productAmount : _productAmount,
tokenContractAddress : address(tokenContract), // tokenContract.address, .this (current contract’s type): the current contract, explicitly convertible to address // TODO
mintAmount : _mintAmount,
fileHash : _fileHash,
// tokenMintTx : tokenMintResult,
metadata : _metadata
});
// add new item to mapping : hash -> item
itemByHash[_fileHash] = item;
// add new item to mapping : id -> item
items[itemCount++] = item;
// add new item to registrar.array[] > item
itemsOfRegistrar[msg.sender].push(item);
emit eventAddItem(int(itemCount - 1));
}