import { Address , TokenType , RollupTransaction , State } from '../index' ; import { NULL_ADDRESS } from '@pigi/core-utils' ; export const UNISWAP_ADDRESS = NULL_ADDRESS ; export const UNISWAP_STORAGE_SLOT = 0 ; export const UNI_TOKEN_TYPE = 0 ; export const PIGI_TOKEN_TYPE = 1 ; export const NON_EXISTENT_SLOT_INDEX = - 1 ; export const EMPTY_AGGREGATOR_SIGNATURE = 'THIS IS EMPTY' ; export const generateTransferTx = ( sender , recipient , tokenType , amount ) : RollupTransaction => { return { sender , tokenType , recipient , amount , } ; } ; export const AGGREGATOR_API = { getState : 'getState' , getUniswapState : 'getUniswapBalances' , applyTransaction : 'applyTransaction' , requestFaucetFunds : 'requestFaucetFunds' , getTransactionCount : 'getTxCount' , } ; export const getGenesisState = ( aggregatorAddress , genesisState ? ) : State [ ] => { if ( ! genesisState ) { return [ { pubkey : UNISWAP_ADDRESS , balances : { [ UNI_TOKEN_TYPE ] : 1000000000 , [ PIGI_TOKEN_TYPE ] : 1000000000 , } , } , { pubkey : aggregatorAddress , balances : { [ UNI_TOKEN_TYPE ] : 500000 , [ PIGI_TOKEN_TYPE ] : 500000 , } , } , ] ; } if ( genesisState [ 0 ] . pubkey === 'UNISWAP_ADDRESS' ) { genesisState [ 0 ] . pubkey = UNISWAP_ADDRESS ; } if ( genesisState [ 1 ] . pubkey === 'AGGREGATOR_ADDRESS' ) { genesisState [ 1 ] . pubkey = aggregatorAddress ; } return genesisState ; } ;