Skip to content

Latest commit

 

History

History
257 lines (202 loc) · 7.43 KB

File metadata and controls

257 lines (202 loc) · 7.43 KB

KUSD Testnet Testing Guide

This guide covers how to test the KUSD system on KalyChain testnet.

Deployed Contracts (Testnet)

Network: KalyChain Testnet
Chain ID: 3889
RPC URL: https://testnetrpc.kalychain.io/rpc
Explorer: https://testnet.kalyscan.io

Core Contracts

Contract Address
Vat 0x30e50aD44cd1890A6bf9F09Bf6b8AfE62a6a390D
Kusd (Token) 0xd15F19c457AaaCB7A389B305Dac8611Cd2294c36
Spotter 0x4007599DcE3EB87F58A42C7f5e085994bf01Dd6E
Jug 0x78170E93a14ed75C0FB7cAE9Ef8fd6D1a7D059D3
Pot 0xBF790a6d2b3c658a90a8B64eeF75D3a23BfE6849
Dog 0xfeadEe95bF43B9ECf2E0a89Dd58D98D17Aba27C2
Vow 0x12af8412fB89929E2C56b4b9ded7eaC06705d2DC
Flapper 0x81ff754992C10A01683Cb71B326B0285D55D0e77
Flopper 0x00822453CD591143c5665a76818bFF0529d1de40
End 0x356F523079e3f33186B1B59F9cfAB7eCde1c477D
Cure 0xD3A6614B06F7eC703f21308639ceF08C215b0960
KusdJoin 0xB4d2fB8F90C018762CD403B690061CE04189e381

Mock Tokens (Testnet Only)

Token Address Decimals
MockWBTC 0x92631B8Be684d41d0dF9eb473D9E3995CDb2a797 8
MockWETH 0x68E7492e64FF0592a6D82E5C0323b8a8DDBfB884 18
MockUSDT 0xeE9940240B94821937812c43a6264e5aA417f161 6
MockUSDC 0x148d19609F3Ad595F8455225510f89cF0F121013 6
MockDAI 0x7BE7a4338143C417D2D71C96eA8560767c6E4477 18

Collateral Contracts

WBTC-A

  • Gem: 0x92631B8Be684d41d0dF9eb473D9E3995CDb2a797
  • GemJoin: 0x43147ADD4C2DB64BA9154273Fd0795ae7085E76f
  • Clipper: 0x8F33Cd3Bac73C5b8bD0ecfcDee82Ec8b8b5bcaa7
  • Calc: 0x531aCB028BFC68A186969769A7dc912e834fE996
  • Oracle: 0x85a8386367755965C95E31B06778B2c89082E316

WETH-A

  • Gem: 0x68E7492e64FF0592a6D82E5C0323b8a8DDBfB884
  • GemJoin: 0xf4E8C15337DBcc1DF320B677F6D36e266895f124
  • Clipper: 0xdDDBfC8F2e9Bf2a347c9658Af8Db66293df26774
  • Calc: 0x8Ee83625b89Ed59c154A889480CC54Ae25926E09
  • Oracle: 0x935216C74e1838E7090f31756ce0f64a34A5aAce

USDT-A

  • Gem: 0xeE9940240B94821937812c43a6264e5aA417f161
  • GemJoin: 0x8aC47Ea2C9aEB0501DbF9741FCeB1dFf8f4e5C40
  • Clipper: 0x3CFc46A275C5CBdFc6DBAd5c39590dF616F8D190
  • Calc: 0x9fDc324dB23c997FC17022742F0b7adE7134446a
  • Oracle: 0xf8Be6Ed01e7AE968118cf3db72E7641C59A9Dc4f

USDC-A

  • Gem: 0x148d19609F3Ad595F8455225510f89cF0F121013
  • GemJoin: 0x92448d63dc9d345DF69Ce8b6322D31F6abF35591
  • Clipper: 0xb6b82Aa8A96C769DA355F5CEe56309BB6E0473Ad
  • Calc: 0xe9e09fFE77916016e39FD0245C9f0495D0Ed21c1
  • Oracle: 0x930e5F6D686A19794bc7a1615a40032182D359D7

DAI-A

  • Gem: 0x7BE7a4338143C417D2D71C96eA8560767c6E4477
  • GemJoin: 0x3209e83e489f7e6e5ef9Ea820076C9B4BBC8Fb5d
  • Clipper: 0xe745818d1BfDC7dfE5556aa97a55059D18b9de38
  • Calc: 0xDaF2a190a2e75eDdE038cC75b596F8520D57430B
  • Oracle: 0x301F4fbd60156568d87932c42b3C17Bd5F0f33BD

Minting Test Tokens

The mock tokens deployed on testnet have a public mint() function that anyone can call for testing purposes.

Using Cast (Foundry)

Important: You must specify gas settings explicitly for KalyChain:

  • --gas-limit 500000
  • --gas-price 21000000000 (21 gwei)
  • --legacy (use legacy transaction format)

Mint MockWBTC (1,000 WBTC with 8 decimals)

