Skip to content

Commit

Permalink
feat: testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
nattb8 committed Oct 16, 2024
1 parent c9ae488 commit 0e2bfd8
Show file tree
Hide file tree
Showing 8 changed files with 721 additions and 87 deletions.
147 changes: 145 additions & 2 deletions Assets/Shared/Prefabs/UI/ShopScreen.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -1924,6 +1924,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 5538285658628802168}
- {fileID: 3468965489332797179}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
Expand Down Expand Up @@ -1986,10 +1987,10 @@ MonoBehaviour:
m_AddButton: {fileID: 5951993766795102788}
m_BackEvent: {fileID: 11400000, guid: 58f804667e2cb4eb789b6d2dfb3c4ce3, type: 2}
m_Balance: {fileID: 7413814428584860172}
m_PackObj: {fileID: 1362636507398835244}
m_ItemObj: {fileID: 1362636507398835244}
m_ListParent: {fileID: 3995018089020746221}
m_ScrollView: {fileID: 6011150636714096262}
m_AddFunds: {fileID: 0}
m_AddFunds: {fileID: 4459613696454349734}
--- !u!1 &9098808456760454047
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -2803,3 +2804,145 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: b5e87ca911816437f846b3f0d738b485, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &8930956508653391281
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 7510809188624096650}
m_Modifications:
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_AnchorMax.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_AnchorMax.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_AnchorMin.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_AnchorMin.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_SizeDelta.x
value: 600
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_SizeDelta.y
value: 650
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 4
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346709, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_Name
value: AddFundsView
objectReference: {fileID: 0}
- target: {fileID: 5464304629124346709, guid: 9703ade02db14aea9329516418991255,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 9703ade02db14aea9329516418991255, type: 3}
--- !u!224 &3468965489332797179 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 5464304629124346698, guid: 9703ade02db14aea9329516418991255,
type: 3}
m_PrefabInstance: {fileID: 8930956508653391281}
m_PrefabAsset: {fileID: 0}
--- !u!114 &4459613696454349734 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 5049268175328206359, guid: 9703ade02db14aea9329516418991255,
type: 3}
m_PrefabInstance: {fileID: 8930956508653391281}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 34f4fd3646f040d99e04107838a59be2, type: 3}
m_Name:
m_EditorClassIdentifier:
19 changes: 11 additions & 8 deletions Assets/Shared/Scripts/Model/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ public static class Config
// public const string SERVER_URL = "https://sample-passport-unity-game-api.dev.immutable.com/fox";
public const string SERVER_URL = "http://localhost:6060";

// public const string CLIENT_ID = "ZJL7JvetcDFBNDlgRs5oJoxuAUUl6uQj";
public const string CLIENT_ID = "2Ng38UmEg0Morz1xOQLtsDs72Wx8uyGL"; // Devnet
public const string CLIENT_ID = "mp6rxfMDwwZDogcdgNrAaHnG0qMlXuMK"; // Testnet
//public const string CLIENT_ID = "2Ng38UmEg0Morz1xOQLtsDs72Wx8uyGL"; // Devnet
// public const string CLIENT_ID = "UnB98ngnXIZIEJWGJOjVe1BpCx5ix7qc"; // WebGL

public const string ENVIRONMENT = "dev";
public const string ENVIRONMENT = "sandbox";

#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX
public const string REDIRECT_URI = "immutablerunner://callback";
Expand All @@ -29,19 +29,22 @@ public static class Config
public const string LOGOUT_REIDIRECT_URI = null;
#endif

public const string CHAIN_NAME = "imtbl-zkevm-devnet";
public const string BASE_URL = "https://api.dev.immutable.com";
public const string CHAIN_NAME = "imtbl-zkevm-testnet";
public const string BASE_URL = "https://api.sandbox.immutable.com";
public const int PAGE_SIZE = 20;
}

