Skip to content

Instantly share code, notes, and snippets.

#pragma version >0.3.10
# Blind Auction. Adapted to Vyper from [Solidity by Example](https://github.com/ethereum/solidity/blob/develop/docs/solidity-by-example.rst#blind-auction-1)
struct Bid:
blindedBid: bytes32
deposit: uint256
gg
# Note: because Vyper does not allow for dynamic arrays, we have limited the
# number of bids that can be placed by one address to 128 in this example
{
"manifest": "ethpm/3",
"name": null,
"version": null,
"meta": null,
"sources": {
"examples/factory/Exchange.vy": {
"urls": [],
"checksum": null,
"content": "#pragma version >0.3.10\n\nfrom ethereum.ercs import IERC20\n\n\ninterface Factory:\n def register(): nonpayable\n\n\ntoken: public(IERC20)\nfactory: Factory\n\n\n@deploy\ndef __init__(_token: IERC20, _factory: Factory):\n self.token = _token\n self.factory = _factory\n\n\n@external\ndef initialize():\n # Anyone can safely call this function because of EXTCODEHASH\n extcall self.factory.register()\n\n\n# NOTE: This contract restricts trading to only be done by the factory.\n# A practical implementation would probably want counter-pairs\n# and liquidity management features for each exchange pool.\n\n\n@external\ndef receive(_from: address, _amt: uint256):\n assert msg.sender == self.factory.address\n success: bool = extcall self.token.transferFrom(_from, self
@yann300
yann300 / 1_Storage.sol
Created August 14, 2024 12:55
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.26+commit.8a97fa7a.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.2 <0.9.0;
/**
* @title Storage
* @dev Store & retrieve value in a variable
* @custom:dev-run-script ./scripts/deploy_with_ethers.ts
*/
contract Storage {
@yann300
yann300 / 1_Storage.sol
Created August 14, 2024 12:54
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.26+commit.8a97fa7a.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.2 <0.9.0;
/**
* @title Storage
* @dev Store & retrieve value in a variable
* @custom:dev-run-script ./scripts/deploy_with_ethers.ts
*/
contract Storage {
@yann300
yann300 / scripts...run_setup.ts
Created February 19, 2024 13:03
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.24+commit.e11b9ed9.js&optimize=false&runs=200&gist=
// eslint-disable-next-line @typescript-eslint/no-var-requires
const snarkjs = require('snarkjs');
const logger = {
info: (...args) => console.log(...args),
debug: (...args) => console.log(...args)
};
(async () => {
try {
@yann300
yann300 / scripts...run_setup.ts
Created February 19, 2024 12:57
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.24+commit.e11b9ed9.js&optimize=false&runs=200&gist=
// eslint-disable-next-line @typescript-eslint/no-var-requires
const snarkjs = require('snarkjs');
const logger = {
info: (...args) => console.log(...args),
debug: (...args) => console.log(...args)
};
(async () => {
try {
pragma circom 2.0.0;
include "./poseidon_constants.circom";
template Sigma() {
signal input in;
signal output out;
signal in2;
signal in4;
pragma circom 2.0.0;
include "./poseidon_constants.circom";
template Sigma() {
signal input in;
signal output out;
signal in2;
signal in4;
pragma circom 2.0.0;
include "./poseidon_constants.circom";
template Sigma() {
signal input in;
signal output out;
signal in2;
signal in4;
pragma circom 2.0.0;
include "./poseidon_constants.circom";
template Sigma() {
signal input in;
signal output out;
signal in2;
signal in4;