-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
206 additions
and
958 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# flyctl launch added from .gitignore | ||
**/*.sqlite | ||
**/node_modules | ||
**/build | ||
**/bun.lockb | ||
**/stackr_build | ||
**/.env | ||
**/dist | ||
**/.vercel | ||
fly.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"appId": 101, | ||
"appInbox": "0xaf4a15008892e5Ca30B04A70891834c38d4b88b6", | ||
"appId": 110, | ||
"appInbox": "0x0d5aFA71F688B480469D9686C9C946910C804535", | ||
"chainId": 11155111 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
contract EscrowGameMapping { | ||
address public owner; | ||
|
||
// Mapping from EscrowId (uint256) to GameId (bytes32) | ||
mapping(uint256 => bytes32) public escrowToGame; | ||
|
||
// Event to log the mapping creation | ||
event MappingCreated(uint256 indexed escrowId, bytes32 indexed gameId); | ||
|
||
// Modifier to restrict function access to the owner | ||
modifier onlyOwner() { | ||
require(msg.sender == owner, "Caller is not the owner"); | ||
_; | ||
} | ||
|
||
// Constructor to set the contract deployer as the initial owner | ||
constructor() { | ||
owner = msg.sender; | ||
} | ||
|
||
// Function to transfer ownership to a new address (only callable by the current owner) | ||
function transferOwnership(address newOwner) public onlyOwner { | ||
require(newOwner != address(0), "New owner is the zero address"); | ||
owner = newOwner; | ||
} | ||
|
||
// Function to create a new mapping between EscrowId and GameId | ||
function createMapping(uint256 escrowId, bytes32 gameId) public onlyOwner { | ||
// Ensure that the EscrowId is not already mapped | ||
require(escrowToGame[escrowId] == bytes32(0), "EscrowId is already mapped to a GameId."); | ||
|
||
// Create the mapping | ||
escrowToGame[escrowId] = gameId; | ||
|
||
// Emit the event | ||
emit MappingCreated(escrowId, gameId); | ||
} | ||
|
||
// Function to retrieve the GameId for a given EscrowId | ||
function getGameId(uint256 escrowId) public view returns (bytes32) { | ||
return escrowToGame[escrowId]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { HardhatRuntimeEnvironment } from "hardhat/types"; | ||
import { DeployFunction } from "hardhat-deploy/types"; | ||
import { Contract } from "ethers"; | ||
|
||
/** | ||
* Deploys a contract named "EscrowGameMapping" using the deployer account | ||
* | ||
* @param hre HardhatRuntimeEnvironment object. | ||
*/ | ||
const deployEscrowGameMapping: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const { deployer } = await hre.getNamedAccounts(); | ||
const { deploy } = hre.deployments; | ||
|
||
// Deploy the contract | ||
await deploy("EscrowGameMapping", { | ||
from: deployer, | ||
args: [], // No constructor arguments | ||
log: true, | ||
autoMine: true, | ||
}); | ||
|
||
// Get the deployed contract to interact with it after deploying. | ||
const escrowGameMapping: Contract = await hre.ethers.getContract<Contract>("EscrowGameMapping", deployer); | ||
console.log("🥷🏻 Deployed", await escrowGameMapping.getAddress()); | ||
}; | ||
|
||
export default deployEscrowGameMapping; | ||
|
||
// Tags are useful if you have multiple deploy files and only want to run one of them. | ||
// e.g. yarn deploy --tags EscrowGameMapping | ||
deployEscrowGameMapping.tags = ["EscrowGameMapping"]; |
File renamed without changes.
Oops, something went wrong.