uint256 amount = balances[msg.sender];
(bool success,) = msg.sender.call{value: amount}("");
require(success, "Failed to send Ether");
balances[msg.sender] = 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
| My public address is 0x13Bfb633613385ac96a364d1Bb571e602FE5744a |
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
| from wake.testing import * | |
| from wake.testing.fuzzing import * | |
| from pytypes.contracts.ComposableStablePoolFactory import ComposableStablePoolFactory | |
| from pytypes.contracts.ComposableStablePool import ComposableStablePool | |
| from pytypes.wake.interfaces.IERC20 import IERC20 | |
| from pytypes.__.__.node_modules.balancerlabs.v2interfaces.contracts.poolutils.IPoolVersion import IPoolVersion | |
| from pytypes.__.__.node_modules.balancerlabs.v2interfaces.contracts.poolutils.IRateProvider import IRateProvider | |
| from pytypes.__.__.node_modules.balancerlabs.v2interfaces.contracts.solidityutils.helpers.IVersion import IVersion | |
| from pytypes.__.__.node_modules.balancerlabs.v2interfaces.contracts.solidityutils.openzeppelin.IERC20 import IERC20 |
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
| # preparation of parameters. | |
| affiliator = random_account() # affiliator will get affiliate fee according to new_member spendings. | |
| new_member = random_account() | |
| with may_revert() as e: | |
| # Transaction call. | |
| tx = self.erc_721pass.mint(new_member, affiliator, from_=random_account()) | |
| # assert revert cases. | |
| if new_member in self.pass_holder_info.keys(): |
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 ERC721Ticket is ERC721 { | |
| mapping(address => bool) public passHolders; | |
| mapping(address => address) public memberAffiliators; | |
| // Vulnerability: Anyone can mint for any address | |
| function mint(address newMember, address affiliator) public { | |
| require(!passHolders[newMember], "New Member already Minted"); | |
| // Mint non-transferable pass | |
| _mint(newMember, totalSupply()); |
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
| deploy_option = random.random() | |
| creation_nonce: int = random_int(0, 1000000) | |
| salt: bytes32 = bytes32(0) | |
| event_creation_nonce: int | None = None | |
| if deploy_option < 0.5: # randomly choose execution. | |
| #PATH1 | |
| salt = keccak256(abi.encode_packed(keccak256(initializer), uint256(creation_nonce))) | |
| else: | |
| #PATH2 | |
| nonceWithCallback = keccak256(abi.encode_packed(uint256(creation_nonce), callback_contract)) |
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 Factory { | |
| // Path1: Direct deployment | |
| function createWithNonce( | |
| address implementation, | |
| bytes memory initData, | |
| uint256 nonce | |
| ) public returns (address proxy) { | |
| bytes32 salt = keccak256(abi.encodePacked(keccak256(initData), nonce)); | |
| proxy = createProxy(implementation, initData, salt); | |
| } |
uint256 amount = balances[msg.sender];
(bool success,) = msg.sender.call{value: amount}("");
{
// This block of executed as reentrant
uint256 amount = balances[msg.sender];
(bool success,) = msg.sender.call{value: amount}("");
require(success, "Failed to send Ether");
balances[msg.sender] = 0;
}function mint(address to) public returns (uint256) {
require(_mintable, "Minting is disabled");
uint256 newWarriorId = tokenIds;
tokenIds++;
_safeMint(to, newWarriorId);
return newWarriorId;
}
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
| from wake.testing import * | |
| from pytypes.contracts.crosschainreentrancy.CrossChainWarriors import CrossChainWarriors | |
| from pytypes.contracts.crosschainreentrancy.Attacker import Attacker | |
| chain1 = Chain() | |
| chain2 = Chain() | |
| # Print failing tx call trace | |
| def revert_handler(e: TransactionRevertedError): | |
| if e.tx is not None: |
NewerOlder