问题是津贴和批准是做什么的?
这是什么_spender
以及它在做什么?
有人能解释一下吗?
contract Token {
uint256 public totalSupply;
function balanceOf(address _owner) constant returns (uint256 balance);
function transfer(address _to, uint256 value) returns (bool success);
function transferFrom(address _from, address _to, uint256 value) returns (bool success);
function approve(address _spender, uint256 _value) returns (bool success);
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
答案 0 :(得分:9)
真正的补贴是什么?
假设我们的用户 A 和用户 B 。 A 有1000个令牌,并希望允许 B 花费100个令牌。
approve(address(B), 100)
allowance(address(A), address(B))
transferFrom(address(A), address(B), 100)