diff --git a/contracts/mocks/MockUSDC.sol b/contracts/mocks/MockUSDC.sol new file mode 100644 index 00000000..7783cbfa --- /dev/null +++ b/contracts/mocks/MockUSDC.sol @@ -0,0 +1,21 @@ +pragma solidity ^0.8.0; + +import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; + +/** + * @title Token + * @dev Creates a mock USDC contract just for the internal ETH network testing + */ +contract MockUSDC is ERC20 { + constructor( + string memory name, + string memory symbol, + uint256 mintAmount + ) ERC20(name, symbol) { + _mint(msg.sender, mintAmount); + } + + function decimals() public view override returns (uint8) { + return 6; + } +} diff --git a/scripts/deploy_contracts.py b/scripts/deploy_contracts.py index 91a60c94..6be98664 100644 --- a/scripts/deploy_contracts.py +++ b/scripts/deploy_contracts.py @@ -4,7 +4,7 @@ sys.path.append(os.path.abspath("tests")) from consts import * -from brownie import chain, accounts, KeyManager, Vault, StakeManager, FLIP, Token +from brownie import chain, accounts, KeyManager, Vault, StakeManager, FLIP, MockUSDC from deploy import deploy_set_Chainflip_contracts, deploy_usdc_contract @@ -35,9 +35,9 @@ def main(): # Deploy USDC mimic token only on private ETH network if chain.id == 10997: - cf.usdc = deploy_usdc_contract(DEPLOYER, Token, cf_accs[0:10]) - print(f"USDC: {cf.usdc.address}") - addressDump["USDC_ADDRESS"] = cf.usdc.address + cf.mockUSDC = deploy_usdc_contract(DEPLOYER, MockUSDC, cf_accs[0:10]) + print(f"USDC: {cf.mockUSDC.address}") + addressDump["USDC_ADDRESS"] = cf.mockUSDC.address if DEPLOY_ARTEFACT_ID: json_content = json.dumps(addressDump) diff --git a/tests/deploy.py b/tests/deploy.py index 23944808..fc53c2e7 100644 --- a/tests/deploy.py +++ b/tests/deploy.py @@ -94,12 +94,12 @@ def deploy_set_Chainflip_contracts( # Deploy USDC mimic token (standard ERC20) and transfer init amount to several accounts. -def deploy_usdc_contract(deployer, Token, accounts): +def deploy_usdc_contract(deployer, MockUSDC, accounts): - usdc = deployer.deploy(Token, "USD Coin", "USDC", INIT_USDC_SUPPLY) + mockUsdc = deployer.deploy(MockUSDC, "USD Coin", "USDC", INIT_USDC_SUPPLY) # Distribute tokens to other accounts for account in accounts: - if account != deployer and usdc.balanceOf(deployer) >= INIT_USDC_ACCOUNT: - usdc.transfer(account, INIT_USDC_ACCOUNT, {"from": deployer}) + if account != deployer and mockUsdc.balanceOf(deployer) >= INIT_USDC_ACCOUNT: + mockUsdc.transfer(account, INIT_USDC_ACCOUNT, {"from": deployer}) - return usdc + return mockUsdc