change variable name

This commit is contained in:
Noah Zinsmeister
2020-01-06 13:00:57 -05:00
parent a589b65bd5
commit 3d2493ef2c
3 changed files with 15 additions and 15 deletions

View File

@ -5,7 +5,7 @@ import "./interfaces/IUniswapV2.sol";
contract UniswapV2Factory is IUniswapV2Factory {
bytes public exchangeBytecode;
address public factoryOwner;
address public feeToSetter;
address public feeTo;
mapping (address => mapping(address => address)) private _getExchange;
@ -13,10 +13,10 @@ contract UniswapV2Factory is IUniswapV2Factory {
event ExchangeCreated(address indexed token0, address indexed token1, address exchange, uint);
constructor(bytes memory _exchangeBytecode, address _factoryOwner) public {
constructor(bytes memory _exchangeBytecode, address _feeToSetter) public {
require(_exchangeBytecode.length >= 32, "UniswapV2Factory: SHORT_BYTECODE");
exchangeBytecode = _exchangeBytecode;
factoryOwner = _factoryOwner;
feeToSetter = _feeToSetter;
}
function sortTokens(address tokenA, address tokenB) public pure returns (address token0, address token1) {
@ -48,13 +48,13 @@ contract UniswapV2Factory is IUniswapV2Factory {
emit ExchangeCreated(token0, token1, exchange, exchanges.length);
}
function setFactoryOwner(address _factoryOwner) external {
require(msg.sender == factoryOwner, "UniswapV2Factory: FORBIDDEN");
factoryOwner = _factoryOwner;
function setFeeToSetter(address _feeToSetter) external {
require(msg.sender == feeToSetter, "UniswapV2Factory: FORBIDDEN");
feeToSetter = _feeToSetter;
}
function setFeeTo(address _feeTo) external {
require(msg.sender == factoryOwner, "UniswapV2Factory: FORBIDDEN");
require(msg.sender == feeToSetter, "UniswapV2Factory: FORBIDDEN");
feeTo = _feeTo;
}
}

View File

@ -4,7 +4,7 @@ interface IUniswapV2Factory {
event ExchangeCreated(address indexed token0, address indexed token1, address exchange, uint256);
function exchangeBytecode() external view returns (bytes memory);
function factoryOwner() external view returns (address);
function feeToSetter() external view returns (address);
function feeTo() external view returns (address);
function sortTokens(address tokenA, address tokenB) external pure returns (address token0, address token1);

View File

@ -31,9 +31,9 @@ describe('UniswapV2Factory', () => {
factory = _factory
})
it('exchangeBytecode, factoryOwner, feeTo, exchangesCount', async () => {
it('exchangeBytecode, feeToSetter, feeTo, exchangesCount', async () => {
expect(await factory.exchangeBytecode()).to.eq(bytecode)
expect(await factory.factoryOwner()).to.eq(wallet.address)
expect(await factory.feeToSetter()).to.eq(wallet.address)
expect(await factory.feeTo()).to.eq(AddressZero)
expect(await factory.exchangesCount()).to.eq(0)
})
@ -81,11 +81,11 @@ describe('UniswapV2Factory', () => {
console.log(`Gas required for createExchange: ${gasCost}`)
})
it('setFactoryOwner', async () => {
await expect(factory.connect(other).setFactoryOwner(other.address)).to.be.reverted // UniswapV2Factory: FORBIDDEN
await factory.setFactoryOwner(other.address)
expect(await factory.factoryOwner()).to.eq(other.address)
await expect(factory.setFactoryOwner(wallet.address)).to.be.reverted // UniswapV2Factory: FORBIDDEN
it('setFeeToSetter', async () => {
await expect(factory.connect(other).setFeeToSetter(other.address)).to.be.reverted // UniswapV2Factory: FORBIDDEN
await factory.setFeeToSetter(other.address)
expect(await factory.feeToSetter()).to.eq(other.address)
await expect(factory.setFeeToSetter(wallet.address)).to.be.reverted // UniswapV2Factory: FORBIDDEN
})
it('setFeeTo', async () => {