├── ham-www ├── workers-site │ ├── .cargo-ok │ ├── .gitignore │ ├── package.json │ └── package-lock.json ├── public │ ├── _redirects │ ├── hero.png │ ├── robots.txt │ ├── favicon.ico │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ └── index.html ├── src │ ├── views │ │ ├── FAQ │ │ │ ├── index.ts │ │ │ └── FAQ.tsx │ │ ├── Farm │ │ │ ├── index.ts │ │ │ └── components │ │ │ │ ├── DepositModal.tsx │ │ │ │ ├── WithdrawModal.tsx │ │ │ │ └── Harvest.tsx │ │ ├── Home │ │ │ ├── index.ts │ │ │ ├── types.ts │ │ │ ├── utils.ts │ │ │ ├── components │ │ │ │ ├── Rebase.tsx │ │ │ │ └── Stats.tsx │ │ │ └── Home.tsx │ │ ├── About │ │ │ └── index.ts │ │ └── Farms │ │ │ ├── index.ts │ │ │ └── Farms.tsx │ ├── components │ │ ├── Card │ │ │ ├── index.ts │ │ │ └── Card.tsx │ │ ├── Dial │ │ │ ├── index.ts │ │ │ └── Dial.tsx │ │ ├── Logo │ │ │ ├── index.ts │ │ │ └── Logo.tsx │ │ ├── Page │ │ │ └── index.ts │ │ ├── Button │ │ │ └── index.ts │ │ ├── Footer │ │ │ ├── index.ts │ │ │ ├── Footer.tsx │ │ │ └── components │ │ │ │ └── Nav.tsx │ │ ├── Label │ │ │ ├── index.ts │ │ │ └── Label.tsx │ │ ├── Loader │ │ │ ├── index.ts │ │ │ └── Loader.tsx │ │ ├── Spacer │ │ │ ├── index.ts │ │ │ └── Spacer.tsx │ │ ├── TopBar │ │ │ ├── index.ts │ │ │ ├── components │ │ │ │ ├── TxButton.tsx │ │ │ │ ├── Nav.tsx │ │ │ │ ├── AccountButton.tsx │ │ │ │ ├── AccountModal.tsx │ │ │ │ └── ThemeToggle.tsx │ │ │ └── TopBar.tsx │ │ ├── Value │ │ │ ├── index.ts │ │ │ └── Value.tsx │ │ ├── CardIcon │ │ │ ├── index.ts │ │ │ └── CardIcon.tsx │ │ ├── Container │ │ │ ├── index.ts │ │ │ └── Container.tsx │ │ ├── CardContent │ │ │ ├── index.ts │ │ │ └── CardContent.tsx │ │ ├── IconButton │ │ │ ├── index.ts │ │ │ └── IconButton.tsx │ │ ├── ModalTitle │ │ │ ├── index.ts │ │ │ └── ModalTitle.tsx │ │ ├── PageHeader │ │ │ ├── index.ts │ │ │ └── PageHeader.tsx │ │ ├── TokenInput │ │ │ ├── index.ts │ │ │ └── TokenInput.tsx │ │ ├── ModalActions │ │ │ ├── index.ts │ │ │ └── ModalActions.tsx │ │ ├── DisclaimerModal │ │ │ ├── index.ts │ │ │ └── DisclaimerModal.tsx │ │ ├── StepProgressBar │ │ │ ├── index.ts │ │ │ └── StepProgressBar.tsx │ │ ├── Icon │ │ │ ├── index.ts │ │ │ └── Icon.tsx │ │ ├── Input │ │ │ ├── index.ts │ │ │ └── Input.tsx │ │ ├── Modal │ │ │ ├── index.ts │ │ │ └── Modal.tsx │ │ └── icons │ │ │ ├── index.ts │ │ │ ├── RemoveIcon.tsx │ │ │ └── AddIcon.tsx │ ├── ham │ │ ├── clean_build │ │ │ └── contracts │ │ │ │ ├── Address.json │ │ │ │ ├── Math.json │ │ │ │ ├── SafeMath.json │ │ │ │ ├── Babylonian.json │ │ │ │ ├── FixedPoint.json │ │ │ │ ├── SafeERC20.json │ │ │ │ ├── UniswapV2OracleLibrary.json │ │ │ │ ├── Context.json │ │ │ │ ├── HAMDelegationStorage.json │ │ │ │ ├── HAMDelegateInterface.json │ │ │ │ ├── HAMInterface.json │ │ │ │ ├── HAMDelegatorInterface.json │ │ │ │ ├── Migrations.json │ │ │ │ ├── LPTokenWrapper.json │ │ │ │ ├── Ownable.json │ │ │ │ ├── HAMGovernanceStorage.json │ │ │ │ ├── IRewardDistributionRecipient.json │ │ │ │ ├── TimelockInterface.json │ │ │ │ ├── HAMTokenStorage.json │ │ │ │ ├── IERC20.json │ │ │ │ ├── HAMReserve.json │ │ │ │ └── HAMReserves.json │ │ ├── lib │ │ │ ├── types.js │ │ │ ├── Expect.js │ │ │ ├── Helpers.js │ │ │ ├── accounts.js │ │ │ ├── constants.js │ │ │ ├── BytesHelper.js │ │ │ ├── unifact2.json │ │ │ └── yycrv.json │ │ ├── index.js │ │ └── Ham.js │ ├── react-app-env.d.ts │ ├── contexts │ │ ├── Modals │ │ │ ├── index.ts │ │ │ └── Modals.tsx │ │ ├── HamProvider │ │ │ ├── index.ts │ │ │ └── HamProvider.tsx │ │ ├── Transactions │ │ │ ├── index.ts │ │ │ ├── types.ts │ │ │ ├── context.ts │ │ │ ├── TransactionsProvider.tsx │ │ │ └── reducer.ts │ │ └── Farms │ │ │ ├── index.ts │ │ │ ├── context.ts │ │ │ └── types.ts │ ├── constants │ │ ├── tokenAddresses.ts │ │ └── abi │ │ │ └── ERC20.json │ ├── utils │ │ ├── formatAddress.ts │ │ ├── index.ts │ │ ├── formatBalance.ts │ │ └── erc20.ts │ ├── hooks │ │ ├── useHam.ts │ │ ├── useFarms.ts │ │ ├── useTransactionAdder.ts │ │ ├── useFarm.ts │ │ ├── usePendingTransactions.ts │ │ ├── useModal.ts │ │ ├── useRedeem.ts │ │ ├── useReward.ts │ │ ├── useUnstake.ts │ │ ├── useStake.ts │ │ ├── useApprove.ts │ │ ├── useEarnings.ts │ │ ├── useStakedBalance.ts │ │ ├── useTokenBalance.ts │ │ └── useAllowance.ts │ ├── setupTests.js │ ├── index.css │ ├── index.tsx │ ├── theme │ │ ├── index.ts │ │ └── colors.ts │ ├── wrapping │ │ ├── index.tsx │ │ └── WrappedStatusToggle.tsx │ ├── logo.svg │ └── assets │ │ └── svg │ │ └── HAM_Farm_Layer_001.svg ├── .gitignore ├── tsconfig.json ├── package.json └── README.md ├── .gitattributes ├── clean_build └── contracts │ ├── Math.json │ ├── Address.json │ ├── SafeERC20.json │ ├── SafeMath.json │ ├── Babylonian.json │ ├── FixedPoint.json │ ├── UniswapV2OracleLibrary.json │ ├── Context.json │ ├── HAMDelegationStorage.json │ ├── HAMDelegateInterface.json │ ├── HAMInterface.json │ ├── HAMDelegatorInterface.json │ ├── Migrations.json │ ├── LPTokenWrapper.json │ ├── Ownable.json │ ├── HAMGovernanceStorage.json │ ├── IRewardDistributionRecipient.json │ ├── TimelockInterface.json │ ├── HAMTokenStorage.json │ ├── IERC20.json │ └── HAMReserves.json ├── .gitignore ├── migrations ├── 1_initial_migration.js ├── 2_token.js ├── 4_governance.js └── 3_rs.js ├── babel.config.js ├── contracts ├── Migrations.sol ├── lib │ ├── Babylonian.sol │ ├── IRewardDistributionRecipient.sol │ ├── Math.sol │ ├── Context.sol │ ├── UniswapV2OracleLibrary.sol │ ├── IUniswapV2Pair.sol │ ├── Ownable.sol │ ├── IERC20.sol │ └── FixedPoint.sol ├── token │ ├── HAMGovernanceStorage.sol │ ├── HAMTokenStorage.sol │ └── HAMDelegate.sol └── reserves │ └── HAMReserves.sol ├── startBlockchainMining.sh ├── startBlockchain.sh ├── .github └── workflows │ └── node.js.yml ├── package.json ├── scripts └── clean.py └── truffle-config.js /ham-www/workers-site/.cargo-ok: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ham-www/public/_redirects: -------------------------------------------------------------------------------- 1 | /* /index.html 200 -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sol linguist-language=Solidity 2 | -------------------------------------------------------------------------------- /clean_build/contracts/Math.json: -------------------------------------------------------------------------------- 1 | {"abi": [], "networks": {}} -------------------------------------------------------------------------------- /clean_build/contracts/Address.json: -------------------------------------------------------------------------------- 1 | {"abi": [], "networks": {}} -------------------------------------------------------------------------------- /clean_build/contracts/SafeERC20.json: -------------------------------------------------------------------------------- 1 | {"abi": [], "networks": {}} -------------------------------------------------------------------------------- /clean_build/contracts/SafeMath.json: -------------------------------------------------------------------------------- 1 | {"abi": [], "networks": {}} -------------------------------------------------------------------------------- /ham-www/src/views/FAQ/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './FAQ' -------------------------------------------------------------------------------- /ham-www/workers-site/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | worker 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .env 3 | wrangler.toml 4 | .idea/ 5 | -------------------------------------------------------------------------------- /clean_build/contracts/Babylonian.json: -------------------------------------------------------------------------------- 1 | {"abi": [], "networks": {}} -------------------------------------------------------------------------------- /clean_build/contracts/FixedPoint.json: -------------------------------------------------------------------------------- 1 | {"abi": [], "networks": {}} -------------------------------------------------------------------------------- /ham-www/src/views/Farm/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Farm' 2 | -------------------------------------------------------------------------------- /ham-www/src/views/Home/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Home' 2 | -------------------------------------------------------------------------------- /ham-www/src/components/Card/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Card' 2 | -------------------------------------------------------------------------------- /ham-www/src/components/Dial/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Dial' 2 | -------------------------------------------------------------------------------- /ham-www/src/components/Logo/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Logo' 2 | -------------------------------------------------------------------------------- /ham-www/src/components/Page/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Page' 2 | -------------------------------------------------------------------------------- /ham-www/src/views/About/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './About' 2 | -------------------------------------------------------------------------------- /ham-www/src/views/Farms/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Farms' 2 | -------------------------------------------------------------------------------- /clean_build/contracts/UniswapV2OracleLibrary.json: -------------------------------------------------------------------------------- 1 | {"abi": [], "networks": {}} -------------------------------------------------------------------------------- /ham-www/src/components/Button/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Button' 2 | -------------------------------------------------------------------------------- /ham-www/src/components/Footer/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Footer' 2 | -------------------------------------------------------------------------------- /ham-www/src/components/Label/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Label' 2 | -------------------------------------------------------------------------------- /ham-www/src/components/Loader/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Loader' 2 | -------------------------------------------------------------------------------- /ham-www/src/components/Spacer/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Spacer' 2 | -------------------------------------------------------------------------------- /ham-www/src/components/TopBar/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './TopBar' 2 | -------------------------------------------------------------------------------- /ham-www/src/components/Value/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Value' 2 | -------------------------------------------------------------------------------- /ham-www/src/ham/clean_build/contracts/Address.json: -------------------------------------------------------------------------------- 1 | {"abi": [], "networks": {}} -------------------------------------------------------------------------------- /ham-www/src/ham/clean_build/contracts/Math.json: -------------------------------------------------------------------------------- 1 | {"abi": [], "networks": {}} -------------------------------------------------------------------------------- /ham-www/src/ham/clean_build/contracts/SafeMath.json: -------------------------------------------------------------------------------- 1 | {"abi": [], "networks": {}} -------------------------------------------------------------------------------- /ham-www/src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /ham-www/src/components/CardIcon/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './CardIcon' 2 | -------------------------------------------------------------------------------- /ham-www/src/components/Container/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Container' 2 | -------------------------------------------------------------------------------- /ham-www/src/ham/clean_build/contracts/Babylonian.json: -------------------------------------------------------------------------------- 1 | {"abi": [], "networks": {}} -------------------------------------------------------------------------------- /ham-www/src/ham/clean_build/contracts/FixedPoint.json: -------------------------------------------------------------------------------- 1 | {"abi": [], "networks": {}} -------------------------------------------------------------------------------- /ham-www/src/ham/clean_build/contracts/SafeERC20.json: -------------------------------------------------------------------------------- 1 | {"abi": [], "networks": {}} -------------------------------------------------------------------------------- /ham-www/src/components/CardContent/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './CardContent' 2 | -------------------------------------------------------------------------------- /ham-www/src/components/IconButton/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './IconButton' 2 | -------------------------------------------------------------------------------- /ham-www/src/components/ModalTitle/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './ModalTitle' 2 | -------------------------------------------------------------------------------- /ham-www/src/components/PageHeader/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './PageHeader' 2 | -------------------------------------------------------------------------------- /ham-www/src/components/TokenInput/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './TokenInput' 2 | -------------------------------------------------------------------------------- /ham-www/src/contexts/Modals/index.ts: -------------------------------------------------------------------------------- 1 | export { default, Context } from './Modals' 2 | -------------------------------------------------------------------------------- /ham-www/src/components/ModalActions/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './ModalActions' 2 | -------------------------------------------------------------------------------- /ham-www/src/ham/clean_build/contracts/UniswapV2OracleLibrary.json: -------------------------------------------------------------------------------- 1 | {"abi": [], "networks": {}} -------------------------------------------------------------------------------- /ham-www/src/components/DisclaimerModal/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './DisclaimerModal' 2 | -------------------------------------------------------------------------------- /ham-www/src/components/StepProgressBar/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './StepProgressBar' 2 | -------------------------------------------------------------------------------- /ham-www/src/contexts/HamProvider/index.ts: -------------------------------------------------------------------------------- 1 | export { default, Context } from './HamProvider' 2 | -------------------------------------------------------------------------------- /ham-www/public/hero.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ham-Protocol/ham-protocol/HEAD/ham-www/public/hero.png -------------------------------------------------------------------------------- /ham-www/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /ham-www/src/constants/tokenAddresses.ts: -------------------------------------------------------------------------------- 1 | export const ham = '0xed3f9acd69a91654a68e9d64b0d1525988133de4' 2 | -------------------------------------------------------------------------------- /ham-www/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ham-Protocol/ham-protocol/HEAD/ham-www/public/favicon.ico -------------------------------------------------------------------------------- /ham-www/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ham-Protocol/ham-protocol/HEAD/ham-www/public/logo192.png -------------------------------------------------------------------------------- /ham-www/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ham-Protocol/ham-protocol/HEAD/ham-www/public/logo512.png -------------------------------------------------------------------------------- /ham-www/src/components/Icon/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Icon' 2 | export type { IconProps } from './Icon' 3 | -------------------------------------------------------------------------------- /ham-www/src/components/Input/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Input' 2 | export type { InputProps } from './Input' 3 | -------------------------------------------------------------------------------- /ham-www/src/components/Modal/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Modal' 2 | export type { ModalProps } from './Modal' 3 | -------------------------------------------------------------------------------- /ham-www/src/ham/lib/types.js: -------------------------------------------------------------------------------- 1 | export const ConfirmationType = { 2 | Hash: 0, 3 | Confirmed: 1, 4 | Both: 2, 5 | Simulate: 3, 6 | } 7 | -------------------------------------------------------------------------------- /ham-www/src/components/icons/index.ts: -------------------------------------------------------------------------------- 1 | export { default as AddIcon } from './AddIcon' 2 | export { default as RemoveIcon } from './RemoveIcon' 3 | -------------------------------------------------------------------------------- /ham-www/src/contexts/Transactions/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './TransactionsProvider' 2 | export { default as Context } from './context' 3 | -------------------------------------------------------------------------------- /clean_build/contracts/Context.json: -------------------------------------------------------------------------------- 1 | {"abi": [{"inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor"}], "networks": {}} -------------------------------------------------------------------------------- /ham-www/src/ham/clean_build/contracts/Context.json: -------------------------------------------------------------------------------- 1 | {"abi": [{"inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor"}], "networks": {}} -------------------------------------------------------------------------------- /ham-www/src/contexts/Farms/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Farms' 2 | export { default as Context } from './context' 3 | export type { Farm, FarmsContext } from './types' 4 | -------------------------------------------------------------------------------- /migrations/1_initial_migration.js: -------------------------------------------------------------------------------- 1 | const Migrations = artifacts.require("Migrations"); 2 | 3 | module.exports = function(deployer) { 4 | deployer.deploy(Migrations); 5 | }; 6 | -------------------------------------------------------------------------------- /ham-www/src/utils/formatAddress.ts: -------------------------------------------------------------------------------- 1 | const formatAddress = (address: string) => { 2 | return address.slice(0, 6) + '...' + address.slice(-6) 3 | } 4 | 5 | export default formatAddress 6 | -------------------------------------------------------------------------------- /ham-www/src/contexts/Farms/context.ts: -------------------------------------------------------------------------------- 1 | import { createContext } from 'react' 2 | import { FarmsContext } from './types' 3 | 4 | const context = createContext({ 5 | farms: [] 6 | }) 7 | 8 | export default context 9 | -------------------------------------------------------------------------------- /ham-www/src/views/Home/types.ts: -------------------------------------------------------------------------------- 1 | export interface OverviewData { 2 | circSupply?: string, 3 | curPrice?: number, 4 | nextRebase?: number, 5 | scalingFactor?: number, 6 | targetPrice?: number, 7 | totalSupply?: string 8 | } 9 | -------------------------------------------------------------------------------- /ham-www/src/hooks/useHam.ts: -------------------------------------------------------------------------------- 1 | import { useContext } from 'react' 2 | import { Context } from '../contexts/HamProvider' 3 | 4 | const useHam = () => { 5 | const { ham } = useContext(Context) 6 | return ham 7 | } 8 | 9 | export default useHam 10 | -------------------------------------------------------------------------------- /clean_build/contracts/HAMDelegationStorage.json: -------------------------------------------------------------------------------- 1 | {"abi": [{"constant": true, "inputs": [], "name": "implementation", "outputs": [{"internalType": "address", "name": "", "type": "address"}], "payable": false, "stateMutability": "view", "type": "function"}], "networks": {}} -------------------------------------------------------------------------------- /ham-www/src/ham/clean_build/contracts/HAMDelegationStorage.json: -------------------------------------------------------------------------------- 1 | {"abi": [{"constant": true, "inputs": [], "name": "implementation", "outputs": [{"internalType": "address", "name": "", "type": "address"}], "payable": false, "stateMutability": "view", "type": "function"}], "networks": {}} -------------------------------------------------------------------------------- /ham-www/src/hooks/useFarms.ts: -------------------------------------------------------------------------------- 1 | import { useContext } from 'react' 2 | import { Context as FarmsContext } from '../contexts/Farms' 3 | 4 | const useFarms = () => { 5 | const { farms } = useContext(FarmsContext) 6 | return [farms] 7 | } 8 | 9 | export default useFarms 10 | -------------------------------------------------------------------------------- /ham-www/src/ham/index.js: -------------------------------------------------------------------------------- 1 | import Web3 from 'web3'; 2 | import BigNumber from 'bignumber.js/bignumber'; 3 | 4 | BigNumber.config({ 5 | EXPONENTIAL_AT: 1000, 6 | DECIMAL_PLACES: 80, 7 | }); 8 | 9 | export { Ham } from './Ham.js'; 10 | export { 11 | Web3, 12 | BigNumber, 13 | }; 14 | -------------------------------------------------------------------------------- /ham-www/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom/extend-expect'; 6 | -------------------------------------------------------------------------------- /ham-www/src/contexts/Transactions/types.ts: -------------------------------------------------------------------------------- 1 | import { TransactionReceipt } from 'web3-core' 2 | 3 | export interface Transaction { 4 | description: string, 5 | hash: string, 6 | receipt?: TransactionReceipt, 7 | } 8 | 9 | export interface TransactionsMap { 10 | [key: string]: Transaction 11 | } 12 | -------------------------------------------------------------------------------- /ham-www/src/hooks/useTransactionAdder.ts: -------------------------------------------------------------------------------- 1 | import { useContext } from 'react' 2 | 3 | import { Context } from '../contexts/Transactions' 4 | 5 | const useTransactionAdder = () => { 6 | const { onAddTransaction } = useContext(Context) 7 | return { onAddTransaction } 8 | } 9 | 10 | export default useTransactionAdder 11 | -------------------------------------------------------------------------------- /ham-www/src/hooks/useFarm.ts: -------------------------------------------------------------------------------- 1 | import { useContext } from 'react' 2 | import { Context as FarmsContext, Farm } from '../contexts/Farms' 3 | 4 | const useFarm = (id: string): Farm => { 5 | const { farms } = useContext(FarmsContext) 6 | const farm = farms.find(farm => farm.id === id) 7 | return farm 8 | } 9 | 10 | export default useFarm 11 | -------------------------------------------------------------------------------- /ham-www/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: #F0E7EA; 3 | margin: 0; 4 | font-family: 'Nunito', sans-serif; 5 | font-size: 16px; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | transition: all 0.4s linear; 9 | } 10 | 11 | code { 12 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 13 | monospace; 14 | } 15 | -------------------------------------------------------------------------------- /ham-www/src/components/Icon/Icon.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | 4 | export interface IconProps { 5 | color?: string, 6 | children?: string 7 | } 8 | 9 | const Icon: React.FC = ({ children }) => ( 10 | 11 | {children} 12 | 13 | ) 14 | 15 | const StyledIcon = styled.div` 16 | ` 17 | 18 | export default Icon -------------------------------------------------------------------------------- /ham-www/workers-site/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "worker", 4 | "version": "1.0.0", 5 | "description": "A template for kick starting a Cloudflare Workers project", 6 | "main": "index.js", 7 | "author": "Ashley Lewis ", 8 | "license": "MIT", 9 | "dependencies": { 10 | "@cloudflare/kv-asset-handler": "~0.0.11" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ham-www/src/components/Label/Label.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | 4 | interface LabelProps { 5 | text?: string, 6 | } 7 | 8 | const Label: React.FC = ({ text }) => ( 9 | {text} 10 | ) 11 | 12 | const StyledLabel = styled.div` 13 | color: ${props => props.theme.color["textRegular"]}; 14 | ` 15 | 16 | export default Label -------------------------------------------------------------------------------- /ham-www/src/contexts/Transactions/context.ts: -------------------------------------------------------------------------------- 1 | import { createContext } from 'react' 2 | import { Transaction, TransactionsMap } from './types' 3 | 4 | interface TransactionsContext { 5 | transactions: TransactionsMap, 6 | onAddTransaction: (tx: Transaction) => void, 7 | } 8 | 9 | export default createContext({ 10 | transactions: {}, 11 | onAddTransaction: (tx: Transaction) => {}, 12 | }) 13 | -------------------------------------------------------------------------------- /ham-www/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | import BigNumber from 'bignumber.js' 2 | 3 | export { default as formatAddress } from './formatAddress' 4 | 5 | export const bnToDec = (bn: BigNumber, decimals = 18) => { 6 | return bn.dividedBy(new BigNumber(10).pow(decimals)).toNumber() 7 | } 8 | 9 | export const decToBn = (dec: number, decimals = 18) => { 10 | return new BigNumber(dec).multipliedBy(new BigNumber(10).pow(decimals)) 11 | } -------------------------------------------------------------------------------- /ham-www/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /ham-www/src/hooks/usePendingTransactions.ts: -------------------------------------------------------------------------------- 1 | import { useContext } from 'react' 2 | 3 | import { Context } from '../contexts/Transactions' 4 | 5 | const usePendingTransactions = () => { 6 | const { transactions } = useContext(Context) 7 | const pendingTransactions = Object.keys(transactions).map(txHash => transactions[txHash]).filter(tx => !tx.receipt) 8 | return pendingTransactions 9 | } 10 | 11 | export default usePendingTransactions 12 | -------------------------------------------------------------------------------- /ham-www/src/contexts/Farms/types.ts: -------------------------------------------------------------------------------- 1 | import { Contract } from "web3-eth-contract" 2 | 3 | export interface Farm { 4 | contract: Contract, 5 | name: string, 6 | depositToken: string, 7 | depositTokenAddress: string, 8 | earnToken: string, 9 | earnTokenAddress: string, 10 | icon: React.ReactNode, 11 | contractAddress: string, 12 | id: string, 13 | sort: number 14 | } 15 | 16 | export interface FarmsContext { 17 | farms: Farm[] 18 | } 19 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | const presets = [ 2 | [ 3 | "@babel/env", 4 | { 5 | targets: { 6 | edge: "17", 7 | firefox: "60", 8 | chrome: "67", 9 | safari: "11.1", 10 | node: "10.16.0" 11 | }, 12 | useBuiltIns: "usage", 13 | }, 14 | ], 15 | ]; 16 | 17 | const plugins = ["@babel/plugin-proposal-class-properties", "@babel/plugin-syntax-dynamic-import"] 18 | 19 | module.exports = { presets , plugins}; 20 | -------------------------------------------------------------------------------- /ham-www/src/components/CardContent/CardContent.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | 4 | const CardContent: React.FC = ({ children }) => ( 5 | 6 | {children} 7 | 8 | ) 9 | 10 | const StyledCardContent = styled.div` 11 | display: flex; 12 | flex: 1; 13 | flex-direction: column; 14 | padding: ${props => props.theme.spacing[4]}px; 15 | ` 16 | 17 | export default CardContent -------------------------------------------------------------------------------- /ham-www/src/hooks/useModal.ts: -------------------------------------------------------------------------------- 1 | import { useCallback, useContext } from 'react' 2 | 3 | import { Context } from '../contexts/Modals' 4 | 5 | const useModal = (modal: React.ReactNode) => { 6 | const { onDismiss, onPresent } = useContext(Context) 7 | 8 | const handlePresent = useCallback(() => { 9 | onPresent(modal) 10 | }, [ 11 | modal, 12 | onPresent, 13 | ]) 14 | 15 | return [handlePresent, onDismiss] 16 | } 17 | 18 | export default useModal 19 | -------------------------------------------------------------------------------- /contracts/Migrations.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.4.21 <0.7.0; 3 | 4 | contract Migrations { 5 | address public owner; 6 | uint public last_completed_migration; 7 | 8 | constructor() public { 9 | owner = msg.sender; 10 | } 11 | 12 | modifier restricted() { 13 | if (msg.sender == owner) _; 14 | } 15 | 16 | function setCompleted(uint completed) public restricted { 17 | last_completed_migration = completed; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ham-www/src/components/Value/Value.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | import styled from 'styled-components' 4 | 5 | interface ValueProps { 6 | value: string, 7 | } 8 | 9 | const Value: React.FC = ({ value }) => { 10 | return ( 11 | {value} 12 | ) 13 | } 14 | 15 | const StyledValue = styled.div` 16 | color: ${props => props.theme.color["title"]}; 17 | font-size: 36px; 18 | font-weight: 700; 19 | ` 20 | 21 | export default Value -------------------------------------------------------------------------------- /ham-www/src/utils/formatBalance.ts: -------------------------------------------------------------------------------- 1 | import BigNumber from 'bignumber.js' 2 | 3 | export const getDisplayBalance = (balance: BigNumber, decimals = 18) => { 4 | const displayBalance = balance.dividedBy(new BigNumber(10).pow(decimals)) 5 | if (displayBalance.lt(1)) { 6 | return displayBalance.toPrecision(4) 7 | } else { 8 | return displayBalance.toFixed(2) 9 | } 10 | } 11 | 12 | export const getFullDisplayBalance = (balance: BigNumber, decimals = 18) => { 13 | return balance.dividedBy(new BigNumber(10).pow(decimals)).toFixed() 14 | } 15 | -------------------------------------------------------------------------------- /ham-www/src/components/Card/Card.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | 4 | const Card: React.FC = ({ children }) => ( 5 | 6 | {children} 7 | 8 | ) 9 | 10 | const StyledCard = styled.div` 11 | background: ${props => props.theme.color[`card`]}; 12 | border-radius: 16px; 13 | box-shadow: inset 1px 1px 0px ${props => props.theme.color["buttonHighlight"]}; 14 | display: flex; 15 | flex: 1; 16 | flex-direction: column; 17 | transition: all 0.25s linear; 18 | ` 19 | 20 | export default Card 21 | -------------------------------------------------------------------------------- /ham-www/src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import * as serviceWorker from './serviceWorker'; 6 | 7 | ReactDOM.render( 8 | 9 | 10 | , 11 | document.getElementById('root') 12 | ); 13 | 14 | // If you want your app to work offline and load faster, you can change 15 | // unregister() to register() below. Note this comes with some pitfalls. 16 | // Learn more about service workers: https://bit.ly/CRA-PWA 17 | serviceWorker.unregister(); 18 | -------------------------------------------------------------------------------- /ham-www/src/hooks/useRedeem.ts: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react' 2 | 3 | import { useWallet } from 'use-wallet' 4 | import { Contract } from "web3-eth-contract" 5 | 6 | import { redeem } from '../hamUtils' 7 | 8 | const useRedeem = (poolContract: Contract) => { 9 | const { account } = useWallet() 10 | 11 | const handleRedeem = useCallback(async () => { 12 | const txHash = await redeem(poolContract, account) 13 | console.log(txHash) 14 | return txHash 15 | }, [account, poolContract]) 16 | 17 | return { onRedeem: handleRedeem } 18 | } 19 | 20 | export default useRedeem 21 | -------------------------------------------------------------------------------- /ham-www/src/hooks/useReward.ts: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react' 2 | 3 | import { useWallet } from 'use-wallet' 4 | import { Contract } from "web3-eth-contract" 5 | 6 | import { harvest } from '../hamUtils' 7 | 8 | const useReward = (poolContract: Contract) => { 9 | const { account } = useWallet() 10 | 11 | const handleReward = useCallback(async () => { 12 | const txHash = await harvest(poolContract, account) 13 | console.log(txHash) 14 | return txHash 15 | }, [account, poolContract]) 16 | 17 | return { onReward: handleReward } 18 | } 19 | 20 | export default useReward 21 | -------------------------------------------------------------------------------- /ham-www/src/hooks/useUnstake.ts: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react' 2 | 3 | import { useWallet } from 'use-wallet' 4 | import { Contract } from "web3-eth-contract" 5 | 6 | import { unstake } from '../hamUtils' 7 | 8 | const useUnstake = (poolContract: Contract) => { 9 | const { account } = useWallet() 10 | 11 | const handleUnstake = useCallback(async (amount: string) => { 12 | const txHash = await unstake(poolContract, amount, account) 13 | console.log(txHash) 14 | }, [account, poolContract]) 15 | 16 | return { onUnstake: handleUnstake } 17 | } 18 | 19 | export default useUnstake 20 | -------------------------------------------------------------------------------- /startBlockchainMining.sh: -------------------------------------------------------------------------------- 1 | ganache-cli -b 1 --networkId 1001 --gasPrice 0x1 -e 100000000000000000000 --gasLimit 12500000 --mnemonic="concert load couple harbor equip island argue ramp clarify fence smart topic" --max-old-space-size=8192 -u "0x0eb4add4ba497357546da7f5d12d39587ca24606" -u "0xf9e11762d522ea29dd78178c9baf83b7b093aacc" -u "0x8c545be506a335e24145edd6e01d2754296ff018" -u "0xc89b6f0146642688bb254bf93c28fccf1e182c81" -u "0x3b08aa814bea604917418a9f0907e7fc430e742c" -u "0xbe6977e08d4479c0a6777539ae0e8fa27be4e9d6" -u "0xf37216a8ac034d08b4663108d7532dfcb44583ed" -u "0xb696d629cd0a00560151a434f6b4478ad6c228d7" 2 | -------------------------------------------------------------------------------- /clean_build/contracts/HAMDelegateInterface.json: -------------------------------------------------------------------------------- 1 | {"abi": [{"constant": true, "inputs": [], "name": "implementation", "outputs": [{"internalType": "address", "name": "", "type": "address"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": false, "inputs": [{"internalType": "bytes", "name": "data", "type": "bytes"}], "name": "_becomeImplementation", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": false, "inputs": [], "name": "_resignImplementation", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}], "networks": {}} -------------------------------------------------------------------------------- /ham-www/src/hooks/useStake.ts: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react' 2 | 3 | import { useWallet } from 'use-wallet' 4 | import { Contract } from "web3-eth-contract" 5 | 6 | import { stake } from '../hamUtils' 7 | 8 | const useStake = (poolContract: Contract, tokenName: string) => { 9 | const { account } = useWallet() 10 | 11 | const handleStake = useCallback(async (amount: string) => { 12 | const txHash = await stake(poolContract, amount, account, tokenName) 13 | console.log(txHash) 14 | }, [account, poolContract]) 15 | 16 | return { onStake: handleStake } 17 | } 18 | 19 | export default useStake 20 | -------------------------------------------------------------------------------- /ham-www/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#000000" 25 | } 26 | -------------------------------------------------------------------------------- /ham-www/src/ham/clean_build/contracts/HAMDelegateInterface.json: -------------------------------------------------------------------------------- 1 | {"abi": [{"constant": true, "inputs": [], "name": "implementation", "outputs": [{"internalType": "address", "name": "", "type": "address"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": false, "inputs": [{"internalType": "bytes", "name": "data", "type": "bytes"}], "name": "_becomeImplementation", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": false, "inputs": [], "name": "_resignImplementation", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}], "networks": {}} -------------------------------------------------------------------------------- /ham-www/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "strict": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "module": "esnext", 16 | "moduleResolution": "node", 17 | "resolveJsonModule": true, 18 | "isolatedModules": true, 19 | "noEmit": true, 20 | "jsx": "react", 21 | "strictNullChecks": false 22 | }, 23 | "include": [ 24 | "src" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /contracts/lib/Babylonian.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0-or-later 2 | 3 | pragma solidity >=0.4.0; 4 | 5 | // computes square roots using the babylonian method 6 | // https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method 7 | library Babylonian { 8 | function sqrt(uint y) internal pure returns (uint z) { 9 | if (y > 3) { 10 | z = y; 11 | uint x = y / 2 + 1; 12 | while (x < z) { 13 | z = x; 14 | x = (y / x + x) / 2; 15 | } 16 | } else if (y != 0) { 17 | z = 1; 18 | } 19 | // else z = 0 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /contracts/lib/IRewardDistributionRecipient.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.17; 2 | 3 | import "../lib/Ownable.sol"; 4 | 5 | // File: contracts/IRewardDistributionRecipient.sol 6 | contract IRewardDistributionRecipient is Ownable { 7 | address public rewardDistribution; 8 | 9 | function notifyRewardAmount(uint256 reward) external; 10 | 11 | modifier onlyRewardDistribution() { 12 | require(_msgSender() == rewardDistribution, "Caller is not reward distribution"); 13 | _; 14 | } 15 | 16 | function setRewardDistribution(address _rewardDistribution) 17 | external 18 | onlyOwner 19 | { 20 | rewardDistribution = _rewardDistribution; 21 | } 22 | } -------------------------------------------------------------------------------- /ham-www/src/components/ModalTitle/ModalTitle.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | 4 | interface ModalTitleProps { 5 | text?: string 6 | } 7 | 8 | const ModalTitle: React.FC = ({ text }) => ( 9 | 10 | {text} 11 | 12 | ) 13 | 14 | const StyledModalTitle = styled.div` 15 | align-items: center; 16 | color: ${props => props.theme.color["title"]}; 17 | display: flex; 18 | font-size: 18px; 19 | font-weight: 700; 20 | height: ${props => props.theme.topBarSize}px; 21 | justify-content: center; 22 | margin-top: ${props => -props.theme.spacing[4]}px; 23 | ` 24 | 25 | export default ModalTitle -------------------------------------------------------------------------------- /ham-www/src/components/icons/RemoveIcon.tsx: -------------------------------------------------------------------------------- 1 | import React, { useContext } from 'react' 2 | import { ThemeContext } from 'styled-components' 3 | 4 | import Icon, { IconProps } from '../Icon' 5 | 6 | const RemoveIcon: React.FC = ({ color }) => { 7 | const { color: themeColor } = useContext(ThemeContext) 8 | return ( 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | ) 22 | } 23 | 24 | export default RemoveIcon 25 | -------------------------------------------------------------------------------- /startBlockchain.sh: -------------------------------------------------------------------------------- 1 | ganache-cli --fork https://fee7372b6e224441b747bf1fde15b2bd.eth.rpc.rivet.cloud --networkId 1001 --gasPrice 0x1 -e 100000000000000000000 --gasLimit 12500000 --mnemonic="concert load couple harbor equip island argue ramp clarify fence smart topic" --max-old-space-size=8192 -u "0x0eb4add4ba497357546da7f5d12d39587ca24606" -u "0xf9e11762d522ea29dd78178c9baf83b7b093aacc" -u "0x8c545be506a335e24145edd6e01d2754296ff018" -u "0xc89b6f0146642688bb254bf93c28fccf1e182c81" -u "0x3b08aa814bea604917418a9f0907e7fc430e742c" -u "0xbe6977e08d4479c0a6777539ae0e8fa27be4e9d6" -u "0xf37216a8ac034d08b4663108d7532dfcb44583ed" -u "0xb696d629cd0a00560151a434f6b4478ad6c228d7" -u "0x681148725731f213b0187a3cbef215c291d85a3e" 2 | -------------------------------------------------------------------------------- /clean_build/contracts/HAMInterface.json: -------------------------------------------------------------------------------- 1 | {"abi": [{"constant": true, "inputs": [{"internalType": "address", "name": "account", "type": "address"}, {"internalType": "uint256", "name": "blockNumber", "type": "uint256"}], "name": "getPriorVotes", "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": true, "inputs": [], "name": "initSupply", "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": false, "inputs": [], "name": "_acceptGov", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}], "networks": {}} -------------------------------------------------------------------------------- /ham-www/src/components/Logo/Logo.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | 4 | import Butcher from '../../assets/svg/Butcher.svg' 5 | 6 | const Logo: React.FC = () => { 7 | return ( 8 | 9 | 10 | HAM Harvester 11 | 12 | ) 13 | } 14 | 15 | const StyledLogo = styled.div` 16 | align-items: center; 17 | display: flex; 18 | ` 19 | 20 | const StyledText = styled.span` 21 | color: ${props => props.theme.color["title"]}; 22 | font-size: 18px; 23 | font-weight: 700; 24 | margin-left: ${props => props.theme.spacing[2]}px; 25 | ` 26 | 27 | export default Logo -------------------------------------------------------------------------------- /ham-www/src/ham/clean_build/contracts/HAMInterface.json: -------------------------------------------------------------------------------- 1 | {"abi": [{"constant": true, "inputs": [{"internalType": "address", "name": "account", "type": "address"}, {"internalType": "uint256", "name": "blockNumber", "type": "uint256"}], "name": "getPriorVotes", "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": true, "inputs": [], "name": "initSupply", "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": false, "inputs": [], "name": "_acceptGov", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}], "networks": {}} -------------------------------------------------------------------------------- /ham-www/src/components/Footer/Footer.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import styled from 'styled-components' 3 | 4 | import Nav from './components/Nav' 5 | 6 | const Footer: React.FC = () => { 7 | return ( 8 | 9 | 10 |