Skip to content

Commit

Permalink
chore: add deployment usdt (#498)
Browse files Browse the repository at this point in the history
* chore: add deployment usdt

* chore: rename INIT_USDC_SUPPLY

* chore: rename to USD_BALANCE

* chore: fix typo
  • Loading branch information
albert-llimos authored Mar 11, 2024
1 parent 8da820c commit 66d00e4
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 7 deletions.
9 changes: 9 additions & 0 deletions scripts/deploy_contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
StateChainGateway,
FLIP,
MockUSDC,
MockUSDT,
DeployerContract,
AddressChecker,
CFTester,
Expand All @@ -21,6 +22,7 @@
from deploy import (
deploy_Chainflip_contracts,
deploy_usdc_contract,
deploy_usdt_contract,
deploy_new_cfReceiver,
deploy_contracts_secondary_evm,
)
Expand Down Expand Up @@ -179,6 +181,11 @@ def deploy_optional_contracts(cf, addressDump):
cf.cfTester = deploy_new_cfReceiver(deployer, CFTester, cf.vault.address)
addressDump["CF_TESTER"] = cf.cfTester.address

# Keeping the order to not change the final addresses
if chain.id in [arb_localnet, eth_localnet, hardhat]:
cf.mockUSDT = deploy_usdt_contract(deployer, MockUSDT, cf_accs[0:10])
addressDump["USDT_ADDRESS"] = cf.mockUSDT.address


def display_common_deployment_params(chain_id, deployer, govKey, commKey, aggKey):
print(f" Chain: {chain_id}")
Expand Down Expand Up @@ -218,6 +225,8 @@ def display_deployed_contracts(cf):
# Contracts dependant on localnet/testnet/mainnet
if hasattr(cf, "mockUSDC"):
print(f" USDC: {cf.mockUSDC.address}")
if hasattr(cf, "mockUSDT"):
print(f" USDT: {cf.mockUSDT.address}")
if hasattr(cf, "cfTester"):
print(f" CFTester: {cf.cfTester.address}")

Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def cfLoopbackMock(cf, LoopBackMock):

@pytest.fixture(scope="module")
def mockUsdc(cf, MockUSDC):
return cf.SAFEKEEPER.deploy(MockUSDC, "USD Coin", "USDC", INIT_USDC_SUPPLY)
return cf.SAFEKEEPER.deploy(MockUSDC, "USD Coin", "USDC", INIT_USD_SUPPLY)


@pytest.fixture(scope="module")
Expand All @@ -278,7 +278,7 @@ def utils(cf, Utils):

@pytest.fixture(scope="module")
def mockUSDT(cf, MockUSDT):
return cf.SAFEKEEPER.deploy(MockUSDT, "Tether USD", "USDT", INIT_USDC_SUPPLY)
return cf.SAFEKEEPER.deploy(MockUSDT, "Tether USD", "USDT", INIT_USD_SUPPLY)


@pytest.fixture(scope="module")
Expand Down
4 changes: 2 additions & 2 deletions tests/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
INIT_NATIVE_BAL = int(10000 * E_18)
SECS_PER_BLOCK = 13
# USDC and USDT use 6 decimals
INIT_USDC_SUPPLY = int(20 * 10**6 * 10**6)
INIT_USDC_ACCOUNT = int(10**6 * 10**6)
INIT_USD_SUPPLY = int(20 * 10**6 * 10**6)
INIT_USD_BALANCE = int(10**6 * 10**6)
TEST_AMNT_USDC = int(10**6)

# Time in seconds
Expand Down
25 changes: 22 additions & 3 deletions tests/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,17 +226,36 @@ def deploy_usdc_contract(deployer, MockUSDC, accounts):
mockUsdc = MockUSDC.deploy(
"USD Coin",
"USDC",
INIT_USDC_SUPPLY,
INIT_USD_SUPPLY,
{"from": deployer, "required_confs": required_confs},
)
# Distribute tokens to other accounts
for account in accounts:
if account != deployer and mockUsdc.balanceOf(deployer) >= INIT_USDC_ACCOUNT:
mockUsdc.transfer(account, INIT_USDC_ACCOUNT, {"from": deployer})
if account != deployer and mockUsdc.balanceOf(deployer) >= INIT_USD_BALANCE:
mockUsdc.transfer(account, INIT_USD_BALANCE, {"from": deployer})

return mockUsdc


# Deploy USDCT mock token
def deploy_usdt_contract(deployer, MockUSDT, accounts):
# Set the priority fee for all transactions and the required number of confirmations.
required_confs = transaction_params()

mockUsdt = MockUSDT.deploy(
"Tether USD",
"USDT",
INIT_USD_SUPPLY,
{"from": deployer, "required_confs": required_confs},
)
# Distribute tokens to other accounts
for account in accounts:
if account != deployer and mockUsdt.balanceOf(deployer) >= INIT_USD_BALANCE:
mockUsdt.transfer(account, INIT_USD_BALANCE, {"from": deployer})

return mockUsdt


def deploy_addressHolder(
deployer,
AddressHolder,
Expand Down

0 comments on commit 66d00e4

Please sign in to comment.