Skip to content

Instantly share code, notes, and snippets.

@Reinis-FRP
Reinis-FRP / discordTicketCreator.js
Created July 21, 2023 18:37
Proof of concept to open tickets from Discord bot
const { Client, GatewayIntentBits } = require("discord.js");
require("dotenv").config();
const message = `OptimisticOracleV2: Price Settlement Alert!
Detected a price request settlement for the request made by <https://etherscan.io/address/0x6A9D222616C90FcA5754cd1333cFD9b7fb6a4F74|0x6A9...6a4F74> at the timestamp 1689274376 for the identifier: YES_OR_NO_QUERY. The proposer was <https://etherscan.io/address/0x39c73c1fEDF4976A3f5205f844E31F65C08044aC|0x39c...8044aC> and the disputer was <https://etherscan.io/address/0x0000000000000000000000000000000000000000|0x000...000000>. The settlement price is 0.000. The payout was 1,755.00 made to the proposer.
Ancillary data: q: title: Will $XRP hit $1 by July 20?, description: This market will resolve to "Yes" if any Binance 1 minute candle for XRP/USDT between 2023/07/13 00:00 and 2023/07/20 23:59 in the ET timezone has a “High” price of 1.0000 or higher. Otherwise, this market will resolve to "No".
The resolution source for this market is https://www.binance.com, sp
import { ethers } from "ethers";
const defaultTimeout = 60 * 1000;
function delay(s: number): Promise<void> {
return new Promise<void>((resolve) => setTimeout(resolve, Math.round(s * 1000)));
}
// This provider class is used to retry requests to a list of providers in order.
// This class is not exported as it is only used internally from getRetryProvider that validates constructor parameters.
@Reinis-FRP
Reinis-FRP / contracts...test_delegate.sol
Created November 8, 2022 09:48
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.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.16;
interface OracleInterface {
function request() external;
}
abstract contract AssertorInterface {
OracleInterface public oracle;
}
@Reinis-FRP
Reinis-FRP / contracts...InsuranceArbitrator.sol
Last active October 22, 2022 14:52
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.7+commit.e28d00a7.js&optimize=false&runs=200&gist=6e4c7897ad984e0351b3944555475c4a
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@uma/core/contracts/common/implementation/AddressWhitelist.sol";
import "@uma/core/contracts/oracle/implementation/Constants.sol";
import "@uma/core/contracts/oracle/interfaces/FinderInterface.sol";
import "@uma/core/contracts/oracle/interfaces/OptimisticOracleV2Interface.sol";
@Reinis-FRP
Reinis-FRP / .deps...npm...@openzeppelin...contracts...access...Ownable.sol
Created October 22, 2022 12:20
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.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
require('dotenv').config();
const Web3 = require('web3');
const web3 = new Web3(process.env.NODE_URL_CHAIN_1);
const web3Polygon = new Web3(process.env.NODE_URL_CHAIN_137);
const {hexToUtf8, toBN, toWei, fromWei} = web3.utils;
const fetch = require('node-fetch');
const abiDecoder = require('abi-decoder');
const governorAddress = '0x592349F7DeDB2b75f9d4F194d4b7C16D82E507Dc';
const governorAbi = [
@Reinis-FRP
Reinis-FRP / LspContracts.js
Created November 1, 2021 13:33
Fetch LSP contracts from known creator addresses
const util = require('util');
const Web3 = require('web3');
const client = require('node-rest-client-promise').Client();
require('dotenv').config();
const fs = require('fs').promises;
const NODE_URL = {
1: process.env.NODE_URL_CHAIN_1,
137: process.env.NODE_URL_CHAIN_137,
};
const blockLimits = {1: 10000000, 137: 100000};

Keybase proof

I hereby claim:

  • I am reinis-frp on github.
  • I am reinis_frp (https://keybase.io/reinis_frp) on keybase.
  • I have a public key ASDM9IWxYlMXiLc6tWPJXlbBJ_Zyv27d_fyhH_oPQFQ6EQo

To claim this, I am signing this object: