Skip to content

Instantly share code, notes, and snippets.

@BaptistG
BaptistG / balancerCampaign.py
Created October 23, 2024 19:11
example campaign creation
import json
import requests
import base64
from eth_abi import encode
PoolChainId = 1
RewardsChainId = 1
campaign = {
"amount": "1000000000000000000000",
"creator": "0x0000000000000000000000000000000000000000",
import requests
import csv
from web3 import Web3
import time
def split_list(input_list, chunk_size):
# Split the list into chunks of the specified size
return [input_list[i:i + chunk_size] for i in range(0, len(input_list), chunk_size)]
# Define the path to the CSV file
@BaptistG
BaptistG / config.yaml
Last active October 25, 2023 17:20
TEST GIST
# Address of Pyth contract
# See [https://docs.pyth.network/documentation/pythnet-price-feeds/evm#mainnet]
pythNetworkAddress: "0x4305FB66699C3B2702D4d05CF36551390A4c69C6" # Ethereum Mainnet address
# debug mode
debug: true
# Refresh rate of config in seconds to prevent rate limiting from github
configRefreshRateInSeconds: 3600
# See [https://docs.pyth.network/documentation/pythnet-price-feeds/price-service#public-endpoints]
priceServiceEndpoint: "https://hermes.pyth.network"
# maximum number of seconds between updates
@BaptistG
BaptistG / pyth.ts
Created August 22, 2023 07:21
Original Script to update Pyth Oracles
// web3-functions/pyth-oracle-w3f-priceIds/index.ts
import {
Web3Function
} from "@gelatonetwork/web3-functions-sdk";
import { Contract } from "ethers";
import { EvmPriceServiceConnection as EvmPriceServiceConnection2 } from "@pythnetwork/pyth-evm-js";
import PythAbi from "@pythnetwork/pyth-sdk-solidity/abis/IPyth.json";
// web3-functions/pyth-oracle-w3f-priceIds/pythUtils.ts
import { Octokit } from "octokit";
@BaptistG
BaptistG / config.yaml
Last active October 27, 2023 16:39
GIST USED IN PROD
# Address of Pyth contract
# See [https://docs.pyth.network/documentation/pythnet-price-feeds/evm#mainnet]
pythNetworkAddress: "0x4305FB66699C3B2702D4d05CF36551390A4c69C6" # Ethereum Mainnet address
# debug mode
debug: true
# Refresh rate of config in seconds to prevent rate limiting from github
configRefreshRateInSeconds: 3600
# See [https://docs.pyth.network/documentation/pythnet-price-feeds/price-service#public-endpoints]
priceServiceEndpoint: "https://hermes.pyth.network"
# maximum number of seconds between updates
import { utils, providers, Contract } from "ethers";
// Output type
type Fees = {
xFeeMint: number[],
yFeeMint: number[],
xFeeBurn: number[],
yFeeBurn: number[]
}
// Example test :
enum QuoteType {
MintExactInput,
MintExactOutput,
BurnExactInput,
BurnExactOutput
}
const testFees = {
xFeeMint: [0.0000,0.4000,0.4500,0.7000],
@BaptistG
BaptistG / Transmuter_quoteFees.ts
Last active August 11, 2023 09:27
_quoteFees function from the Angle Transmuter
enum QuoteType {
MintExactInput,
MintExactOutput,
BurnExactInput,
BurnExactOutput
}
type Fees = {
xFeeMint: number[],
yFeeMint: number[],
@BaptistG
BaptistG / config.yaml
Last active August 21, 2023 10:10
Pyth W3F Ethereum Mainnet Config
# Address of Pyth contract
# See [https://docs.pyth.network/documentation/pythnet-price-feeds/evm#mainnet]
pythNetworkAddress: "0x4305FB66699C3B2702D4d05CF36551390A4c69C6" # Ethereum Mainnet address
# debug mode
debug: true
# Refresh rate of config in seconds to prevent rate limiting from github
configRefreshRateInSeconds: 3600
# See [https://docs.pyth.network/documentation/pythnet-price-feeds/price-service#public-endpoints]
priceServiceEndpoint: "https://hermes.pyth.network"
# maximum number of seconds between updates
@BaptistG
BaptistG / config.yaml
Created July 31, 2023 14:15
Pyth W3F Ethereum Mainnet Config
# Address of Pyth contract
# See [https://docs.pyth.network/documentation/pythnet-price-feeds/evm#mainnet]
pythNetworkAddress: "0x4305FB66699C3B2702D4d05CF36551390A4c69C6" # Ethereum Mainnet address
# debug mode
debug: true
# Refresh rate of config in seconds to prevent rate limiting from github
configRefreshRateInSeconds: 3600
# See [https://docs.pyth.network/documentation/pythnet-price-feeds/price-service#public-endpoints]
priceServiceEndpoint: "https://hermes.pyth.network/"
# maximum number of seconds between updates