A project comprising of smart contracts and scripts to port certain information from DeFiChain to DeFiMetaChain
├── bot // <-- Logic for the bot + integration test
├── contracts // <- The smart contracts + example solidity usage
├── scripts // <- Deployment scripts + gas estimation
├── tests // <- Smart contract tests
├── containers // <- Containers for integration tests
import {handler} from "@waveshq/state-relayer-bot";
import { EnvironmentNetwork } from "@waveshq/walletkit-core"
handler({
testGasCost: false,
urlNetwork: "https://ocean.defichain.com/",
envNetwork: EnvironmentNetwork.MainNet,
contractAddress: /* YOUR STATE RELAYER PROXY ADDRESS */,
signer: /* signer object */,
gasUpdateDEX: /* gas limit for dex update transaction */,
gasUpdateMaster: /* gas limit for master node update transaction */,
gasUpdateVault: /* gas limit for vault update transaction */
})
Examples on how to consume the information exposed by the smart contract is showcased via this folder and this folder
Install the dependencies and compile smart contracts:
npm ci
npx hardhat compile
- If you use .env file, just execute this:
npx hardhat run --network DMCTestnet scripts/deployment.ts
- If you want to use Ledger, comment the accounts line and uncomment the ledgerAccounts line under DMCTestnet section. Execute this command:
npx hardhat run --network DMCTestnet scripts/deployment.ts
There are three main functions related to this:
grantRole(bytes32,address)
, revokeRole(bytes32,address)
and renounceRole(bytes32,address)
Clone the repo.
git checkout v0.0.1, (the version that the smart contract is deployed from)
Install dependencies and compile smart contract:
npm ci
npx hardhat compile
Copy file scripts/utils/generateEncodedData.ts from main onto this branch (v0.0.1) and then generate encoded data by executing this command line:
npx ts-node scripts/utils/generateEncodedData
After this, enable metamask to be able to show hex data.
Then when creating a transaction to send, enter the smart contract address as the recipient, then paste the generated encoded data into the "Hex data" field.
A similar flow is showcased in video/MetamaskInstruction.mov
StateRelayerProxy: 0xa075dC93D00ac14f4a7416C03cAbec4728586760
StateRelayer: 0x970F740feB2D14926881d51873Eb81E9183E7B18
StateRelayerProxy: 0xA6A853DDbfB6C85d3584E33313628555BA85753B
StateRelayer: 0x45f94FFE3fE1b1076e145285E11D5E7Cdf7d6f5e