Skip to content

Instantly share code, notes, and snippets.

View carlosgj94's full-sized avatar
💭
Even more focused

Carlos Gonzalez Juarez carlosgj94

💭
Even more focused
View GitHub Profile
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
import {ERC20Votes, ERC20 } from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";
import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import {IVotes} from "@openzeppelin/contracts/governance/utils/IVotes.sol";
/// @title PolygonDaoVotes
/// @author @simondos
// SPDX-License-Identifier: MIT
// Compatible with OpenZeppelin Contracts ^5.0.0
pragma solidity ^0.8.20;
import "@openzeppelin/contracts@5.0.2/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts@5.0.2/token/ERC20/extensions/ERC20Pausable.sol";
import "@openzeppelin/contracts@5.0.2/access/Ownable.sol";
import "@openzeppelin/contracts@5.0.2/token/ERC20/extensions/ERC20Permit.sol";
import "@openzeppelin/contracts@5.0.2/token/ERC20/extensions/ERC20Votes.sol";
import "@openzeppelin/contracts@5.0.2/governance/utils/IVotes.sol";
const ethers = require('ethers');
async function main() {
let privatekey = '<<PRIVATE_KEY>>'; // Yeah this should be done through an env var, I know but this is a f gist
let wallet = new ethers.Wallet(privatekey);
console.log('Using wallet address ' + wallet.address);
let transaction = {
import { TestToken, ValidatorShare, StakingInfo, EventsHub } from '../../helpers/artifacts'
import { BN, expectEvent, expectRevert } from '@openzeppelin/test-helpers'
import { checkPoint, assertBigNumberEquality, updateSlashedAmounts } from '../../helpers/utils.js'
import { wallets, freshDeploy, approveAndStake } from './deployment'
import { buyVoucher, sellVoucher, sellVoucherNew } from './ValidatorShareHelper.js'
import { web3 } from '@openzeppelin/test-helpers/src/setup'
const toWei = web3.utils.toWei
const ZeroAddr = '0x0000000000000000000000000000000000000000'
const ExchangeRatePrecision = new BN('100000000000000000000000000000')
const Augur = require('augur.js');
const augur = new Augur();
const augurConnection = 'ws://predictions.market:9001';
const connect = () => new Promise((resolve, reject) => {
augur.augurNode.connect(
augurConnection,
(error, wsTransport) => {
if (error) reject(error);
pragma solidity ^0.4.25;
contract StandardToken {
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
uint256 public totalSupply;
// Optional
string public name;
uint8 public decimals;
@carlosgj94
carlosgj94 / GunExamples.html
Created September 26, 2018 10:50
Basic examples for the Gun database
<script src="https://cdn.jsdelivr.net/npm/gun/gun.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gun/lib/webrtc.js"></script>
<script>
// Emiter
var gun = Gun(['http://localhost:8765/gun', '<<YOUR GUN SERVER>>']);
// This function adds a new user to a list
function addUser(userName) {
var users = gun.get('users');
@carlosgj94
carlosgj94 / SingleObject.java
Created April 19, 2017 09:36
Singleton Pattern
public class SingleObject {
//create an object of SingleObject
private static SingleObject instance = new SingleObject();
//make the constructor private so that this class cannot be
//instantiated
private SingleObject(){}
//Get the only object available
@carlosgj94
carlosgj94 / Circle.java
Created April 19, 2017 09:33
Factory Pattern
public class Circle implements Shape {
@Override
public void draw() {
System.out.println("Inside Circle::draw() method.");
}
}
@carlosgj94
carlosgj94 / Circle.java
Created April 19, 2017 09:27
Decorator Pattern
public class Circle implements Shape {
@Override
public void draw() {
System.out.println("Shape: Circle");
}
}