summaryrefslogtreecommitdiff
path: root/constants/contracts.ts
diff options
context:
space:
mode:
Diffstat (limited to 'constants/contracts.ts')
-rw-r--r--constants/contracts.ts109
1 files changed, 109 insertions, 0 deletions
diff --git a/constants/contracts.ts b/constants/contracts.ts
new file mode 100644
index 0000000..9c02a4a
--- /dev/null
+++ b/constants/contracts.ts
@@ -0,0 +1,109 @@
+import { ETHEREUM_NETWORK } from "../constants";
+
+type ContractAddresses = Record<string, string>;
+type NetworkKey = keyof typeof ETHEREUM_NETWORK;
+
+export const ERC20_ABI = [
+ {
+ type: "function",
+ name: "balanceOf",
+ inputs: [{ name: "owner", type: "address" }],
+ outputs: [{ name: "", type: "uint256" }],
+ stateMutability: "view",
+ },
+ {
+ type: "function",
+ name: "decimals",
+ inputs: [],
+ outputs: [{ name: "", type: "uint8" }],
+ stateMutability: "view",
+ },
+ {
+ type: "function",
+ name: "transfer",
+ inputs: [
+ { name: "to", type: "address" },
+ { name: "value", type: "uint256" },
+ ],
+ outputs: [{ name: "", type: "bool" }],
+ stateMutability: "nonpayable",
+ },
+ {
+ type: "event",
+ name: "Transfer",
+ inputs: [
+ { name: "from", type: "address", indexed: true },
+ { name: "to", type: "address", indexed: true },
+ { name: "value", type: "uint256", indexed: false },
+ ],
+ anonymous: false,
+ },
+];
+
+export const AZIMUTH_ABI = [
+ "function getOwner(uint32 _point) view returns (address)",
+ "function getOwnedPoints(address _whose) view returns (uint32[])",
+];
+
+const CONTRACT_ADDRESSES: Record<NetworkKey, ContractAddresses> = {
+ MAINNET: {
+ azimuth: "0x223c067f8cf28ae173ee5cafea60ca44c335fecb",
+ ecliptic: "0x33EeCbf908478C10614626A9D304bfe18B78DD73",
+ polls: "0x0",
+ claims: "0x0",
+ linearStarRelease: "0x86cd9cd0992f04231751e3761de45cecea5d1801",
+ conditionalStarRelease: "0x8c241098c3d3498fe1261421633fd57986d74aea",
+ urbit_L2: "0x1111111111111111111111111111111111111111",
+ usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606EB48",
+ usdt: "0xdac17f958d2ee523a2206206994597c13d831ec7",
+ dai: "0x6b175474e89094c44da98b954eedeac495271d0f",
+ link: "0x514910771af9ca656af840dff83e8264ecf986ca", // ?
+ },
+ SEPOLIA: {
+ azimuth: "0xF07cD672D61453c29138c8db5b44fC9FA84811B5",
+ ecliptic: "0x2E35a61198C383212CeF06C22f1E81B6b097135C",
+ polls: "0x3A3a06199Dc537FB56A6975A8B12A8eD7fCbf897",
+ claims: "0xdB164DBEF321e7DE938809fE35A5A8A928c4F4df",
+ linearStarRelease: "0x0",
+ conditionalStarRelease: "0x0",
+ urbit_L2: "0x0",
+ usdc: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
+ usdt: "0xaa8e23fb1079ea71e0a56f48a2aa51851d8433d0",
+ dai: "0x776b6fc2ed15d6bb5fc32e0c89de68683118c62a",
+ link: "0x779877A7B0D9E8603169DdbD7836e478b4624789",
+ },
+ LOCAL: {
+ azimuth: "0x0",
+ ecliptic: "0x0",
+ polls: "0x0",
+ claims: "0x0",
+ linearStarRelease: "0x0",
+ conditionalStarRelease: "0x0",
+ urbit_L2: "0x0",
+ usdc: "0x0",
+ usdt: "0x0",
+ dai: "0x0",
+ link: "0x0",
+ },
+};
+
+const mapNetworkStringToKey = (network: string): NetworkKey => {
+ switch (network) {
+ case "mainnet":
+ return "MAINNET";
+ case "sepolia":
+ return "SEPOLIA";
+ case "local":
+ return "LOCAL";
+ default:
+ return "SEPOLIA";
+ }
+};
+
+const currentNetworkKey = mapNetworkStringToKey(
+ process.env.EXPO_PUBLIC_NETWORK!,
+);
+
+console.log("currentNetworkKey", currentNetworkKey);
+
+export const CONTRACT = CONTRACT_ADDRESSES[currentNetworkKey];