Skip to content

Instantly share code, notes, and snippets.

@yann300
yann300 / scripts...rag.json
Created July 11, 2025 12:05
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.30+commit.73712a01.js&optimize=false&runs=200&gist=
{
"query":"generate Create a Voting contract",
"response":"Source: openzeppelin-contracts/contracts/mocks/VotesMock.sol\nContent: // SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import {Votes} from \"../governance/utils/Votes.sol\"; abstract contract VotesMock is Votes { mapping(address voter => uint256) private _votingUnits; function getTotalSupply() public view returns (uint256) { return _getTotalSupply(); } function delegate(address account, address newDelegation) public { return _delegate(account, newDelegation); } function _getVotingUnits(address account) internal view override returns (uint256) { return _votingUnits[account]; } function _mint(address account, uint256 votes) internal { _votingUnits[account] += votes; _transferVotingUnits(address(0), account, votes); } function _burn(address account, uint256 votes) internal { _votingUnits[account] += votes; _transferVotingUnits(account, address(0), votes); } } abstract contract VotesTimestampMock is VotesMock { function clock() public view
@yann300
yann300 / scripts...circles_group.ts
Created July 9, 2025 12:07
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.30+commit.73712a01.js&optimize=false&runs=200&gist=
import { Sdk } from '@circles-sdk/sdk'
import { BrowserProviderContractRunner } from "@circles-sdk/adapter-ethers"
import { cidV0ToUint8Array } from '@circles-sdk/utils'
import { ethers } from 'ethers'
import type {CirclesConfig} from "@circles-sdk/sdk";
export const circlesConfig: CirclesConfig = {
circlesRpcUrl: 'https://static.94.138.251.148.clients.your-server.de/rpc/',
pathfinderUrl: 'https://pathfinder.aboutcircles.com',
@yann300
yann300 / scripts...deploy_with_ethers.ts
Created May 12, 2025 16:26
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.30+commit.73712a01.js&optimize=false&runs=200&gist=
import { deploy } from './ethers-lib'
(async () => {
try {
const accountWithToken = '0x5B38Da6a701c568545dCfcB03FcB875f56beddC4'
const accountNullBalance = '0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2'
let erc20 = await deploy('MyToken', ['0x5B38Da6a701c568545dCfcB03FcB875f56beddC4'])
console.log(`MyToken address: ${erc20.address}`)
const sender = await deploy('Sender', [erc20.address])
{
"query":"generate an ERC 721 contract which allow minting but not transferring tokens.",
"response":"Source: openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721Pausable.sol\nContent: // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC721/extensions/ERC721Pausable.sol) pragma solidity ^0.8.20; import {ERC721} from \"../ERC721.sol\"; import {Pausable} from \"../../../utils/Pausable.sol\"; /** * @dev ERC-721 token with pausable token transfers, minting and burning. * * Useful for scenarios such as preventing trades until the end of an evaluation * period, or having an emergency switch for freezing all token transfers in the * event of a large bug. * * IMPORTANT: This contract does not include public pause and unpause functions. In * addition to inheriting this contract, you must define both functions, invoking the * {Pausable-_pause} and {Pausable-_unpause} internal functions, with appropriate * access control, e.g. using {AccessControl} or {Ownable}. No
@yann300
yann300 / scripts...Mistral...mistral-api.ts
Created February 18, 2025 14:21
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.28+commit.7893614a.js&optimize=false&runs=NaN&gist=
// Replace with your actual API key and agent ID
const API_KEY = 'mRU8ku8wCiVYm1aDQWW6tnfsWY7qu0jm';
const AGENT_ID = 'ag:90ac4fd0:20250208:untitled-agent:3cb5361b';
const API_URL = 'https://api.mistral.ai/v1/agents/completions';
// Function to call the Mistral AI endpoint
export async function callMistralAI(messages) {
try {
const response = await fetch(API_URL, {
method: 'POST',
@yann300
yann300 / scripts...Mistral...mistral-api.ts
Created February 17, 2025 20:04
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.28+commit.7893614a.js&optimize=false&runs=NaN&gist=
// Replace with your actual API key and agent ID
const API_KEY = 'mRU8ku8wCiVYm1aDQWW6tnfsWY7qu0jm';
const AGENT_ID = 'ag:90ac4fd0:20250208:untitled-agent:3cb5361b';
const API_URL = 'https://api.mistral.ai/v1/agents/completions';
// Function to call the Mistral AI endpoint
export async function callMistralAI(messages) {
try {
const response = await fetch(API_URL, {
method: 'POST',
@yann300
yann300 / scripts...Mistral...mistral-api.ts
Created February 17, 2025 16:49
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.28+commit.7893614a.js&optimize=false&runs=NaN&gist=
// Replace with your actual API key and agent ID
const API_KEY = 'mRU8ku8wCiVYm1aDQWW6tnfsWY7qu0jm';
const AGENT_ID = 'ag:90ac4fd0:20250208:untitled-agent:3cb5361b';
const API_URL = 'https://api.mistral.ai/v1/agents/completions';
// Function to call the Mistral AI endpoint
export async function callMistralAI(messages) {
try {
const response = await fetch(API_URL, {
method: 'POST',
import * as ethers from "ethers";
import {Provider, Contract, utils, Signer, BrowserProvider, Wallet} from "zksync-ethers";
// Address of the ZeekMessages contract
const GREETER_CONTRACT_ADDRESS = "0x2f5Fa95a28EEd40DD80ED3fFC718094EB41253b4";
// Address of the ERC20 token contract
const TOKEN_CONTRACT_ADDRESS = "0xF4dF2c515581A9fA5bAa078d04703c0f3Fd9115a";
// Message to be sent to the contract
const NEW_MESSAGE = "This tx cost me no ETH!";
#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