Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Deploy instant rewards contracts #187

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
311 changes: 311 additions & 0 deletions packages/zevm-app-contracts/.openzeppelin/unknown-7000.json
andresaiello marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,311 @@
{
"manifestVersion": "3.2",
"admin": {
"address": "0x39Fc9A85f79c6C9a49291Efd4127A4f31790aCa9",
"txHash": "0x3039cf4ac44a3ebce0fc46d00d36a6ab9b1d9aadb49349be6389d3f8b30ca680"
},
"proxies": [
{
"address": "0x9A4e8bB5FFD8088ecF1DdE823e97Be8080BD38cb",
"txHash": "0x57b0d69400a636ae9906ffcdc563b511cbaac77dd472593ef8d8c3e26284a35a",
"kind": "transparent"
}
],
"impls": {
"13a169f740030ae647ec8fe7854343f525daae2331d89d270ef7671880e59ae0": {
"address": "0xD4f7204cFde7ED1b00bF1d59269aa0f4e053d9d9",
"txHash": "0x8b45dbe398fa1387ea7aaebf9450756b7f20788114bdb60eed92d8ea3fcec7d1",
"layout": {
"solcVersion": "0.8.20",
"storage": [
{
"label": "_initialized",
"offset": 0,
"slot": "0",
"type": "t_uint8",
"contract": "Initializable",
"src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:63",
"retypedFrom": "bool"
},
{
"label": "_initializing",
"offset": 1,
"slot": "0",
"type": "t_bool",
"contract": "Initializable",
"src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:68"
},
{
"label": "__gap",
"offset": 0,
"slot": "1",
"type": "t_array(t_uint256)50_storage",
"contract": "ContextUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36"
},
{
"label": "__gap",
"offset": 0,
"slot": "51",
"type": "t_array(t_uint256)50_storage",
"contract": "ERC165Upgradeable",
"src": "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol:41"
},
{
"label": "_name",
"offset": 0,
"slot": "101",
"type": "t_string_storage",
"contract": "ERC721Upgradeable",
"src": "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol:25"
},
{
"label": "_symbol",
"offset": 0,
"slot": "102",
"type": "t_string_storage",
"contract": "ERC721Upgradeable",
"src": "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol:28"
},
{
"label": "_owners",
"offset": 0,
"slot": "103",
"type": "t_mapping(t_uint256,t_address)",
"contract": "ERC721Upgradeable",
"src": "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol:31"
},
{
"label": "_balances",
"offset": 0,
"slot": "104",
"type": "t_mapping(t_address,t_uint256)",
"contract": "ERC721Upgradeable",
"src": "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol:34"
},
{
"label": "_tokenApprovals",
"offset": 0,
"slot": "105",
"type": "t_mapping(t_uint256,t_address)",
"contract": "ERC721Upgradeable",
"src": "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol:37"
},
{
"label": "_operatorApprovals",
"offset": 0,
"slot": "106",
"type": "t_mapping(t_address,t_mapping(t_address,t_bool))",
"contract": "ERC721Upgradeable",
"src": "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol:40"
},
{
"label": "__gap",
"offset": 0,
"slot": "107",
"type": "t_array(t_uint256)44_storage",
"contract": "ERC721Upgradeable",
"src": "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol:477"
},
{
"label": "_owner",
"offset": 0,
"slot": "151",
"type": "t_address",
"contract": "OwnableUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22"
},
{
"label": "__gap",
"offset": 0,
"slot": "152",
"type": "t_array(t_uint256)49_storage",
"contract": "OwnableUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94"
},
{
"label": "_pendingOwner",
"offset": 0,
"slot": "201",
"type": "t_address",
"contract": "Ownable2StepUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol:27"
},
{
"label": "__gap",
"offset": 0,
"slot": "202",
"type": "t_array(t_uint256)49_storage",
"contract": "Ownable2StepUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol:70"
},
{
"label": "_hashedName",
"offset": 0,
"slot": "251",
"type": "t_bytes32",
"contract": "EIP712Upgradeable",
"src": "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol:40",
"renamedFrom": "_HASHED_NAME"
},
{
"label": "_hashedVersion",
"offset": 0,
"slot": "252",
"type": "t_bytes32",
"contract": "EIP712Upgradeable",
"src": "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol:42",
"renamedFrom": "_HASHED_VERSION"
},
{
"label": "_name",
"offset": 0,
"slot": "253",
"type": "t_string_storage",
"contract": "EIP712Upgradeable",
"src": "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol:44"
},
{
"label": "_version",
"offset": 0,
"slot": "254",
"type": "t_string_storage",
"contract": "EIP712Upgradeable",
"src": "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol:45"
},
{
"label": "__gap",
"offset": 0,
"slot": "255",
"type": "t_array(t_uint256)48_storage",
"contract": "EIP712Upgradeable",
"src": "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol:204"
},
{
"label": "lastUpdateTimestampByTokenId",
"offset": 0,
"slot": "303",
"type": "t_mapping(t_uint256,t_uint256)",
"contract": "ZetaXP",
"src": "contracts/xp-nft/xpNFT.sol:22"
},
{
"label": "tagByTokenId",
"offset": 0,
"slot": "304",
"type": "t_mapping(t_uint256,t_bytes32)",
"contract": "ZetaXP",
"src": "contracts/xp-nft/xpNFT.sol:23"
},
{
"label": "tokenByUserTag",
"offset": 0,
"slot": "305",
"type": "t_mapping(t_address,t_mapping(t_bytes32,t_uint256))",
"contract": "ZetaXP",
"src": "contracts/xp-nft/xpNFT.sol:24"
},
{
"label": "baseTokenURI",
"offset": 0,
"slot": "306",
"type": "t_string_storage",
"contract": "ZetaXP",
"src": "contracts/xp-nft/xpNFT.sol:27"
},
{
"label": "signerAddress",
"offset": 0,
"slot": "307",
"type": "t_address",
"contract": "ZetaXP",
"src": "contracts/xp-nft/xpNFT.sol:28"
},
{
"label": "_currentTokenId",
"offset": 0,
"slot": "308",
"type": "t_uint256",
"contract": "ZetaXP",
"src": "contracts/xp-nft/xpNFT.sol:31"
}
],
"types": {
"t_address": {
"label": "address",
"numberOfBytes": "20"
},
"t_array(t_uint256)44_storage": {
"label": "uint256[44]",
"numberOfBytes": "1408"
},
"t_array(t_uint256)48_storage": {
"label": "uint256[48]",
"numberOfBytes": "1536"
},
"t_array(t_uint256)49_storage": {
"label": "uint256[49]",
"numberOfBytes": "1568"
},
"t_array(t_uint256)50_storage": {
"label": "uint256[50]",
"numberOfBytes": "1600"
},
"t_bool": {
"label": "bool",
"numberOfBytes": "1"
},
"t_bytes32": {
"label": "bytes32",
"numberOfBytes": "32"
},
"t_mapping(t_address,t_bool)": {
"label": "mapping(address => bool)",
"numberOfBytes": "32"
},
"t_mapping(t_address,t_mapping(t_address,t_bool))": {
"label": "mapping(address => mapping(address => bool))",
"numberOfBytes": "32"
},
"t_mapping(t_address,t_mapping(t_bytes32,t_uint256))": {
"label": "mapping(address => mapping(bytes32 => uint256))",
"numberOfBytes": "32"
},
"t_mapping(t_address,t_uint256)": {
"label": "mapping(address => uint256)",
"numberOfBytes": "32"
},
"t_mapping(t_bytes32,t_uint256)": {
"label": "mapping(bytes32 => uint256)",
"numberOfBytes": "32"
},
"t_mapping(t_uint256,t_address)": {
"label": "mapping(uint256 => address)",
"numberOfBytes": "32"
},
"t_mapping(t_uint256,t_bytes32)": {
"label": "mapping(uint256 => bytes32)",
"numberOfBytes": "32"
},
"t_mapping(t_uint256,t_uint256)": {
"label": "mapping(uint256 => uint256)",
"numberOfBytes": "32"
},
"t_string_storage": {
"label": "string",
"numberOfBytes": "32"
},
"t_uint256": {
"label": "uint256",
"numberOfBytes": "32"
},
"t_uint8": {
"label": "uint8",
"numberOfBytes": "1"
}
},
"namespaces": {}
}
}
}
}
3 changes: 2 additions & 1 deletion packages/zevm-app-contracts/data/addresses.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"zetaSwapBtcInbound": "0x358E2cfC0E16444Ba7D3164Bbeeb6bEA7472c559",
"invitationManager": "0x3649C03C472B698213926543456E9c21081e529d",
"withdrawERC20": "0xa349B9367cc54b47CAb8D09A95836AE8b4D1d84E",
"ZetaXP": "0x6926b6ea978d59a8Ab6aC05486Fd0bED6D15eC29"
"ZetaXP": "0x9A4e8bB5FFD8088ecF1DdE823e97Be8080BD38cb",
"InstantRewards": "0x018412ec1D5bBb864eAe0A4BECaa683052890238"
}
}
}
15 changes: 15 additions & 0 deletions packages/zevm-app-contracts/scripts/explorer.helpers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { run } from "hardhat";

