summaryrefslogtreecommitdiff
path: root/constants/contracts.ts
blob: 9c02a4a2fa6b210241bb212b1ebdf0709023c6a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
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];