小编Yad*_*ash的帖子

msg.sender和address(this)有什么区别?

下面代码中的 msg.sender 和 address(this) 有什么区别?

**编译指示可靠性^0.8.0;

contract Escrow{
  address public payer;
  address payable public payee;
  address public lawyer;
  uint public amount;
  
  constructor(
    address _payer, 
    address payable _payee, 
    uint _amount) {
    payer = _payer;
    payee = _payee;
    lawyer = msg.sender; 
    amount = _amount;
  }

  function deposit() payable public {
    require(msg.sender == payer, 'Sender must be the payer');
    require(address(this).balance <= amount, 'Cant send more than escrow amount');
  }

  function release() public {
    require(address(this).balance == amount, 'cannot release funds before full amount is …
Run Code Online (Sandbox Code Playgroud)

ethereum solidity web3js

5
推荐指数
2
解决办法
3291
查看次数

标签 统计

ethereum ×1

solidity ×1

web3js ×1