院长你好,我想要实现在一个合约里能够调用其它erc20的token的approve简化要从前端调用token的approve这样可以吗?我试了,其中tokenInter为erc20的接口
//授权token
function approveToken(address tokenAddress,address _to,uint256 amount)public{
tokenInter(tokenAddress).approve(_to,amount);
}
但是这样它授权的会是这样:
"address tokenAddress": "0xe2899bddFD890e320e643044c6b95B9B0b84157A",
"address _to": "0x5e17b14ADd6c386305A32928F985b29bbA34Eff5",
"uint256 amount": "100000000000000000000000000"
}
decoded output {}
logs [
{
"from": "0xe2899bddFD890e320e643044c6b95B9B0b84157A",
"topic": "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925",
"event": "Approval",
"args": {
"0": "0x5e17b14ADd6c386305A32928F985b29bbA34Eff5",
"1": "0x5e17b14ADd6c386305A32928F985b29bbA34Eff5",
"2": "100000000000000000000000000",
"owner": "0x5e17b14ADd6c386305A32928F985b29bbA34Eff5",
"spender": "0x5e17b14ADd6c386305A32928F985b29bbA34Eff5",
"value": "100000000000000000000000000"
}
也就是会将你部署的合约地址授权到自己部署的合约地址,而不是调用者授权给合约地址,这个是可以解决的吗?