Skip to content

Commit

Permalink
base conftest
Browse files Browse the repository at this point in the history
  • Loading branch information
parseb committed May 7, 2022
1 parent a13eadb commit 8518a08
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 1 deletion.
3 changes: 2 additions & 1 deletion contracts/CashCow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ pragma solidity 0.8.13;

import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC721/ERC721.sol';

import '../interfaces/IUniswapV3Pool.sol';
import '../interfaces/IUniswapV3Factory.sol';

contract CashCow is ERC721('Cash Cow Quest', 'COWQ') {
address immutable zero = 0x0000000000000000000000000000000000000000;
Expand Down
12 changes: 12 additions & 0 deletions contracts/ValueConduct.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.11;

import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";


contract ValueConduct is ERC20("Value Conduct", "VC") {

constructor(address _mint1milTo) {
_mint(_mint1milTo, 1_000_000 * 10 ** 18);
}
}
82 changes: 82 additions & 0 deletions interfaces/IERC20.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);

/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);

/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);

/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);

/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);

/**
* @dev 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.
*/
function allowance(address owner, address spender) external view returns (uint256);

/**
* @dev 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.
*/
function approve(address spender, uint256 amount) external returns (bool);

/**
* @dev Moves `amount` tokens from `from` to `to` 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.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}
13 changes: 13 additions & 0 deletions tests/0_default_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pytest
from brownie import accounts, chain, ZERO_ADDRESS, interface
from tests.conftest import CashCow, DAI, ValueConduct, IV3Factory, isPolygon



def test_default(isPolygon, CashCow, ValueConduct, DAI, IV3Factory):
assert isPolygon
assert CashCow.address != ZERO_ADDRESS




1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#none habit pantera demonic mnemonic
36 changes: 36 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

import pytest
from brownie import accounts, CashCow, chain, ZERO_ADDRESS, ValueConduct, interface

DAI_ADDR = "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063" #polygon mainnet
V3Factory = "0x1F98431c8aD98523631AE4a59f267346ea31F984"


@pytest.fixture
def isPolygon():
return chain._chainid == 137

@pytest.fixture
def CashCow():
deployed1 = CashCow.deploy({'from': accounts[0]})
return deployed1

@pytest.fixture
def ValueConduct():
deployed2 = ValueConduct.deploy('0xe7b30a037f5598e4e73702ca66a59af5cc650dcd',{'from': accounts[0]})
print("ValueConduct deplyed at: ", deployed2.address)
return deployed2

@pytest.fixture
def DAI():
DAI = interface.IERC20(DAI_ADDR)
print("DAI wrapped. balance of accounts[0] - address: ", DAI.balanceOf(accounts[0]), DAI.address)
return DAI

@pytest.fixture
def IV3Factory():
factory = interface.IUniswapV3Factory(V3Factory)
print("DAI wrapped. balance of accounts[0] - address: ", DAI.balanceOf(accounts[0]), DAI.address)
return factory


0 comments on commit 8518a08

Please sign in to comment.