public static class Contract
{
// public const string SKIN = "0xad826E89CDe60E4eE248980D35c0F5C1196ad059"; // Testnet
public const string SKIN = "0xcdbee7935e1b0eaabdee64219182602df0d8d094"; // Devnet
// public const string SKIN = "0xcdbee7935e1b0eaabdee64219182602df0d8d094"; // Devnet
public const string SKIN = "0xc8df1b1693e2beffd2e484a825a357c6a3d998f2"; // Testnet team

// public const string TOKEN = "0x912cd5f1cd67F1143b7a5796fd9e5063D755DAbe"; // Testnet
public const string TOKEN = "0x328766302e7617d0de5901f8da139dca49f3ec75"; // Devnet
// public const string TOKEN = "0x328766302e7617d0de5901f8da139dca49f3ec75"; // Devnet
public const string TOKEN = "0xb237501b35dfdcad274299236a141425469ab9ba"; // Testnet team

public const string PACK = "0x60a6e04faf4feb1e08d7012077146b392569a094"; // Devnet
// public const string PACK = "0x60a6e04faf4feb1e08d7012077146b392569a094"; // Devnet
public const string PACK = "0x8525b5e782f3fbe6460057460be020146b63ed0f"; // Testnet team
}
}
2 changes: 1 addition & 1 deletion ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ PlayerSettings:
allowUnsafeCode: 0
useDeterministicCompilation: 1
enableRoslynAnalyzers: 1
selectedPlatform: 2
selectedPlatform: 0
additionalIl2CppArgs:
scriptingRuntimeVersion: 1
gcIncremental: 0
Expand Down
2 changes: 1 addition & 1 deletion contracts/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## How to deploy the contract
1. Rename `contracts/.env.example` to `.env`, and set all parameters with the appropriate data for the environment these Sample game contracts will be deployed.
2. Run `yarn install`
3. Replace `YOUR_IMMUTABLE_RUNNER_SKIN_CONTRACT_ADDRESS` in `contracts/RunnerToken.sol` with your Immutable Runner Skin contract address
3. Replace `YOUR_IMMUTABLE_RUNNER_SKIN_CONTRACT_ADDRESS` in `scripts/deploy.ts` with your Immutable Runner Skin contract address
3. Run `yarn compile`
4. Run `yarn deploy`
6 changes: 3 additions & 3 deletions contracts/scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ async function main() {
// Load the Immutable Runner Tokencontract and get the contract factory
// const tokenContractFactory = await ethers.getContractFactory('RunnerToken');

// // Deploy the contract to the zkEVM network
// Deploy the contract to the zkEVM network
// const tokenContract = await tokenContractFactory.deploy(
// 'YOUR_IMMUTABLE_RUNNER_SKIN_CONTRACT_ADDRESS', // Immutable Runner Skin contract address
// );
Expand All @@ -15,8 +15,8 @@ async function main() {

// Deploy the contract to the zkEVM network
const packContract = await packContractFactory.deploy(
'0x328766302e7617d0de5901f8da139dca49f3ec75', // Immutable Runner Token contract address
'0x5A3461514af018c19A6F887d14840B05fED4c5b8' // Immutable Operator Allowlist
'0xb237501b35dfdcad274299236a141425469ab9ba', // Immutable Runner Token contract address
'0x6b969FD89dE634d8DE3271EbE97734FEFfcd58eE' // Immutable Operator Allowlist
);

console.log('Contract deployed to:', await packContract.getAddress());
Expand Down
2 changes: 1 addition & 1 deletion mint-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"vm-browserify": "^1.1.2"
},
"dependencies": {
"@imtbl/sdk": "^1.40.4",
"@imtbl/sdk": "^1.57.0",
"axios": "^1.7.5",
"cors": "^2.8.5",
"dotenv": "^16.4.5",
Expand Down
34 changes: 1 addition & 33 deletions mint-backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ app.use(express.json()); // Handle JSON
app.use(cors()); // Enable CORS
const router: Router = express.Router();

const zkEvmProvider = new providers.JsonRpcProvider(`https://rpc.dev.immutable.com`);
const zkEvmProvider = new providers.JsonRpcProvider(`https://rpc.devnet.immutable.com`);

// Contract addresses
const foxContractAddress = process.env.FOX_CONTRACT_ADDRESS;
Expand Down Expand Up @@ -133,38 +133,6 @@ router.post('/mint/skin', async (req: Request, res: Response) => {
},
);

router.post('/refresh', async (req: Request, res: Response) => {
try {
if (skinColourContractAddress && privateKey) {
// Get the address to mint the token to
const to: string = req.body.to ?? null;
// Get the quantity to mint if specified, default is one
const tokenId = BigInt(req.body.tokenId ?? '1');

// Connect to wallet with minter role
const signer = new Wallet(privateKey).connect(zkEvmProvider);

// Specify the function to call
const abi = ['function mint(address to, uint256 tokenId)'];
// Connect contract to the signer
const contract = new Contract(skinColourContractAddress, abi, signer);

// Mints the number of tokens specified
const tx = await contract.mint(to, tokenId, gasOverrides);
await tx.wait();

return res.status(200).json({});
} else {
return res.status(500).json({});
}

} catch (error) {
console.log(error);
return res.status(400).json({ message: 'Failed to mint to user' });
}
},
);

// In-game ERC20 balance
router.get('/balance', async (req: Request, res: Response) => {
try {
Expand Down
Loading

0 comments on commit 0e2bfd8

Please sign in to comment.