Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e: Add mainnet test config #340

Draft
wants to merge 3 commits into
base: celo-rebase-12
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions e2e_test/js-tests/viem_setup.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
http,
defineChain,
} from "viem";
import { celoAlfajores } from "viem/chains";
import { celo, celoAlfajores } from "viem/chains";
import { privateKeyToAccount } from "viem/accounts";

// Setup up chain
Expand All @@ -32,12 +32,23 @@ const celoBaklava = defineChain({
},
});

const celoMainnet = defineChain({
...celo,
rpcUrls: {
default: {
http: [process.env.ETH_RPC_URL],
},
},
});

const chain = (() => {
switch (process.env.NETWORK) {
case 'alfajores':
return celoAlfajores
case 'baklava':
return celoBaklava
case 'mainnet':
return celoMainnet
default:
return devChain
};
Expand All @@ -53,4 +64,4 @@ export const walletClient = createWalletClient({
account,
chain: chain,
transport: http(),
});
});
8 changes: 8 additions & 0 deletions e2e_test/shared.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ case $NETWORK in
# for contract in GoldToken FeeHandler FeeCurrencyDirectory
# cast call 0x000000000000000000000000000000000000ce10 "getAddressForStringOrDie(string calldata identifier) returns (address)" $contract
# end
mainnet)
export ETH_RPC_URL=https://forno.celo.org/cel2
export TOKEN_ADDR=0x471EcE3750Da237f93B8E339c536989b8978a438
export FEE_HANDLER=0xcD437749E43A154C07F3553504c68fBfD56B8778
export FEE_CURRENCY=0xD8763CBa276a3738E6DE85b4b3bF5FDed6D6cA73
export FEE_CURRENCY_DIRECTORY_ADDR=0x15F344b9E6c3Cb6F0376A36A64928b13F62C6276
echo "Using mainnet network"
;;
alfajores)
export ETH_RPC_URL=https://alfajores-forno.celo-testnet.org
export TOKEN_ADDR=0xF194afDf50B03e69Bd7D057c1Aa9e10c9954E4C9
Expand Down
11 changes: 9 additions & 2 deletions e2e_test/test_token_duality.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,12 @@ source shared.sh
balance_before=$(cast balance 0x000000000000000000000000000000000000dEaD)
cast send --private-key $ACC_PRIVKEY $TOKEN_ADDR 'transfer(address to, uint256 value) returns (bool)' 0x000000000000000000000000000000000000dEaD 100
balance_after=$(cast balance 0x000000000000000000000000000000000000dEaD)
echo "Balance change: $balance_before -> $balance_after"
[[ $((balance_before + 100)) -eq $balance_after ]] || (echo "Balance did not change as expected"; exit 1)

# Use bc for arbitrary precision arithmetic
expected_balance=$(echo "$balance_before + 100" | bc)
if [ "$expected_balance" != "$balance_after" ]; then
echo "Balance did not change as expected"
echo "Expected: $expected_balance"
echo "Actual: $balance_after"
exit 1
fi
Loading