账户
0xbe...feae
0xbE...fEAE

0xbE...fEAE

$500
此合同的源代码已经过验证!
合同元数据
编译器
0.5.16+commit.9c3226ce
语言
Solidity
合同源代码
文件 1 的 1:EthRepayAllHelper.sol
pragma solidity ^0.5.16;

interface IAnEth {
    function repayBorrowBehalf(address borrower) external payable;
    function borrowBalanceCurrent(address account) external returns (uint);
}

contract EthRepayAllHelper {

    IAnEth public anEth;

    constructor(IAnEth _anEth) public {
        anEth = _anEth;
    }

    function repayAll() public payable {
        uint debt = anEth.borrowBalanceCurrent(msg.sender);
        require(debt > 0 && debt <= msg.value, "Debt checks failure");
        anEth.repayBorrowBehalf.value(debt)(msg.sender);
        uint remainder = address(this).balance;
        if(remainder > 0) {
            msg.sender.transfer(remainder);
        }
    }

}
设置
{
  "compilationTarget": {
    "contracts/EthRepayAllHelper.sol": "EthRepayAllHelper"
  },
  "evmVersion": "istanbul",
  "libraries": {},
  "metadata": {
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "remappings": []
}
ABI
[{"inputs":[{"internalType":"contract IAnEth","name":"_anEth","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"constant":true,"inputs":[],"name":"anEth","outputs":[{"internalType":"contract IAnEth","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"repayAll","outputs":[],"payable":true,"stateMutability":"payable","type":"function"}]