분류 전체보기

// SPDX-License-Identifier: MITpragma solidity ^0.8.0;interface Buyer { function price() external view returns (uint256);}contract Shop { uint256 public price = 100; bool public isSold; function buy() public { Buyer _buyer = Buyer(msg.sender); if (_buyer.price() >= price && !isSold) { isSold = true; price = _buyer.price(); } }} 얘도 문제를 애매하..
If you can deny the owner from withdrawing funds when they call withdraw() (whilst the contract still has funds, and the transaction is of 1M gas or less) you will win this level.// SPDX-License-Identifier: MITpragma solidity ^0.8.0;contract Denial { address public partner; // withdrawal partner - pay the gas, split the withdraw address public constant owner = address(0xA9E); uint256 ti..
Fallback과 Receive함수는 둘 다 이더를 전송 받을 때 사용되는 함수이다.그러나 두 함수에 몇가지 차이점도 있고 헷갈리는 부분이 있어 정리할려 한다. 공통점- 상대방이 이더를 전송해서 내 컨트랙트에서 이더를 받을 때 실행된다. 차이점순수하게 이더만 전송할때는 Receive()이더와 데이터를 포함하여 전송 또는 잘못된 함수를 호출할때 Fallback()함수가 호출된다.예를 들어,contractAddress.call{value: 1 ether}();는 Receive함수를contractAddress.call{value: 1 ether}("someData");는 Fallback 함수를 호출한다. 다만, 순수하게 이더만 전송할 때, Receive함수가 없고 Fallback 함수만 있으면 Fallback..
// SPDX-License-Identifier: MITpragma solidity ^0.5.0;import "../helpers/Ownable-05.sol";contract AlienCodex is Ownable { bool public contact; bytes32[] public codex; modifier contacted() { assert(contact); _; } function makeContact() public { contact = true; } function record(bytes32 _content) public contacted { codex.push(_content); } func..
To solve this level, you only need to provide the Ethernaut with a Solver, a contract that responds to whatIsTheMeaningOfLife() with the right 32 byte number.Easy right? Well... there's a catch.The solver's code needs to be really tiny. Really reaaaaaallly tiny. Like freakin' really really itty-bitty tiny: 10 bytes at most.Hint: Perhaps its time to leave the comfort of the Solidity compiler mome..
프레딕
'분류 전체보기' 카테고리의 글 목록