// SPDX-License-Identifier: MITpragma solidity ^0.8.0;import "openzeppelin-contracts-08/token/ERC20/IERC20.sol";import "openzeppelin-contracts-08/token/ERC20/ERC20.sol";import "openzeppelin-contracts-08/access/Ownable.sol";contract DexTwo is Ownable { address public token1; address public token2; constructor() {} function setTokens(address _token1, address _token2) public onlyOwner {..
분류 전체보기
// SPDX-License-Identifier: MITpragma solidity ^0.8.0;import "openzeppelin-contracts-08/token/ERC20/IERC20.sol";import "openzeppelin-contracts-08/token/ERC20/ERC20.sol";import "openzeppelin-contracts-08/access/Ownable.sol";contract Dex is Ownable { address public token1; address public token2; constructor() {} function setTokens(address _token1, address _token2) public onlyOwner { ..
Math.random 함수는 nodejs 같은 프레임워크에서 사용되며 주로 난수 발생을 위한 기능으로 사용됩니다.그러나 대부분이 알고있듯이 Math.random함수는 PRNG를 통해 난수를 생성하는데 이는 암호학적으로 다음 값 예측이 가능합니다. 그래서 원래는 Math.random값을 전부 알 경우에 특정 도구를 통해서 다음값을 예측이 가능한데...이번 LA CTF 문제를 복기하다가 Math.random값이 변형되거나 일부만 알때도 다음값이 예측 가능하다는 점을 새로 알게되서 글로 정리해보려 합니다. Math.random 전체 값을 알 경우Math.random의 전체 값은 대충0.9311600617849973 이런 소수값으로 나옵니다.해당 경우엔 아래 유명한 v8-randomness-predictor를 ..
// 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..