Skip to content

Commit

Permalink
extract ham.js
Browse files Browse the repository at this point in the history
  • Loading branch information
hamburglar1971 committed Aug 13, 2020
1 parent 668ece9 commit 7a814d2
Show file tree
Hide file tree
Showing 27 changed files with 9,566 additions and 20 deletions.
17 changes: 17 additions & 0 deletions ham.js/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const presets = [
[
"@babel/env",
{
targets: {
edge: "17",
firefox: "60",
chrome: "67",
safari: "11.1",
node: "10.16.0"
},
useBuiltIns: "usage",
},
],
];

module.exports = { presets };
9,507 changes: 9,507 additions & 0 deletions ham.js/package-lock.json

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions ham.js/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "ham.js",
"version": "0.0.1",
"description": "ham JS lib",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"dependencies": {
"ethers": "^5.0.8"
},
"devDependencies": {
"@babel/preset-env": "^7.11.0",
"@truffle/hdwallet-provider": "^1.0.40",
"core-js": "^2.6.5",
"ethereumjs-abi": "^0.6.8",
"ethereumjs-util": "^7.0.4",
"jest": "^26.3.0"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
30 changes: 15 additions & 15 deletions ham-www/src/ham/lib/contracts.js → ham.js/src/lib/contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@ import Web3 from 'web3';
import * as Types from "./types.js";
import { SUBTRACT_GAS_LIMIT, addressMap } from './constants.js';

import ERC20Json from '../clean_build/contracts/IERC20.json';
import HAMJson from '../clean_build/contracts/HAMDelegator.json';
import HAMRebaserJson from '../clean_build/contracts/HAMRebaser.json';
import HAMReservesJson from '../clean_build/contracts/HAMReserves.json';
import HAMGovJson from '../clean_build/contracts/GovernorAlpha.json';
import HAMTimelockJson from '../clean_build/contracts/Timelock.json';
import ERC20Json from '../../../build/contracts/IERC20.json';
import HAMJson from '../../../build/contracts/HAMDelegator.json';
import HAMRebaserJson from '../../../build/contracts/HAMRebaser.json';
import HAMReservesJson from '../../../build/contracts/HAMReserves.json';
import HAMGovJson from '../../../build/contracts/GovernorAlpha.json';
import HAMTimelockJson from '../../../build/contracts/Timelock.json';
import WETHJson from './weth.json';
import SNXJson from './snx.json';
import UNIFactJson from './unifact2.json';
import UNIPairJson from './uni2.json';
import UNIRouterJson from './uniR.json';

import WETHPoolJson from '../clean_build/contracts/HAMETHPool.json';
import AMPLPoolJson from '../clean_build/contracts/HAMAMPLPool.json';
import YFIPoolJson from '../clean_build/contracts/HAMYFIPool.json';
import WETHPoolJson from '../../../build/contracts/HAMETHPool.json';
import AMPLPoolJson from '../../../build/contracts/HAMAMPLPool.json';
import YFIPoolJson from '../../../build/contracts/HAMYFIPool.json';

import MKRPoolJson from '../clean_build/contracts/HAMMKRPool.json';
import LENDPoolJson from '../clean_build/contracts/HAMLENDPool.json';
import COMPPoolJson from '../clean_build/contracts/HAMCOMPPool.json';
import SNXPoolJson from '../clean_build/contracts/HAMSNXPool.json';
import LINKPoolJson from '../clean_build/contracts/HAMLINKPool.json';
import MKRPoolJson from '../../../build/contracts/HAMMKRPool.json';
import LENDPoolJson from '../../../build/contracts/HAMLENDPool.json';
import COMPPoolJson from '../../../build/contracts/HAMCOMPPool.json';
import SNXPoolJson from '../../../build/contracts/HAMSNXPool.json';
import LINKPoolJson from '../../../build/contracts/HAMLINKPool.json';

import IncJson from '../clean_build/contracts/HAMIncentivizer.json';
import IncJson from '../../../build/contracts/HAMIncentivizer.json';

export class Contracts {
constructor(
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ import {

const ethUtil = require('ethereumjs-util');

async function enfranchise(actor, amount, user) {
await ham.contracts.ham.methods.transfer(actor, amount.toString()).send({from: user});
await ham.contracts.ham.methods.delegate(actor).send({from: actor});
}

export const ham = new Ham(
"http://localhost:8545/",
// "http://127.0.0.1:9545/",
Expand All @@ -32,6 +27,12 @@ export const ham = new Ham(
ethereumNodeTimeout: 10000
}
)

async function enfranchise(actor, amount, user) {
await ham.contracts.ham.methods.transfer(actor, amount.toString()).send({from: user});
await ham.contracts.ham.methods.delegate(actor).send({from: actor});
}

const oneEther = 10 ** 18;

const EIP712 = require('./EIP712');
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 7a814d2

Please sign in to comment.