diff --git a/.gitignore b/.gitignore index 71ceba7ba09..f28c3ee1a5c 100644 --- a/.gitignore +++ b/.gitignore @@ -26,9 +26,6 @@ yarn-error.log* # truffle build -# typechain -types - # buidler artifacts cache diff --git a/src/components/types/contract.ts b/src/components/types/contract.ts new file mode 100644 index 00000000000..92c2f1a70c8 --- /dev/null +++ b/src/components/types/contract.ts @@ -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 +} diff --git a/src/components/types/fruits.ts b/src/components/types/fruits.ts new file mode 100644 index 00000000000..f2dc4051a76 --- /dev/null +++ b/src/components/types/fruits.ts @@ -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) +} diff --git a/types/chai.d.ts b/types/chai.d.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/types/truffle-contracts/ERC20.d.ts b/types/truffle-contracts/ERC20.d.ts new file mode 100644 index 00000000000..00ee90bf37f --- /dev/null +++ b/types/truffle-contracts/ERC20.d.ts @@ -0,0 +1,398 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import BN from "bn.js"; +import { EventData, PastEventOptions } from "web3-eth-contract"; + +export interface ERC20Contract extends Truffle.Contract { + "new"( + name_: string, + symbol_: string, + meta?: Truffle.TransactionDetails + ): Promise; +} + +export interface Approval { + name: "Approval"; + args: { + owner: string; + spender: string; + value: BN; + 0: string; + 1: string; + 2: BN; + }; +} + +export interface Transfer { + name: "Transfer"; + args: { + from: string; + to: string; + value: BN; + 0: string; + 1: string; + 2: BN; + }; +} + +type AllEvents = Approval | Transfer; + +export interface ERC20Instance extends Truffle.ContractInstance { + /** + * Returns the name of the token. + */ + name(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * Returns the symbol of the token, usually a shorter version of the name. + */ + symbol(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is called. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}. + */ + decimals(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * See {IERC20-totalSupply}. + */ + totalSupply(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * See {IERC20-balanceOf}. + */ + balanceOf( + account: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + + /** + * See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`. + */ + transfer: { + ( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * See {IERC20-allowance}. + */ + allowance( + owner: string, + spender: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + + /** + * See {IERC20-approve}. Requirements: - `spender` cannot be the zero address. + */ + approve: { + ( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for ``sender``'s tokens of at least `amount`. + */ + transferFrom: { + ( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. + */ + increaseAllowance: { + ( + spender: string, + addedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + spender: string, + addedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + spender: string, + addedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + spender: string, + addedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`. + */ + decreaseAllowance: { + ( + spender: string, + subtractedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + spender: string, + subtractedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + spender: string, + subtractedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + spender: string, + subtractedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + methods: { + /** + * Returns the name of the token. + */ + name(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * Returns the symbol of the token, usually a shorter version of the name. + */ + symbol(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is called. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}. + */ + decimals(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * See {IERC20-totalSupply}. + */ + totalSupply(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * See {IERC20-balanceOf}. + */ + balanceOf( + account: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + + /** + * See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`. + */ + transfer: { + ( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * See {IERC20-allowance}. + */ + allowance( + owner: string, + spender: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + + /** + * See {IERC20-approve}. Requirements: - `spender` cannot be the zero address. + */ + approve: { + ( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for ``sender``'s tokens of at least `amount`. + */ + transferFrom: { + ( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. + */ + increaseAllowance: { + ( + spender: string, + addedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + spender: string, + addedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + spender: string, + addedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + spender: string, + addedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`. + */ + decreaseAllowance: { + ( + spender: string, + subtractedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + spender: string, + subtractedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + spender: string, + subtractedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + spender: string, + subtractedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + }; + + getPastEvents(event: string): Promise; + getPastEvents( + event: string, + options: PastEventOptions, + callback: (error: Error, event: EventData) => void + ): Promise; + getPastEvents(event: string, options: PastEventOptions): Promise; + getPastEvents( + event: string, + callback: (error: Error, event: EventData) => void + ): Promise; +} diff --git a/types/truffle-contracts/ERC20Burnable.d.ts b/types/truffle-contracts/ERC20Burnable.d.ts new file mode 100644 index 00000000000..691476ebe5f --- /dev/null +++ b/types/truffle-contracts/ERC20Burnable.d.ts @@ -0,0 +1,491 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import BN from "bn.js"; +import { EventData, PastEventOptions } from "web3-eth-contract"; + +export interface ERC20BurnableContract + extends Truffle.Contract { + "new"(meta?: Truffle.TransactionDetails): Promise; +} + +export interface Approval { + name: "Approval"; + args: { + owner: string; + spender: string; + value: BN; + 0: string; + 1: string; + 2: BN; + }; +} + +export interface Transfer { + name: "Transfer"; + args: { + from: string; + to: string; + value: BN; + 0: string; + 1: string; + 2: BN; + }; +} + +type AllEvents = Approval | Transfer; + +export interface ERC20BurnableInstance extends Truffle.ContractInstance { + /** + * See {IERC20-allowance}. + */ + allowance( + owner: string, + spender: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + + /** + * See {IERC20-approve}. Requirements: - `spender` cannot be the zero address. + */ + approve: { + ( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * See {IERC20-balanceOf}. + */ + balanceOf( + account: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + + /** + * Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is called. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}. + */ + decimals(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`. + */ + decreaseAllowance: { + ( + spender: string, + subtractedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + spender: string, + subtractedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + spender: string, + subtractedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + spender: string, + subtractedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. + */ + increaseAllowance: { + ( + spender: string, + addedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + spender: string, + addedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + spender: string, + addedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + spender: string, + addedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * Returns the name of the token. + */ + name(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * Returns the symbol of the token, usually a shorter version of the name. + */ + symbol(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * See {IERC20-totalSupply}. + */ + totalSupply(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`. + */ + transfer: { + ( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for ``sender``'s tokens of at least `amount`. + */ + transferFrom: { + ( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * Destroys `amount` tokens from the caller. See {ERC20-_burn}. + */ + burn: { + ( + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * Destroys `amount` tokens from `account`, deducting from the caller's allowance. See {ERC20-_burn} and {ERC20-allowance}. Requirements: - the caller must have allowance for ``accounts``'s tokens of at least `amount`. + */ + burnFrom: { + ( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + methods: { + /** + * See {IERC20-allowance}. + */ + allowance( + owner: string, + spender: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + + /** + * See {IERC20-approve}. Requirements: - `spender` cannot be the zero address. + */ + approve: { + ( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * See {IERC20-balanceOf}. + */ + balanceOf( + account: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + + /** + * Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is called. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}. + */ + decimals(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`. + */ + decreaseAllowance: { + ( + spender: string, + subtractedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + spender: string, + subtractedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + spender: string, + subtractedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + spender: string, + subtractedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. + */ + increaseAllowance: { + ( + spender: string, + addedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + spender: string, + addedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + spender: string, + addedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + spender: string, + addedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * Returns the name of the token. + */ + name(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * Returns the symbol of the token, usually a shorter version of the name. + */ + symbol(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * See {IERC20-totalSupply}. + */ + totalSupply(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`. + */ + transfer: { + ( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for ``sender``'s tokens of at least `amount`. + */ + transferFrom: { + ( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * Destroys `amount` tokens from the caller. See {ERC20-_burn}. + */ + burn: { + ( + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * Destroys `amount` tokens from `account`, deducting from the caller's allowance. See {ERC20-_burn} and {ERC20-allowance}. Requirements: - the caller must have allowance for ``accounts``'s tokens of at least `amount`. + */ + burnFrom: { + ( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + }; + + getPastEvents(event: string): Promise; + getPastEvents( + event: string, + options: PastEventOptions, + callback: (error: Error, event: EventData) => void + ): Promise; + getPastEvents(event: string, options: PastEventOptions): Promise; + getPastEvents( + event: string, + callback: (error: Error, event: EventData) => void + ): Promise; +} diff --git a/types/truffle-contracts/Farm.d.ts b/types/truffle-contracts/Farm.d.ts new file mode 100644 index 00000000000..aeb6182a245 --- /dev/null +++ b/types/truffle-contracts/Farm.d.ts @@ -0,0 +1,197 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import BN from "bn.js"; +import { EventData, PastEventOptions } from "web3-eth-contract"; + +export interface FarmContract extends Truffle.Contract { + "new"( + _token: string, + meta?: Truffle.TransactionDetails + ): Promise; +} + +export interface FarmCreated { + name: "FarmCreated"; + args: { + _address: string; + 0: string; + }; +} + +export interface FarmSynced { + name: "FarmSynced"; + args: { + _address: string; + 0: string; + }; +} + +type AllEvents = FarmCreated | FarmSynced; + +export interface FarmInstance extends Truffle.ContractInstance { + createFarm: { + (_charity: string, txDetails?: Truffle.TransactionDetails): Promise< + Truffle.TransactionResponse + >; + call( + _charity: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + _charity: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + _charity: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + getLand( + txDetails?: Truffle.TransactionDetails + ): Promise<{ fruit: BN; createdAt: BN }[]>; + + sync: { + ( + _events: { + action: number | BN | string; + fruit: number | BN | string; + landIndex: number | BN | string; + createdAt: number | BN | string; + }[], + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + _events: { + action: number | BN | string; + fruit: number | BN | string; + landIndex: number | BN | string; + createdAt: number | BN | string; + }[], + txDetails?: Truffle.TransactionDetails + ): Promise<{ land: { fruit: BN; createdAt: BN }[]; balance: BN }>; + sendTransaction( + _events: { + action: number | BN | string; + fruit: number | BN | string; + landIndex: number | BN | string; + createdAt: number | BN | string; + }[], + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + _events: { + action: number | BN | string; + fruit: number | BN | string; + landIndex: number | BN | string; + createdAt: number | BN | string; + }[], + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + levelUp: { + (txDetails?: Truffle.TransactionDetails): Promise< + Truffle.TransactionResponse + >; + call(txDetails?: Truffle.TransactionDetails): Promise; + sendTransaction(txDetails?: Truffle.TransactionDetails): Promise; + estimateGas(txDetails?: Truffle.TransactionDetails): Promise; + }; + + getMarketPrice( + price: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + + methods: { + createFarm: { + (_charity: string, txDetails?: Truffle.TransactionDetails): Promise< + Truffle.TransactionResponse + >; + call( + _charity: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + _charity: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + _charity: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + getLand( + txDetails?: Truffle.TransactionDetails + ): Promise<{ fruit: BN; createdAt: BN }[]>; + + sync: { + ( + _events: { + action: number | BN | string; + fruit: number | BN | string; + landIndex: number | BN | string; + createdAt: number | BN | string; + }[], + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + _events: { + action: number | BN | string; + fruit: number | BN | string; + landIndex: number | BN | string; + createdAt: number | BN | string; + }[], + txDetails?: Truffle.TransactionDetails + ): Promise<{ land: { fruit: BN; createdAt: BN }[]; balance: BN }>; + sendTransaction( + _events: { + action: number | BN | string; + fruit: number | BN | string; + landIndex: number | BN | string; + createdAt: number | BN | string; + }[], + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + _events: { + action: number | BN | string; + fruit: number | BN | string; + landIndex: number | BN | string; + createdAt: number | BN | string; + }[], + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + levelUp: { + (txDetails?: Truffle.TransactionDetails): Promise< + Truffle.TransactionResponse + >; + call(txDetails?: Truffle.TransactionDetails): Promise; + sendTransaction(txDetails?: Truffle.TransactionDetails): Promise; + estimateGas(txDetails?: Truffle.TransactionDetails): Promise; + }; + + getMarketPrice( + price: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + getPastEvents(event: string): Promise; + getPastEvents( + event: string, + options: PastEventOptions, + callback: (error: Error, event: EventData) => void + ): Promise; + getPastEvents(event: string, options: PastEventOptions): Promise; + getPastEvents( + event: string, + callback: (error: Error, event: EventData) => void + ): Promise; +} diff --git a/types/truffle-contracts/IERC20.d.ts b/types/truffle-contracts/IERC20.d.ts new file mode 100644 index 00000000000..d274d901c22 --- /dev/null +++ b/types/truffle-contracts/IERC20.d.ts @@ -0,0 +1,260 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import BN from "bn.js"; +import { EventData, PastEventOptions } from "web3-eth-contract"; + +export interface IERC20Contract extends Truffle.Contract { + "new"(meta?: Truffle.TransactionDetails): Promise; +} + +export interface Approval { + name: "Approval"; + args: { + owner: string; + spender: string; + value: BN; + 0: string; + 1: string; + 2: BN; + }; +} + +export interface Transfer { + name: "Transfer"; + args: { + from: string; + to: string; + value: BN; + 0: string; + 1: string; + 2: BN; + }; +} + +type AllEvents = Approval | Transfer; + +export interface IERC20Instance extends Truffle.ContractInstance { + /** + * Returns the amount of tokens in existence. + */ + totalSupply(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * Returns the amount of tokens owned by `account`. + */ + balanceOf( + account: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + + /** + * Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event. + */ + transfer: { + ( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called. + */ + allowance( + owner: string, + spender: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + + /** + * Sets `amount` as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event. + */ + approve: { + ( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * Moves `amount` tokens from `sender` to `recipient` using the allowance mechanism. `amount` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event. + */ + transferFrom: { + ( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + methods: { + /** + * Returns the amount of tokens in existence. + */ + totalSupply(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * Returns the amount of tokens owned by `account`. + */ + balanceOf( + account: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + + /** + * Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event. + */ + transfer: { + ( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called. + */ + allowance( + owner: string, + spender: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + + /** + * Sets `amount` as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event. + */ + approve: { + ( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * Moves `amount` tokens from `sender` to `recipient` using the allowance mechanism. `amount` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event. + */ + transferFrom: { + ( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + }; + + getPastEvents(event: string): Promise; + getPastEvents( + event: string, + options: PastEventOptions, + callback: (error: Error, event: EventData) => void + ): Promise; + getPastEvents(event: string, options: PastEventOptions): Promise; + getPastEvents( + event: string, + callback: (error: Error, event: EventData) => void + ): Promise; +} diff --git a/types/truffle-contracts/Inventory.d.ts b/types/truffle-contracts/Inventory.d.ts new file mode 100644 index 00000000000..3a138fa6761 --- /dev/null +++ b/types/truffle-contracts/Inventory.d.ts @@ -0,0 +1,293 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import BN from "bn.js"; +import { EventData, PastEventOptions } from "web3-eth-contract"; + +export interface InventoryContract extends Truffle.Contract { + "new"( + _token: string, + meta?: Truffle.TransactionDetails + ): Promise; +} + +type AllEvents = never; + +export interface InventoryInstance extends Truffle.ContractInstance { + createFarm: { + (txDetails?: Truffle.TransactionDetails): Promise< + Truffle.TransactionResponse + >; + call(txDetails?: Truffle.TransactionDetails): Promise; + sendTransaction(txDetails?: Truffle.TransactionDetails): Promise; + estimateGas(txDetails?: Truffle.TransactionDetails): Promise; + }; + + getInventory( + txDetails?: Truffle.TransactionDetails + ): Promise<{ isInitialized: boolean; appleSeeds: BN; avocadoSeeds: BN }>; + + getLand( + txDetails?: Truffle.TransactionDetails + ): Promise<{ commodity: BN; createdAt: BN }[]>; + + getCurrentFarm( + _transactions: { + action: number | BN | string; + commodity: number | BN | string; + timestamp: number | BN | string; + landIndex: number | BN | string; + }[], + txDetails?: Truffle.TransactionDetails + ): Promise<{ + 0: { isInitialized: boolean; appleSeeds: BN; avocadoSeeds: BN }; + 1: BN; + }>; + + sync: { + ( + _transactions: { + action: number | BN | string; + commodity: number | BN | string; + timestamp: number | BN | string; + landIndex: number | BN | string; + }[], + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + _transactions: { + action: number | BN | string; + commodity: number | BN | string; + timestamp: number | BN | string; + landIndex: number | BN | string; + }[], + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + _transactions: { + action: number | BN | string; + commodity: number | BN | string; + timestamp: number | BN | string; + landIndex: number | BN | string; + }[], + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + _transactions: { + action: number | BN | string; + commodity: number | BN | string; + timestamp: number | BN | string; + landIndex: number | BN | string; + }[], + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + buyAppleSeed( + _transactions: { + action: number | BN | string; + commodity: number | BN | string; + timestamp: number | BN | string; + landIndex: number | BN | string; + }[], + txDetails?: Truffle.TransactionDetails + ): Promise<{ + 0: { isInitialized: boolean; appleSeeds: BN; avocadoSeeds: BN }; + 1: BN; + 2: BN; + 3: { action: BN; commodity: BN; timestamp: BN; landIndex: BN }[]; + }>; + + sellAppleSeed( + _transactions: { + action: number | BN | string; + commodity: number | BN | string; + timestamp: number | BN | string; + landIndex: number | BN | string; + }[], + txDetails?: Truffle.TransactionDetails + ): Promise<{ + 0: { isInitialized: boolean; appleSeeds: BN; avocadoSeeds: BN }; + 1: BN; + 2: BN; + 3: { action: BN; commodity: BN; timestamp: BN; landIndex: BN }[]; + }>; + + plantAppleSeed( + _transactions: { + action: number | BN | string; + commodity: number | BN | string; + timestamp: number | BN | string; + landIndex: number | BN | string; + }[], + landIndex: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise<{ + 0: { isInitialized: boolean; appleSeeds: BN; avocadoSeeds: BN }; + 1: BN; + 2: { action: BN; commodity: BN; timestamp: BN; landIndex: BN }[]; + }>; + + harvestAppleSeed( + _transactions: { + action: number | BN | string; + commodity: number | BN | string; + timestamp: number | BN | string; + landIndex: number | BN | string; + }[], + landIndex: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise<{ + 0: { isInitialized: boolean; appleSeeds: BN; avocadoSeeds: BN }; + 1: BN; + 2: { action: BN; commodity: BN; timestamp: BN; landIndex: BN }[]; + }>; + + getApplePrice(txDetails?: Truffle.TransactionDetails): Promise; + + methods: { + createFarm: { + (txDetails?: Truffle.TransactionDetails): Promise< + Truffle.TransactionResponse + >; + call(txDetails?: Truffle.TransactionDetails): Promise; + sendTransaction(txDetails?: Truffle.TransactionDetails): Promise; + estimateGas(txDetails?: Truffle.TransactionDetails): Promise; + }; + + getInventory( + txDetails?: Truffle.TransactionDetails + ): Promise<{ isInitialized: boolean; appleSeeds: BN; avocadoSeeds: BN }>; + + getLand( + txDetails?: Truffle.TransactionDetails + ): Promise<{ commodity: BN; createdAt: BN }[]>; + + getCurrentFarm( + _transactions: { + action: number | BN | string; + commodity: number | BN | string; + timestamp: number | BN | string; + landIndex: number | BN | string; + }[], + txDetails?: Truffle.TransactionDetails + ): Promise<{ + 0: { isInitialized: boolean; appleSeeds: BN; avocadoSeeds: BN }; + 1: BN; + }>; + + sync: { + ( + _transactions: { + action: number | BN | string; + commodity: number | BN | string; + timestamp: number | BN | string; + landIndex: number | BN | string; + }[], + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + _transactions: { + action: number | BN | string; + commodity: number | BN | string; + timestamp: number | BN | string; + landIndex: number | BN | string; + }[], + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + _transactions: { + action: number | BN | string; + commodity: number | BN | string; + timestamp: number | BN | string; + landIndex: number | BN | string; + }[], + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + _transactions: { + action: number | BN | string; + commodity: number | BN | string; + timestamp: number | BN | string; + landIndex: number | BN | string; + }[], + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + buyAppleSeed( + _transactions: { + action: number | BN | string; + commodity: number | BN | string; + timestamp: number | BN | string; + landIndex: number | BN | string; + }[], + txDetails?: Truffle.TransactionDetails + ): Promise<{ + 0: { isInitialized: boolean; appleSeeds: BN; avocadoSeeds: BN }; + 1: BN; + 2: BN; + 3: { action: BN; commodity: BN; timestamp: BN; landIndex: BN }[]; + }>; + + sellAppleSeed( + _transactions: { + action: number | BN | string; + commodity: number | BN | string; + timestamp: number | BN | string; + landIndex: number | BN | string; + }[], + txDetails?: Truffle.TransactionDetails + ): Promise<{ + 0: { isInitialized: boolean; appleSeeds: BN; avocadoSeeds: BN }; + 1: BN; + 2: BN; + 3: { action: BN; commodity: BN; timestamp: BN; landIndex: BN }[]; + }>; + + plantAppleSeed( + _transactions: { + action: number | BN | string; + commodity: number | BN | string; + timestamp: number | BN | string; + landIndex: number | BN | string; + }[], + landIndex: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise<{ + 0: { isInitialized: boolean; appleSeeds: BN; avocadoSeeds: BN }; + 1: BN; + 2: { action: BN; commodity: BN; timestamp: BN; landIndex: BN }[]; + }>; + + harvestAppleSeed( + _transactions: { + action: number | BN | string; + commodity: number | BN | string; + timestamp: number | BN | string; + landIndex: number | BN | string; + }[], + landIndex: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise<{ + 0: { isInitialized: boolean; appleSeeds: BN; avocadoSeeds: BN }; + 1: BN; + 2: { action: BN; commodity: BN; timestamp: BN; landIndex: BN }[]; + }>; + + getApplePrice(txDetails?: Truffle.TransactionDetails): Promise; + }; + + getPastEvents(event: string): Promise; + getPastEvents( + event: string, + options: PastEventOptions, + callback: (error: Error, event: EventData) => void + ): Promise; + getPastEvents(event: string, options: PastEventOptions): Promise; + getPastEvents( + event: string, + callback: (error: Error, event: EventData) => void + ): Promise; +} diff --git a/types/truffle-contracts/Migrations.d.ts b/types/truffle-contracts/Migrations.d.ts new file mode 100644 index 00000000000..3f754394527 --- /dev/null +++ b/types/truffle-contracts/Migrations.d.ts @@ -0,0 +1,77 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import BN from "bn.js"; +import { EventData, PastEventOptions } from "web3-eth-contract"; + +export interface MigrationsContract + extends Truffle.Contract { + "new"(meta?: Truffle.TransactionDetails): Promise; +} + +type AllEvents = never; + +export interface MigrationsInstance extends Truffle.ContractInstance { + last_completed_migration(txDetails?: Truffle.TransactionDetails): Promise; + + owner(txDetails?: Truffle.TransactionDetails): Promise; + + setCompleted: { + ( + completed: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + completed: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + completed: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + completed: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + methods: { + last_completed_migration( + txDetails?: Truffle.TransactionDetails + ): Promise; + + owner(txDetails?: Truffle.TransactionDetails): Promise; + + setCompleted: { + ( + completed: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + completed: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + completed: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + completed: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + }; + + getPastEvents(event: string): Promise; + getPastEvents( + event: string, + options: PastEventOptions, + callback: (error: Error, event: EventData) => void + ): Promise; + getPastEvents(event: string, options: PastEventOptions): Promise; + getPastEvents( + event: string, + callback: (error: Error, event: EventData) => void + ): Promise; +} diff --git a/types/truffle-contracts/Token.d.ts b/types/truffle-contracts/Token.d.ts new file mode 100644 index 00000000000..49ac13d9eaf --- /dev/null +++ b/types/truffle-contracts/Token.d.ts @@ -0,0 +1,591 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import BN from "bn.js"; +import { EventData, PastEventOptions } from "web3-eth-contract"; + +export interface TokenContract extends Truffle.Contract { + "new"(meta?: Truffle.TransactionDetails): Promise; +} + +export interface Approval { + name: "Approval"; + args: { + owner: string; + spender: string; + value: BN; + 0: string; + 1: string; + 2: BN; + }; +} + +export interface MinterChanged { + name: "MinterChanged"; + args: { + from: string; + to: string; + 0: string; + 1: string; + }; +} + +export interface Transfer { + name: "Transfer"; + args: { + from: string; + to: string; + value: BN; + 0: string; + 1: string; + 2: BN; + }; +} + +type AllEvents = Approval | MinterChanged | Transfer; + +export interface TokenInstance extends Truffle.ContractInstance { + /** + * See {IERC20-allowance}. + */ + allowance( + owner: string, + spender: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + + /** + * See {IERC20-approve}. Requirements: - `spender` cannot be the zero address. + */ + approve: { + ( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * See {IERC20-balanceOf}. + */ + balanceOf( + account: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + + /** + * Destroys `amount` tokens from `account`, deducting from the caller's allowance. See {ERC20-_burn} and {ERC20-allowance}. Requirements: - the caller must have allowance for ``accounts``'s tokens of at least `amount`. + */ + burnFrom: { + ( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is called. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}. + */ + decimals(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`. + */ + decreaseAllowance: { + ( + spender: string, + subtractedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + spender: string, + subtractedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + spender: string, + subtractedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + spender: string, + subtractedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. + */ + increaseAllowance: { + ( + spender: string, + addedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + spender: string, + addedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + spender: string, + addedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + spender: string, + addedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + minter(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * Returns the name of the token. + */ + name(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * Returns the symbol of the token, usually a shorter version of the name. + */ + symbol(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * See {IERC20-totalSupply}. + */ + totalSupply(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`. + */ + transfer: { + ( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for ``sender``'s tokens of at least `amount`. + */ + transferFrom: { + ( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + passMinterRole: { + (farm: string, txDetails?: Truffle.TransactionDetails): Promise< + Truffle.TransactionResponse + >; + call( + farm: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + farm: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + farm: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + getOwner(txDetails?: Truffle.TransactionDetails): Promise; + + mint: { + ( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + methods: { + /** + * See {IERC20-allowance}. + */ + allowance( + owner: string, + spender: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + + /** + * See {IERC20-approve}. Requirements: - `spender` cannot be the zero address. + */ + approve: { + ( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + spender: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * See {IERC20-balanceOf}. + */ + balanceOf( + account: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + + /** + * Destroys `amount` tokens from `account`, deducting from the caller's allowance. See {ERC20-_burn} and {ERC20-allowance}. Requirements: - the caller must have allowance for ``accounts``'s tokens of at least `amount`. + */ + burnFrom: { + ( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is called. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}. + */ + decimals(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`. + */ + decreaseAllowance: { + ( + spender: string, + subtractedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + spender: string, + subtractedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + spender: string, + subtractedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + spender: string, + subtractedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. + */ + increaseAllowance: { + ( + spender: string, + addedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + spender: string, + addedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + spender: string, + addedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + spender: string, + addedValue: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + minter(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * Returns the name of the token. + */ + name(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * Returns the symbol of the token, usually a shorter version of the name. + */ + symbol(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * See {IERC20-totalSupply}. + */ + totalSupply(txDetails?: Truffle.TransactionDetails): Promise; + + /** + * See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`. + */ + transfer: { + ( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for ``sender``'s tokens of at least `amount`. + */ + transferFrom: { + ( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + sender: string, + recipient: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + passMinterRole: { + (farm: string, txDetails?: Truffle.TransactionDetails): Promise< + Truffle.TransactionResponse + >; + call( + farm: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + farm: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + farm: string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + getOwner(txDetails?: Truffle.TransactionDetails): Promise; + + mint: { + ( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + /** + * Destroys `amount` tokens from the caller. See {ERC20-_burn}. + */ + "burn(uint256)": { + ( + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + + "burn(address,uint256)": { + ( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise>; + call( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + account: string, + amount: number | BN | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + }; + + getPastEvents(event: string): Promise; + getPastEvents( + event: string, + options: PastEventOptions, + callback: (error: Error, event: EventData) => void + ): Promise; + getPastEvents(event: string, options: PastEventOptions): Promise; + getPastEvents( + event: string, + callback: (error: Error, event: EventData) => void + ): Promise; +} diff --git a/types/truffle-contracts/index.d.ts b/types/truffle-contracts/index.d.ts new file mode 100644 index 00000000000..4780a319799 --- /dev/null +++ b/types/truffle-contracts/index.d.ts @@ -0,0 +1,30 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { ERC20Contract } from "./ERC20"; +import { ERC20BurnableContract } from "./ERC20Burnable"; +import { FarmContract } from "./Farm"; +import { IERC20Contract } from "./IERC20"; +import { MigrationsContract } from "./Migrations"; +import { TokenContract } from "./Token"; + +declare global { + namespace Truffle { + interface Artifacts { + require(name: "ERC20"): ERC20Contract; + require(name: "ERC20Burnable"): ERC20BurnableContract; + require(name: "Farm"): FarmContract; + require(name: "IERC20"): IERC20Contract; + require(name: "Migrations"): MigrationsContract; + require(name: "Token"): TokenContract; + } + } +} + +export { ERC20Contract, ERC20Instance } from "./ERC20"; +export { ERC20BurnableContract, ERC20BurnableInstance } from "./ERC20Burnable"; +export { FarmContract, FarmInstance } from "./Farm"; +export { IERC20Contract, IERC20Instance } from "./IERC20"; +export { MigrationsContract, MigrationsInstance } from "./Migrations"; +export { TokenContract, TokenInstance } from "./Token"; diff --git a/types/truffle-contracts/types.d.ts b/types/truffle-contracts/types.d.ts new file mode 100644 index 00000000000..168521f1172 --- /dev/null +++ b/types/truffle-contracts/types.d.ts @@ -0,0 +1,142 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +/** + * Globals + */ +/// +/// + +declare type EventEmitter = import("events").EventEmitter; + +declare type BN = import("bn.js"); +declare type Web3 = import("web3").default; +declare type AbiItem = import("web3-utils").AbiItem; +declare type TransactionConfig = import("web3-core").TransactionConfig; +declare type PromiEvent = import("web3-core").PromiEvent; +declare type TransactionReceipt = import("web3-core").TransactionReceipt; +declare type Web3EventOptions = import("web3-eth-contract").EventOptions; + +declare const assert: Chai.AssertStatic; +declare const expect: Chai.ExpectStatic; + +declare const web3: Web3; + +declare const artifacts: Truffle.Artifacts; + +/** + * Global contract function + */ +interface ContractFunction extends Mocha.SuiteFunction { + ( + title: string, + fn: (this: Mocha.Suite, accounts: Truffle.Accounts) => void + ): Mocha.Suite; + only: ExclusiveContractFunction; + skip: PendingContractFunction; +} + +interface ExclusiveContractFunction extends Mocha.ExclusiveSuiteFunction { + ( + title: string, + fn: (this: Mocha.Suite, accounts: Truffle.Accounts) => void + ): Mocha.Suite; +} + +interface PendingContractFunction extends Mocha.PendingSuiteFunction { + ( + title: string, + fn: (this: Mocha.Suite, accounts: Truffle.Accounts) => void + ): Mocha.Suite | void; +} + +declare const contract: ContractFunction; + +/** + * Namespace + */ +declare namespace Truffle { + type Accounts = string[]; + + interface TransactionDetails { + from?: string; + gas?: BN | number | string; + gasPrice?: BN | number | string; + value?: BN | string; + } + + export interface TransactionLog { + address: string; + event: EVENTS["name"]; + args: EVENTS["args"]; + blockHash: string; + blockNumber: number; + logIndex: number; + transactionHash: string; + transactionIndex: number; + type: string; + } + + export interface TransactionResponse { + tx: string; + receipt: any; + logs: TransactionLog[]; + } + + export interface AnyEvent { + name: string; + args: any; + } + + interface Contract extends ContractNew { + deployed(): Promise; + at(address: string): Promise; + link(name: string, address: string): void; + link(contract: Contract): void; + address: string; + contractName: string; + } + + interface EventOptions { + filter?: Web3EventOptions["filter"]; + fromBlock?: Web3EventOptions["fromBlock"]; + topics?: Web3EventOptions["topics"]; + } + + interface ContractInstance { + address: string; + contract: any; + transactionHash: string; + abi: AbiItem[]; + allEvents(params?: EventOptions): EventEmitter; + send( + value: Required["value"], + txParams?: TransactionConfig + ): PromiEvent; + sendTransaction( + transactionConfig: TransactionConfig + ): PromiEvent; + } + + interface ContractNew { + "new"(...args: ARGs): any; + } + + interface Deployer { + link( + library: Truffle.Contract, + destination: Truffle.Contract + ): Deployer; + link( + library: Truffle.Contract, + destinations: Array> + ): Deployer; + deploy(c: ContractNew, ...args: T): Deployer; + } + + type Migration = ( + deploy: Deployer, + network: string, + accounts: Accounts + ) => void; +} diff --git a/types/window.d.ts b/types/window.d.ts new file mode 100644 index 00000000000..944dc02d4e8 --- /dev/null +++ b/types/window.d.ts @@ -0,0 +1,6 @@ +declare global { + interface Window { + ethereum: any; + } +} +window.ethereum = window.ethereum || {};