Solidity #1

R A·2023년 5월 16일
0

Solidity

목록 보기
1/3

일단 시작이 반이니까... 기록 시작

function payable 이해

function enterGame() public payable {

        require( msg.value == entryFee , "Incorrect entry fee" );
        require( room.length < 4 , "Room is full" );

        room.push( usersMap[ msg.sender ] ) ;
        
        if( room.length == 4 ) {

            end_room() ;
            delete room;

        }

        totalBalance += msg.value ;
}

payable 사용시
msg.sender = 클릭하는 순간 연결된 지갑 주소
msg.value = 리믹스에서 설정된 eth 수량

msg.value 가 컨트렉트의 밸런스로 지불되는것 같다.
일단 나중에 확인해봐야 할 부분

profile
복숭아가 좋아요

0개의 댓글