토큰 계약을 생성하기 위해 공식 코드를 사용하고 새 계약을 만들었습니다. 이제이 새로운 계약을 사용하여 토큰 계약을 호출하고 A 계정에서 B 계정으로 토큰을 이체하고 양도 할 수없는 할당량 문제가 발생하기를 바랍니다. 내가 직접 승인 메소드를 호출하는 토큰 계약을 사용하는 경우다른 non-eth erc-20 토큰 전송 작업에 대한 확정 계약
pragma solidity ^0.4.17;
interface Token {
function approve(address spender, uint256 value) public returns (bool);
function transferFrom(address from, address to, uint256 value) public returns (bool);
}
/**
* The TrxCoin contract does this and that...
*/
contract TrxCoin {
Token token = Token(0xAc08fe3C9F442990C52904dE997D9972499bD3E6);
function getContractAddr() view public returns (address) {
return this;
}
function approve(address spender, uint256 value) public {
require(token.approve(spender, value));
}
function transfer(address _to, uint value) public payable {
require(token.transferFrom(msg.sender, _to, value));
}
}
, 나는 새로운 계약을 통해 전송할 수 있습니다,하지만 난 새로운 계약과 승인 메서드를 호출하여 직접 할당량을 할당 할 수 없습니다.
왜 이런가요? 답변 감사합니다!
답장을 보내 주셔서 감사합니다. 내가 approre를 사용하여 주소 A의 주소로 계약 TrxCoin의 주소를 설정하면 전송 작업을 수행 할 수 있습니까? – Leo