Files
explorer-monorepo/scripts/deploy-via-remix-instructions.sh

117 lines
4.3 KiB
Bash
Executable File

#!/bin/bash
# Generate Remix IDE deployment instructions for MockLinkToken
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR/.."
source .env 2>/dev/null || true
RPC_URL="${RPC_URL_138:-http://192.168.11.250:8545}"
ACCOUNT=$(cast wallet address "$PRIVATE_KEY" 2>/dev/null || echo "")
echo "╔══════════════════════════════════════════════════════════════╗"
echo "║ REMIX IDE DEPLOYMENT INSTRUCTIONS ║"
echo "╚══════════════════════════════════════════════════════════════╝"
echo ""
echo "If automated deployment fails, use Remix IDE:"
echo ""
echo "1. Go to: https://remix.ethereum.org"
echo ""
echo "2. Create new file: MockLinkToken.sol"
echo ""
echo "3. Paste this contract code:"
echo ""
cat << 'CONTRACT_EOF'
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
contract MockLinkToken {
string public name = "Chainlink Token";
string public symbol = "LINK";
uint8 public decimals = 18;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
uint256 public totalSupply;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function mint(address to, uint256 amount) external {
balanceOf[to] += amount;
totalSupply += amount;
emit Transfer(address(0), to, amount);
}
function transfer(address to, uint256 amount) external returns (bool) {
require(balanceOf[msg.sender] >= amount, "insufficient balance");
balanceOf[msg.sender] -= amount;
balanceOf[to] += amount;
emit Transfer(msg.sender, to, amount);
return true;
}
function transferFrom(address from, address to, uint256 amount) external returns (bool) {
require(balanceOf[from] >= amount, "insufficient balance");
require(allowance[from][msg.sender] >= amount, "insufficient allowance");
balanceOf[from] -= amount;
balanceOf[to] += amount;
allowance[from][msg.sender] -= amount;
emit Transfer(from, to, amount);
return true;
}
function approve(address spender, uint256 amount) external returns (bool) {
allowance[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
}
CONTRACT_EOF
echo ""
echo "4. Compile the contract:"
echo " - Go to 'Solidity Compiler' tab"
echo " - Set compiler version to 0.8.19 or compatible"
echo " - Click 'Compile MockLinkToken.sol'"
echo ""
echo "5. Deploy the contract:"
echo " - Go to 'Deploy & Run Transactions' tab"
echo " - Environment: 'Injected Provider - MetaMask' (or 'Custom' with RPC)"
echo " - Network: ChainID 138"
echo " - RPC URL: $RPC_URL"
echo " - Account: $ACCOUNT"
echo " - Contract: MockLinkToken"
echo " - Click 'Deploy'"
echo ""
echo "6. After deployment:"
echo " - Copy the deployed contract address"
echo " - Mint tokens: call mint($ACCOUNT, 1000000000000000000000000)"
echo " - Update .env: LINK_TOKEN=<deployed_address>"
echo ""
echo "7. Alternative: Use Custom RPC in Remix"
echo " - Environment: 'Custom'"
echo " - RPC URL: $RPC_URL"
echo " - Chain ID: 138"
echo " - Currency Symbol: ETH"
echo " - Use private key from .env (import account in MetaMask first)"
echo ""
echo "╔══════════════════════════════════════════════════════════════╗"
echo "║ QUICK REFERENCE ║"
echo "╚══════════════════════════════════════════════════════════════╝"
echo ""
echo "Network Configuration:"
echo " RPC URL: $RPC_URL"
echo " Chain ID: 138"
echo " Account: $ACCOUNT"
echo ""
echo "After deployment, update .env:"
echo " LINK_TOKEN=<deployed_address>"
echo ""
echo "Then run:"
echo " ./scripts/fund-bridge-contracts.sh 10"
echo ""