1.1 This contract locks away ether. The initial ether is locked away until 50 years has passed, and subsequent contributions are locked until even later.
All you have to do to complete this challenge is wait 50 years and withdraw the ether. If you’re not that patient, you’ll need to combine several techniques to hack this contract
function isComplete() public view returns (bool) { return address(this).balance == 0; }
function upsert(uint256 index, uint256 timestamp) public payable { // 校验调用者是否为合约所有者 require(msg.sender == owner);
// if (index >= head && index < queue.length) { // Update existing contribution amount without updating timestamp. // 这里storage 修饰的是创建的引用,修改contribution 的值也会影响到 queue[index]的值 Contribution storage contribution = queue[index]; // 盲猜这里有漏洞,覆盖 contribution.amount += msg.value; } else { // Append a new contribution. Require that each contribution unlock // at least 1 day after the previous one. require(timestamp >= queue[queue.length - 1].unlockTimestamp + 1 days);
function upsert(uint256 index, uint256 timestamp) public payable { // 校验调用者是否为合约所有者 require(msg.sender == owner); if (index >= head && index < queue.length) { // Update existing contribution amount without updating timestamp. Contribution storage contribution = queue[index]; // 盲猜这里有漏洞,覆盖 contribution.amount += msg.value; } else { // Append a new contribution. Require that each contribution unlock // at least 1 day after the previous one. require(timestamp >= queue[queue.length - 1].unlockTimestamp + 1 days);