Hello @abcoathup
Can you help me for this functionality on Binance Smart Chain too?
I did follow your way to check transferFrom functionality and I have error transaction .
contract TestVault is BEP20{
using SafeBEP20 for IBEP20;
using Address for address;
using SafeMath for uint256;
IBEP20 public token;
event DoneStuff(address from ,address to ,uint256 amount);
uint256 public min = 10000;
uint256 public constant max = 10000;
address public governance;
address public controller;
constructor(address _token, address _controller)
public
BEP20(
string(abi.encodePacked("Test ", BEP20(_token).name())),
string(abi.encodePacked("test", BEP20(_token).symbol()))
)
{
token = IBEP20(_token);
governance = msg.sender;
controller = _controller;
}
function balance() public view returns(uint256){
return token.balanceOf(address(this));
}
function doStuff() external{
address from = msg.sender;
address to = address(this);
uint256 amount = 1e18;
token.transferFrom(from,to,amount);
emit DoneStuff(from,to,amount);
}
function deposit(uint256 _amount) public {
// uint256 _pool = balance();
// uint256 _before = token.balanceOf(address(this));
token.safeTransferFrom(msg.sender,address(this), _amount);
// uint256 _after = token.balanceOf(address(this));
// _amount = _after.sub(_before); // Additional check for deflationary tokens
// uint256 shares = 0;
// if (totalSupply() == 0) {
// shares = _amount;
// //
// } else {
// shares = (_amount.mul(totalSupply())).div(_pool);
// }
// _mint(msg.sender, shares);
}
}