Skip to content

Commit

Permalink
update addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
arjanjohan committed Mar 23, 2024
1 parent ebd1329 commit c05cd68
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
6 changes: 6 additions & 0 deletions packages/hardhat/scripts/contractAddresses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"FootballGame": "0x940540782303c7380b28D0781d076ad05d1cB6eA",
"FootballCoin": "0xc314278217Ae8D99D95BdAb3432e174A1a483Ed1",
"ChallengerAddress" : "0xbb1DF1ab33786Ac6B91d9D16b445c7b66825979e",
"OpponentAddress" : "0x0534eaF0FdCE77771b7988F8501AEac47f53f011"
}
14 changes: 10 additions & 4 deletions packages/hardhat/scripts/gameFlow.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
const { ethers } = require("hardhat");
const fs = require('fs');

async function main() {
const footballGameAddress = "0x940540782303c7380b28D0781d076ad05d1cB6eA";
const footballCoinAddress = "0xc314278217Ae8D99D95BdAb3432e174A1a483Ed1"; // Address of deployed FootballCoin contract
const challengerAddress = "0xbb1DF1ab33786Ac6B91d9D16b445c7b66825979e";
const opponentAddress = "0x0534eaF0FdCE77771b7988F8501AEac47f53f011";

const rawdata = fs.readFileSync('/home/arjanjohan/git/hack/taipei24/scaffold-eth-2/packages/hardhat/scripts/contractAddresses.json');
const addresses = JSON.parse(rawdata);

const footballGameAddress = addresses.FootballGame;
const footballCoinAddress = addresses.FootballCoin;
const challengerAddress = addresses.ChallengerAddress;
const opponentAddress = addresses.OpponentAddress;
const wagerAmount = "1000000000000000000"; // 1 token in Wei
const defaultFormation = [1, 4, 5, 6, 7 , 8 ,9 ,10, 11, 12 ,13]

Expand All @@ -29,6 +34,7 @@ async function main() {
console.log("gm");
await proposeTx.wait();

console.log("Game proposed");
// Assume game ID is 1 for this example. Retrieve actual game ID from the event log in a real scenario.
const gameId = await footballGame.getGameCount();
console.log(`Game ID: ${gameId}`);
Expand Down
11 changes: 8 additions & 3 deletions packages/hardhat/scripts/interactWithFootballCoin.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
// interactWithFootballCoin.js
const fs = require('fs');

const { ethers } = require("hardhat");
// npx hardhat run scripts/interactWithFootballCoin.js --network ten

async function main() {
// Replace the following addresses with the actual addresses
const footballCoinAddress = "0xc314278217Ae8D99D95BdAb3432e174A1a483Ed1"; // Address of deployed FootballCoin contract
const accountToMintTo = "0x0534eaF0FdCE77771b7988F8501AEac47f53f011"; // Address to which you want to mint FootballCoin tokens
const spenderAddress = "0x44CbD15D584f2D7865232123146e8e20404c6952"; // Address allowed to spend the tokens (another contract or wallet)

const rawdata = fs.readFileSync('/home/arjanjohan/git/hack/taipei24/scaffold-eth-2/packages/hardhat/scripts/contractAddresses.json');
const addresses = JSON.parse(rawdata);

const footballCoinAddress = addresses.FootballCoin;
const accountToMintTo = addresses.ChallengerAddress; // Address to which you want to mint FootballCoin tokens
const spenderAddress = addresses.FootballGame; // Address allowed to spend the tokens (another contract or wallet)
const mintAmount = "1000000000000000000000"; // Amount to mint, e.g., 1000 FBC
const allowanceAmount = "1000000000000000000000"; // Allowance amount, e.g., 500 FBC

Expand Down
7 changes: 6 additions & 1 deletion packages/hardhat/scripts/loadPlayers.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
const { ethers } = require("hardhat");
const fs = require('fs');

async function main() {
const [deployer] = await ethers.getSigners();
console.log("Interacting with the smart contract using the account:", deployer.address);

const contractAddress = "0x940540782303c7380b28D0781d076ad05d1cB6eA";

const rawdata = fs.readFileSync('/home/arjanjohan/git/hack/taipei24/scaffold-eth-2/packages/hardhat/scripts/contractAddresses.json');
const addresses = JSON.parse(rawdata);

const contractAddress = addresses.FootballGame;
const contractArtifact = await hre.artifacts.readArtifact("FootballGame");
const contract = new ethers.Contract(contractAddress, contractArtifact.abi, deployer);

Expand Down

0 comments on commit c05cd68

Please sign in to comment.