cast send 0x92631B8Be684d41d0dF9eb473D9E3995CDb2a797 \
  "mint(address,uint256)" \
  YOUR_ADDRESS \
  100000000000 \
  --rpc-url https://testnetrpc.kalychain.io/rpc \
  --private-key $PRIVATE_KEY \
  --gas-limit 500000 \
  --gas-price 21000000000 \
  --legacy

Mint MockWETH (1,000 WETH with 18 decimals)

cast send 0x68E7492e64FF0592a6D82E5C0323b8a8DDBfB884 \
  "mint(address,uint256)" \
  YOUR_ADDRESS \
  1000000000000000000000 \
  --rpc-url https://testnetrpc.kalychain.io/rpc \
  --private-key $PRIVATE_KEY \
  --gas-limit 500000 \
  --gas-price 21000000000 \
  --legacy

Mint MockUSDT (1,000,000 USDT with 6 decimals)

cast send 0xeE9940240B94821937812c43a6264e5aA417f161 \
  "mint(address,uint256)" \
  YOUR_ADDRESS \
  1000000000000 \
  --rpc-url https://testnetrpc.kalychain.io/rpc \
  --private-key $PRIVATE_KEY \
  --gas-limit 500000 \
  --gas-price 21000000000 \
  --legacy

Mint MockUSDC (1,000,000 USDC with 6 decimals)

cast send 0x148d19609F3Ad595F8455225510f89cF0F121013 \
  "mint(address,uint256)" \
  YOUR_ADDRESS \
  1000000000000 \
  --rpc-url https://testnetrpc.kalychain.io/rpc \
  --private-key $PRIVATE_KEY \
  --gas-limit 500000 \
  --gas-price 21000000000 \
  --legacy

Mint MockDAI (1,000 DAI with 18 decimals)

cast send 0x7BE7a4338143C417D2D71C96eA8560767c6E4477 \
  "mint(address,uint256)" \
  YOUR_ADDRESS \
  1000000000000000000000 \
  --rpc-url https://testnetrpc.kalychain.io/rpc \
  --private-key $PRIVATE_KEY \
  --gas-limit 500000 \
  --gas-price 21000000000 \
  --legacy

Check Token Balance

cast call TOKEN_ADDRESS "balanceOf(address)(uint256)" YOUR_ADDRESS --rpc-url https://testnetrpc.kalychain.io/rpc

Example:

cast call 0x92631B8Be684d41d0dF9eb473D9E3995CDb2a797 "balanceOf(address)(uint256)" 0xae51f2efe70e57b994be8f7f97c4dc824c51802a --rpc-url https://testnetrpc.kalychain.io/rpc

Testing Vault Operations

1. Approve GemJoin to Spend Your Tokens

Before depositing collateral, you need to approve the GemJoin contract:

cast send MOCK_TOKEN_ADDRESS \
  "approve(address,uint256)" \
  GEMJOIN_ADDRESS \
  999999999999999999999999999999 \
  --rpc-url https://testnetrpc.kalychain.io/rpc \
  --private-key $PRIVATE_KEY \
  --gas-limit 500000 \
  --gas-price 21000000000 \
  --legacy

Example for WBTC:

cast send 0x92631B8Be684d41d0dF9eb473D9E3995CDb2a797 \
  "approve(address,uint256)" \
  0x43147ADD4C2DB64BA9154273Fd0795ae7085E76f \
  999999999999999999999999999999 \
  --rpc-url https://testnetrpc.kalychain.io/rpc \
  --private-key $PRIVATE_KEY \
  --gas-limit 500000 \
  --gas-price 21000000000 \
  --legacy

2. Deposit Collateral (Join)

cast send GEMJOIN_ADDRESS \
  "join(address,uint256)" \
  YOUR_ADDRESS \
  AMOUNT \
  --rpc-url https://testnetrpc.kalychain.io/rpc \
  --private-key $PRIVATE_KEY \
  --gas-limit 500000 \
  --gas-price 21000000000 \
  --legacy

3. Generate KUSD (Borrow)

This requires interacting with the Vat contract directly. See the MakerDAO documentation for detailed vault operations.


Important Notes

  1. Gas Settings: Always use the gas settings shown above for KalyChain testnet
  2. Mock Tokens: These are ONLY for testnet testing - they have no value
  3. Public Mint: Anyone can mint mock tokens on testnet for testing
  4. Oracle Prices: The oracle prices are set by the oracle system deployed separately
  5. Ownership: All contracts are currently owned by the deployer EOA: 0xaE51f2EfE70e57b994BE8F7f97C4dC824c51802a

Troubleshooting

"Internal error" when sending transactions

Make sure you're using the correct gas settings:

  • --gas-limit 500000
  • --gas-price 21000000000
  • --legacy

Explorer not showing transactions

The KalyChain testnet explorer may lag behind the actual chain state. Use RPC calls to verify transactions:

cast receipt TRANSACTION_HASH --rpc-url https://testnetrpc.kalychain.io/rpc

Checking if a contract is deployed

cast code CONTRACT_ADDRESS --rpc-url https://testnetrpc.kalychain.io/rpc

If it returns 0x, the contract is not deployed at that address.