A simple factory wrapper around price oracles from the Uniswap team.
A smart contract system wishes to manage price oracles, as described in Uniswap Core Concepts - Oracles.
This factory complex is [TO BE] independently deployed. This adds a convenience factor for developers wishing to sample Uniswap prices.
This factory also adds a trust element: [NOTE: NOT YET!] When deployed, this factory will produce oracles that may be trusted to be audited, behave in a predictable, known fashion, and have not been tampered with by potentially unscrupulous actors.
As such, use of oracles created by this factory removes an element of trust from downstream projects - some trust is shifted to this system - thus increasing the trustless factor of downstream projects.
Update on-chain state with price data (if and only if the requisite time period has elapsed).
Given an input ERC20 tokenA address and tokenA amount, return the amount of tokenB that would be produced by a swap.
Create a new price oracle automaton, given the inputs of:
- tokenA: 1st of 2 tokens in a Uniswap pair, whose price shall be monitored.
- tokenB: 2nd of 2 tokens in a Uniswap pair, whose price shall be monitored.
- period: price sampling time period, in seconds.
Returns the Ethereum address of the newly created price oracle contract.
- Install packages
npm i -g truffle npm i
- Update provider url in config/default.json
- Set DEPLOYMENT_ACCOUNT_KEY in env
create a .env file in root DEPLOYMENT_ACCOUNT_KEY = "my mnemonic phrase"
- Deploy you own contracts if want to do arb-
truffle migrate --reset --network mainnet/ropsten