export const verifyContract = async (contractAddress: string, constructorArguments: any[]) => {
// Verification process
console.log(`Verifying contract ${contractAddress}...`);
try {
await run("verify:verify", {
address: contractAddress,
constructorArguments,
});
console.log("Verification successful");
} catch (error) {
console.error("Verification failed:", error);
}
};
36 changes: 36 additions & 0 deletions packages/zevm-app-contracts/scripts/instant-rewards/deploy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { isProtocolNetworkName } from "@zetachain/protocol-contracts";
import { ethers, network } from "hardhat";

import { InstantRewards__factory } from "../../typechain-types";
import { saveAddress } from "../address.helpers";
import { verifyContract } from "../explorer.helpers";

const networkName = network.name;

const signer = "0x1d24d94520B94B26351f6573de5ef9731c48531A";
const owner = "0x1d24d94520B94B26351f6573de5ef9731c48531A";
Comment on lines +10 to +11
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider extracting the signer and owner addresses into environment variables or configuration files.

Hardcoding the signer and owner addresses directly in the script reduces flexibility and maintainability. It is recommended to extract these values into environment variables or configuration files, allowing for easier modification and reuse across different environments.


const deployInstantRewards = async () => {
if (!isProtocolNetworkName(networkName)) throw new Error("Invalid network name");

const InstantRewardsFactory = (await ethers.getContractFactory("InstantRewards")) as InstantRewards__factory;
const InstantRewards = await InstantRewardsFactory.deploy(signer, owner);

await InstantRewards.deployed();

console.log("InstantRewards deployed to:", InstantRewards.address);

saveAddress("InstantRewards", InstantRewards.address, networkName);

await verifyContract(InstantRewards.address, [signer, owner]);
};

const main = async () => {
if (!isProtocolNetworkName(networkName)) throw new Error("Invalid network name");
await deployInstantRewards();
};

main().catch((error) => {
console.error(error);
process.exit(1);
});
Loading
Loading