57367


トークンを購入する処理に、返金機能をつけています

[code]

    pragma solidity ^0.5.0;
    
    import 'https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC721/ERC721Full.sol';
    import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC721/ERC721Mintable.sol";
    import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC721/ERC721MetadataMintable.sol";
    
    import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/ownership/Ownable.sol";
    
    contract Ticketing is ERC721Full, ERC721Mintable, ERC721MetadataMintable, Ownable {
    
        uint256 public constant ticket_price = 300;
    
        event Ticketing(string _symbol, address _msg_sender, uint256 _token_id);
        event TicketingCancel(string _symbol, address _msg_sender, uint256 _token_id);
    
        uint256 internal next_token_id = 0;
        uint256 private constant e2w = 10**18;
        uint256 private constant price = ticket_price * e2w;
    
        constructor() ERC721Full("Ticketing", "Ticketing") public {
        }
    
        function() payable external{
            require(msg.value == price);
    
            for(uint256 token_id = 0; token_id < this.totalSupply(); token_id++) {
                if (this.ownerOf(token_id) == this.owner()) {
                    this.transferFrom(address(this), msg.sender, token_id);
                    emit Ticketing(this.symbol(), msg.sender, token_id);
                    break;
                }
            }
        }
    
        function cancel(uint256 _token_id) external returns(uint256) {
            require(this.ownerOf(_token_id) == msg.sender);
    
            this.transferFrom(msg.sender, this.owner(), _token_id);
            _withdraw(msg.sender);
            emit TicketingCancel(this.symbol(), msg.sender, _token_id);
        }
    
        function _withdraw(address _address) private returns(uint256) {
            _address.transfer(price);
        }
    
        function mint(string calldata _message) external returns (uint256) {
            require(msg.sender == this.owner());
    
            uint256 token_id = next_token_id;
            _mint(msg.sender, token_id);
            next_token_id = next_token_id.add(1);
            return token_id;
        }
    
        function burn(uint256 _token_id) external {
            require(msg.sender == this.owner());
    
            super._burn(msg.sender, _token_id);
        }
    }
    
    
[/code]

エラーは_withdrawの箇所で以下の通り

[code]

    TypeError: Member "transfer" not found or not visible after argument-dependent lookup in address.
    _address.transfer(price);
    ^---------------^
    
[/code]

スマートコントラクトからの正しい送金処理をご教示いただけないでしょうか


CC BY-SA 4.0
2019-08-14T08:14:15.050
57358
2019-08-15T04:55:43.943
27721
question
solidity
ERC721のスマートコントラクトからの返金について


自己解決しました

[code]

    function _withdraw(address payable _address) internal returns (uint256) {
        _address.transfer(price);
    }
    
    
[/code]

`internal`を付与しました

ご参考になれば幸いです


CC BY-SA 4.0
2019-08-15T04:55:43.943
57367
2019-08-15T04:55:43.943
27721
57358
answer