Skip to content

Commit

Permalink
Include types folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Hannigan committed Jul 5, 2021
1 parent 2d0baad commit 93278d4
Show file tree
Hide file tree
Showing 14 changed files with 2,589 additions and 3 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ yarn-error.log*
# truffle
build

# typechain
types

# buidler
artifacts
cache
39 changes: 39 additions & 0 deletions src/components/types/contract.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
export enum Fruit {
None = '0',
Apple = '1',
Avocado = '2',
Banana = '3',
Coconut = '4',
Pineapple = '5',
Money = '6',
Diamond = '7',
}

export enum Charity {
TheWaterProject = '0x060697E9d4EEa886EbeCe57A974Facd53A40865B',
Heifer = '0xD3F81260a44A1df7A7269CF66Abd9c7e4f8CdcD1',
CoolEarth = '0x3c8cB169281196737c493AfFA8F49a9d823bB9c5'
}

export interface Square {
fruit: Fruit
createdAt: number
}


export interface Inventory {
apples: number;
avocados: number
}

export interface Transaction {
fruit: Fruit
createdAt: number
action: Action
landIndex: number
}

export enum Action {
Plant = 0,
Harvest = 1
}
65 changes: 65 additions & 0 deletions src/components/types/fruits.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@

import { Fruit } from './contract'


import sunflower from '../images/sunflower/fruit.png'
import pumpkin from '../images/pumpkin/fruit.png'
import beetroot from '../images/beetroot/fruit.png'
import cauliflower from '../images/cauliflower/fruit.png'
import potato from '../images/potato/fruit.png'

interface Item {
fruit: Fruit
name: string
image: string
buyPrice: number
sellPrice: number
landRequired: number
harvestHours: number
}

export const fruits: Item[] = [{
fruit: Fruit.Apple,
name: 'Sunflower',
image: sunflower,
buyPrice: 0.01,
sellPrice: 0.02,
landRequired: 5,
harvestHours: 1
}, {
fruit: Fruit.Avocado,
name: 'Pumpkin',
image: pumpkin,
buyPrice: 0.06,
sellPrice: 0.12,
landRequired: 5,
harvestHours: 3
}, {
fruit: Fruit.Banana,
name: 'Beetroot',
image: beetroot,
buyPrice: 0.20,
sellPrice: 0.56,
landRequired: 8,
harvestHours: 8
}, {
fruit: Fruit.Coconut,
name: 'Cauliflower',
image: cauliflower,
buyPrice: 1,
sellPrice: 2.30,
landRequired: 8,
harvestHours: 24
}, {
fruit: Fruit.Pineapple,
name: 'Potato',
image: potato,
buyPrice: 2,
sellPrice: 640,
landRequired: 11,
harvestHours: 72
}]

export function getFruit(fruit: Fruit) {
return fruits.find(item => item.fruit === fruit)
}
Empty file added types/chai.d.ts
Empty file.
Loading

0 comments on commit 93278d4

Please sign in to comment.