-
Notifications
You must be signed in to change notification settings - Fork 61
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
Eth price syncer using Chainlink oracle #731
base: main
Are you sure you want to change the base?
Changes from all commits
2c7f37d
e6de468
39f3c3f
b48b61c
0318c55
96c319f
fbc0a6c
2d06772
0d9603c
89c17b0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,8 @@ | ||||||
-- CreateTable | ||||||
CREATE TABLE "eth_price" ( | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume we are going to save the price in USD, right? Then let's better rename it:
Suggested change
|
||||||
"id" SERIAL NOT NULL, | ||||||
"price" DECIMAL(65,30) NOT NULL, | ||||||
"timestamp" TIMESTAMP(3) NOT NULL, | ||||||
|
||||||
CONSTRAINT "eth_price_pkey" PRIMARY KEY ("id") | ||||||
); |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -301,6 +301,14 @@ model OverallStats { | |||||
@@map("overall_stats") | ||||||
} | ||||||
|
||||||
model ETHPrice { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
id Int @id @default(autoincrement()) | ||||||
price Decimal | ||||||
timestamp DateTime | ||||||
|
||||||
@@map("eth_price") | ||||||
} | ||||||
|
||||||
// NextAuth.js Models | ||||||
// NOTE: When using postgresql, mysql or sqlserver, | ||||||
// uncomment the @db.Text annotations below | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -83,6 +83,9 @@ export const env = createEnv({ | |||||
.url() | ||||||
.default("http://localhost:4318"), | ||||||
|
||||||
// ETH Price | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
ETH_PRICE_SYNCER_CRON_PATTERN: z.string().default("0 * * * *"), | ||||||
|
||||||
/** | ||||||
* ===================== | ||||||
* STORAGE PROVIDERS | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,311 @@ | ||
export const EAC = [ | ||
{ | ||
inputs: [ | ||
{ internalType: "address", name: "_aggregator", type: "address" }, | ||
{ | ||
internalType: "address", | ||
name: "_accessController", | ||
type: "address", | ||
}, | ||
], | ||
stateMutability: "nonpayable", | ||
type: "constructor", | ||
}, | ||
{ | ||
anonymous: false, | ||
inputs: [ | ||
{ | ||
indexed: true, | ||
internalType: "int256", | ||
name: "current", | ||
type: "int256", | ||
}, | ||
{ | ||
indexed: true, | ||
internalType: "uint256", | ||
name: "roundId", | ||
type: "uint256", | ||
}, | ||
{ | ||
indexed: false, | ||
internalType: "uint256", | ||
name: "updatedAt", | ||
type: "uint256", | ||
}, | ||
], | ||
name: "AnswerUpdated", | ||
type: "event", | ||
}, | ||
{ | ||
anonymous: false, | ||
inputs: [ | ||
{ | ||
indexed: true, | ||
internalType: "uint256", | ||
name: "roundId", | ||
type: "uint256", | ||
}, | ||
{ | ||
indexed: true, | ||
internalType: "address", | ||
name: "startedBy", | ||
type: "address", | ||
}, | ||
{ | ||
indexed: false, | ||
internalType: "uint256", | ||
name: "startedAt", | ||
type: "uint256", | ||
}, | ||
], | ||
name: "NewRound", | ||
type: "event", | ||
}, | ||
{ | ||
anonymous: false, | ||
inputs: [ | ||
{ | ||
indexed: true, | ||
internalType: "address", | ||
name: "from", | ||
type: "address", | ||
}, | ||
{ | ||
indexed: true, | ||
internalType: "address", | ||
name: "to", | ||
type: "address", | ||
}, | ||
], | ||
name: "OwnershipTransferRequested", | ||
type: "event", | ||
}, | ||
{ | ||
anonymous: false, | ||
inputs: [ | ||
{ | ||
indexed: true, | ||
internalType: "address", | ||
name: "from", | ||
type: "address", | ||
}, | ||
{ | ||
indexed: true, | ||
internalType: "address", | ||
name: "to", | ||
type: "address", | ||
}, | ||
], | ||
name: "OwnershipTransferred", | ||
type: "event", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "acceptOwnership", | ||
outputs: [], | ||
stateMutability: "nonpayable", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "accessController", | ||
outputs: [ | ||
{ | ||
internalType: "contract AccessControllerInterface", | ||
name: "", | ||
type: "address", | ||
}, | ||
], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "aggregator", | ||
outputs: [{ internalType: "address", name: "", type: "address" }], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [{ internalType: "address", name: "_aggregator", type: "address" }], | ||
name: "confirmAggregator", | ||
outputs: [], | ||
stateMutability: "nonpayable", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "decimals", | ||
outputs: [{ internalType: "uint8", name: "", type: "uint8" }], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "description", | ||
outputs: [{ internalType: "string", name: "", type: "string" }], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [{ internalType: "uint256", name: "_roundId", type: "uint256" }], | ||
name: "getAnswer", | ||
outputs: [{ internalType: "int256", name: "", type: "int256" }], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [{ internalType: "uint80", name: "_roundId", type: "uint80" }], | ||
name: "getRoundData", | ||
outputs: [ | ||
{ internalType: "uint80", name: "roundId", type: "uint80" }, | ||
{ internalType: "int256", name: "answer", type: "int256" }, | ||
{ internalType: "uint256", name: "startedAt", type: "uint256" }, | ||
{ internalType: "uint256", name: "updatedAt", type: "uint256" }, | ||
{ internalType: "uint80", name: "answeredInRound", type: "uint80" }, | ||
], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [{ internalType: "uint256", name: "_roundId", type: "uint256" }], | ||
name: "getTimestamp", | ||
outputs: [{ internalType: "uint256", name: "", type: "uint256" }], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "latestAnswer", | ||
outputs: [{ internalType: "int256", name: "", type: "int256" }], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "latestRound", | ||
outputs: [{ internalType: "uint256", name: "", type: "uint256" }], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "latestRoundData", | ||
outputs: [ | ||
{ internalType: "uint80", name: "roundId", type: "uint80" }, | ||
{ internalType: "int256", name: "answer", type: "int256" }, | ||
{ internalType: "uint256", name: "startedAt", type: "uint256" }, | ||
{ internalType: "uint256", name: "updatedAt", type: "uint256" }, | ||
{ internalType: "uint80", name: "answeredInRound", type: "uint80" }, | ||
], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "latestTimestamp", | ||
outputs: [{ internalType: "uint256", name: "", type: "uint256" }], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "owner", | ||
outputs: [{ internalType: "address payable", name: "", type: "address" }], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [{ internalType: "uint16", name: "", type: "uint16" }], | ||
name: "phaseAggregators", | ||
outputs: [ | ||
{ | ||
internalType: "contract AggregatorV2V3Interface", | ||
name: "", | ||
type: "address", | ||
}, | ||
], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "phaseId", | ||
outputs: [{ internalType: "uint16", name: "", type: "uint16" }], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [{ internalType: "address", name: "_aggregator", type: "address" }], | ||
name: "proposeAggregator", | ||
outputs: [], | ||
stateMutability: "nonpayable", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "proposedAggregator", | ||
outputs: [ | ||
{ | ||
internalType: "contract AggregatorV2V3Interface", | ||
name: "", | ||
type: "address", | ||
}, | ||
], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [{ internalType: "uint80", name: "_roundId", type: "uint80" }], | ||
name: "proposedGetRoundData", | ||
outputs: [ | ||
{ internalType: "uint80", name: "roundId", type: "uint80" }, | ||
{ internalType: "int256", name: "answer", type: "int256" }, | ||
{ internalType: "uint256", name: "startedAt", type: "uint256" }, | ||
{ internalType: "uint256", name: "updatedAt", type: "uint256" }, | ||
{ internalType: "uint80", name: "answeredInRound", type: "uint80" }, | ||
], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "proposedLatestRoundData", | ||
outputs: [ | ||
{ internalType: "uint80", name: "roundId", type: "uint80" }, | ||
{ internalType: "int256", name: "answer", type: "int256" }, | ||
{ internalType: "uint256", name: "startedAt", type: "uint256" }, | ||
{ internalType: "uint256", name: "updatedAt", type: "uint256" }, | ||
{ internalType: "uint80", name: "answeredInRound", type: "uint80" }, | ||
], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: "address", | ||
name: "_accessController", | ||
type: "address", | ||
}, | ||
], | ||
name: "setController", | ||
outputs: [], | ||
stateMutability: "nonpayable", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [{ internalType: "address", name: "_to", type: "address" }], | ||
name: "transferOwnership", | ||
outputs: [], | ||
stateMutability: "nonpayable", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "version", | ||
outputs: [{ internalType: "uint256", name: "", type: "uint256" }], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
] as const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.