I built a vending machine which is loaded (initialized) with an NFT (ERC721) and dispenses generic tokens (ERC20) to any wallet. The main functions are fractionalize & allocate included below:
function fractionalize(uint256 _tokenId) external onlyRole(FRACTIONALIZE_ROLE) {
uint256 _quantity = (nft.getTreeQuantity(_tokenId)); // improvement removing the quantity entered.
_stake(msg.sender, _tokenId, _quantity);
_mintTrees(address(this), _quantity*TOKEN);
}
function _stake returns true, however _mintTrees does not.
function allocate(uint _tokenId, uint256 _quantity, address _to) external {
_unstake(msg.sender, _tokenId, _quantity, _to);
_transferTrees(_to, TOKEN*_quantity);
}
function _unstake returns true but _transfer does not.
No specific reason for not returning anything. I am to build a node app which can trigger the defender relay from an API call. Although I am having trouble triggering any transaction from my relay wallet automated or not.
Environment
relay wallet, admin smart contract
Details
Wallet has a balance, 0xef60752fb5daca86f5f2698aeba5d827e8daa7ee
contract on mumbai, 0x350772fa477E6D2473DA3a85a9E76849bf82d43d
Code to reproduce
I tried to do all the other suggestions of adding modifiers, making the function public/external.. adding roles and setting roles to relay address. I am not sure if it is a problem with the relay set up, or my contract code. Since I can send transactions fine from my wallet on remix I am wondering if it could be a set up issue...