-
Notifications
You must be signed in to change notification settings - Fork 1
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
Staker nft #56
base: main
Are you sure you want to change the base?
Staker nft #56
Changes from 58 commits
5291f0d
7df4674
cd9d089
374959f
ad74121
7f08d0f
cf08e74
d81fd92
6360ff6
7619ec3
f14646a
b8f0d9d
fe916ae
e4cb766
0e49439
bd1da72
aa04774
bd04a8d
bb4f080
66a9f7a
f38ae06
ab48f9c
cb546f9
ca6a0fe
51d1db4
9685c7d
6323319
6a70148
74a6da6
dcc1ed6
a7f4a35
f0f34ad
819ba5b
89626b6
26e55df
a9b16b0
9484328
593fe78
c4e19bb
32ff9f0
04fdd81
6752562
f09fea6
bf36159
cdb5aa8
7c90149
9b9580d
626a788
c72c67c
9dad196
6c6c940
9d01fbd
a6bae24
e2ca984
837fc30
64d290a
3c70890
210e60d
868c1a2
e6bc4ca
41162a1
d33e29d
478f8c0
9af2ade
ee4774f
c11e91b
a28cd39
4499a7a
9728522
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
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. @elclandestin0 : Can you remove these changes from your branch? You should be able to do this using the following commands (not tested): git checkout main -- bindings/WrappedNativeToken/WrappedNativeToken.go
git add bindings/WrappedNativeToken/WrappedNativeToken.go
git commit # type an appropriate commit message into your editor, and hit save I assume you didn't touch the Do this for all bindings you didn't touch, please. |
Large diffs are not rendered by default.
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. You need to also commit the corresponding changes to |
Large diffs are not rendered by default.
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. This was taken from here: https://github.com/pipermerriam/ethereum-datetime/blob/master/contracts/DateTime.sol But it has been taken without attribution. I am not ok with this. Either import it as a dependency or put a comment in this file explaining where the code was taken from. 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 would prefer to import it - is there a reason we can't do so (e.g. solidity version issues in the original file)? 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. Fairpoint. Thanks for adding. 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. From our slack conversation: it's best to keep our compiler uniform! The original file has |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,219 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.24; | ||
|
||
/** | ||
* @title DateTime | ||
* @author @pipermerriam on GitHub | ||
* @notice This Solidity library is not written by Game7. It is written by @pipermerriam. | ||
* You can find the full code here: https://github.com/pipermerriam/ethereum-datetime/blob/master/contracts/DateTime.sol | ||
* Modifications made: | ||
* - Changed into a library | ||
* - Solidity version changed to fit our compiler | ||
*/ | ||
|
||
|
||
library DateTime { | ||
/* | ||
* Date and Time utilities for Ethereum contracts | ||
* | ||
*/ | ||
struct _DateTime { | ||
uint16 year; | ||
uint8 month; | ||
uint8 day; | ||
uint8 hour; | ||
uint8 minute; | ||
uint8 second; | ||
uint8 weekday; | ||
} | ||
|
||
uint constant DAY_IN_SECONDS = 86400; | ||
uint constant YEAR_IN_SECONDS = 31536000; | ||
uint constant LEAP_YEAR_IN_SECONDS = 31622400; | ||
|
||
uint constant HOUR_IN_SECONDS = 3600; | ||
uint constant MINUTE_IN_SECONDS = 60; | ||
|
||
uint16 constant ORIGIN_YEAR = 1970; | ||
|
||
function isLeapYear(uint16 year) internal pure returns (bool) { | ||
if (year % 4 != 0) { | ||
return false; | ||
} | ||
if (year % 100 != 0) { | ||
return true; | ||
} | ||
if (year % 400 != 0) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
function leapYearsBefore(uint year) internal pure returns (uint) { | ||
year -= 1; | ||
return year / 4 - year / 100 + year / 400; | ||
} | ||
|
||
function getDaysInMonth(uint8 month, uint16 year) internal pure returns (uint8) { | ||
if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) { | ||
return 31; | ||
} else if (month == 4 || month == 6 || month == 9 || month == 11) { | ||
return 30; | ||
} else if (isLeapYear(year)) { | ||
return 29; | ||
} else { | ||
return 28; | ||
} | ||
} | ||
|
||
function parseTimestamp(uint timestamp) internal pure returns (_DateTime memory dt) { | ||
uint secondsAccountedFor = 0; | ||
uint buf; | ||
uint8 i; | ||
|
||
// Year | ||
dt.year = getYear(timestamp); | ||
buf = leapYearsBefore(dt.year) - leapYearsBefore(ORIGIN_YEAR); | ||
|
||
secondsAccountedFor += LEAP_YEAR_IN_SECONDS * buf; | ||
secondsAccountedFor += YEAR_IN_SECONDS * (dt.year - ORIGIN_YEAR - buf); | ||
|
||
// Month | ||
uint secondsInMonth; | ||
for (i = 1; i <= 12; i++) { | ||
secondsInMonth = DAY_IN_SECONDS * getDaysInMonth(i, dt.year); | ||
if (secondsInMonth + secondsAccountedFor > timestamp) { | ||
dt.month = i; | ||
break; | ||
} | ||
secondsAccountedFor += secondsInMonth; | ||
} | ||
|
||
// Day | ||
for (i = 1; i <= getDaysInMonth(dt.month, dt.year); i++) { | ||
if (DAY_IN_SECONDS + secondsAccountedFor > timestamp) { | ||
dt.day = i; | ||
break; | ||
} | ||
secondsAccountedFor += DAY_IN_SECONDS; | ||
} | ||
|
||
// Hour | ||
dt.hour = getHour(timestamp); | ||
|
||
// Minute | ||
dt.minute = getMinute(timestamp); | ||
|
||
// Second | ||
dt.second = getSecond(timestamp); | ||
|
||
// Day of week | ||
dt.weekday = getWeekday(timestamp); | ||
} | ||
|
||
function getYear(uint timestamp) internal pure returns (uint16) { | ||
uint secondsAccountedFor = 0; | ||
uint16 year; | ||
uint numLeapYears; | ||
|
||
// Year | ||
year = uint16(ORIGIN_YEAR + timestamp / YEAR_IN_SECONDS); | ||
numLeapYears = leapYearsBefore(year) - leapYearsBefore(ORIGIN_YEAR); | ||
|
||
secondsAccountedFor += LEAP_YEAR_IN_SECONDS * numLeapYears; | ||
secondsAccountedFor += YEAR_IN_SECONDS * (year - ORIGIN_YEAR - numLeapYears); | ||
|
||
while (secondsAccountedFor > timestamp) { | ||
if (isLeapYear(uint16(year - 1))) { | ||
secondsAccountedFor -= LEAP_YEAR_IN_SECONDS; | ||
} else { | ||
secondsAccountedFor -= YEAR_IN_SECONDS; | ||
} | ||
year -= 1; | ||
} | ||
return year; | ||
} | ||
|
||
function getMonth(uint timestamp) internal pure returns (uint8) { | ||
return parseTimestamp(timestamp).month; | ||
} | ||
|
||
function getDay(uint timestamp) internal pure returns (uint8) { | ||
return parseTimestamp(timestamp).day; | ||
} | ||
|
||
function getHour(uint timestamp) internal pure returns (uint8) { | ||
return uint8((timestamp / HOUR_IN_SECONDS) % 24); | ||
} | ||
|
||
function getMinute(uint timestamp) internal pure returns (uint8) { | ||
return uint8((timestamp / MINUTE_IN_SECONDS) % 60); | ||
} | ||
|
||
function getSecond(uint timestamp) internal pure returns (uint8) { | ||
return uint8(timestamp % 60); | ||
} | ||
|
||
function getWeekday(uint timestamp) internal pure returns (uint8) { | ||
return uint8((timestamp / DAY_IN_SECONDS + 4) % 7); | ||
} | ||
|
||
function toTimestamp(uint16 year, uint8 month, uint8 day) internal pure returns (uint timestamp) { | ||
return toTimestamp(year, month, day, 0, 0, 0); | ||
} | ||
|
||
function toTimestamp(uint16 year, uint8 month, uint8 day, uint8 hour) internal pure returns (uint timestamp) { | ||
return toTimestamp(year, month, day, hour, 0, 0); | ||
} | ||
|
||
function toTimestamp(uint16 year, uint8 month, uint8 day, uint8 hour, uint8 minute) internal pure returns (uint timestamp) { | ||
return toTimestamp(year, month, day, hour, minute, 0); | ||
} | ||
|
||
function toTimestamp(uint16 year, uint8 month, uint8 day, uint8 hour, uint8 minute, uint8 second) internal pure returns (uint timestamp) { | ||
uint16 i; | ||
|
||
// Year | ||
for (i = ORIGIN_YEAR; i < year; i++) { | ||
if (isLeapYear(i)) { | ||
timestamp += LEAP_YEAR_IN_SECONDS; | ||
} else { | ||
timestamp += YEAR_IN_SECONDS; | ||
} | ||
} | ||
|
||
// Month | ||
uint8[12] memory monthDayCounts = [ | ||
31, // January | ||
isLeapYear(year) ? 29 : 28, // February | ||
31, // March | ||
30, // April | ||
31, // May | ||
30, // June | ||
31, // July | ||
31, // August | ||
30, // September | ||
31, // October | ||
30, // November | ||
31 // December | ||
]; | ||
|
||
for (i = 1; i < month; i++) { | ||
timestamp += DAY_IN_SECONDS * monthDayCounts[i - 1]; | ||
} | ||
|
||
// Day | ||
timestamp += DAY_IN_SECONDS * (day - 1); | ||
|
||
// Hour | ||
timestamp += HOUR_IN_SECONDS * hour; | ||
|
||
// Minute | ||
timestamp += MINUTE_IN_SECONDS * minute; | ||
|
||
// Second | ||
timestamp += second; | ||
|
||
return timestamp; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,70 @@ | ||
import { HardhatUserConfig } from "hardhat/config"; | ||
import "@nomicfoundation/hardhat-toolbox"; | ||
import * as dotenv from 'dotenv' | ||
import { ChainId, NetworkExplorer, NetworkName, rpcUrls } from "./constants/network"; | ||
import "@nomicfoundation/hardhat-foundry"; | ||
import { HardhatUserConfig } from 'hardhat/config'; | ||
import '@nomicfoundation/hardhat-toolbox'; | ||
import * as dotenv from 'dotenv'; | ||
import { ChainId, NetworkExplorer, NetworkName, rpcUrls } from './constants/network'; | ||
import '@nomicfoundation/hardhat-foundry'; | ||
|
||
dotenv.config() | ||
dotenv.config(); | ||
|
||
const yes = ["true", "t", "yes", "y", "1"] | ||
const GAS_PROFILER = yes.includes((process.env.GAS_PROFILER || "").toLowerCase()); | ||
const yes = ['true', 't', 'yes', 'y', '1']; | ||
const GAS_PROFILER = yes.includes((process.env.GAS_PROFILER || '').toLowerCase()); | ||
|
||
const { | ||
ETHSCAN_API_KEY, | ||
ARB_SCAN_API_KEY, | ||
} = process.env | ||
const { ETHSCAN_API_KEY, ARB_SCAN_API_KEY } = process.env; | ||
|
||
const config: HardhatUserConfig = { | ||
solidity: "0.8.24", | ||
gasReporter: { | ||
enabled: GAS_PROFILER, | ||
}, | ||
etherscan: { | ||
apiKey: { | ||
[NetworkName.Ethereum]: ETHSCAN_API_KEY || '', | ||
[NetworkName.ArbitrumOne]: ARB_SCAN_API_KEY || '', | ||
[NetworkName.ArbitrumSepolia]: ARB_SCAN_API_KEY || '', | ||
solidity: { | ||
version: '0.8.24', | ||
}, | ||
customChains: [ | ||
{ | ||
network: NetworkName.Game7OrbitArbSepolia, | ||
chainId: ChainId.Game7OrbitArbSepolia, | ||
urls: { | ||
apiURL: `${NetworkExplorer.Game7OrbitArbSepolia}/api`, | ||
browserURL: NetworkExplorer.Game7OrbitArbSepolia, | ||
}, | ||
}, | ||
{ | ||
network: NetworkName.Game7OrbitBaseSepolia, | ||
chainId: ChainId.Game7OrbitBaseSepolia, | ||
urls: { | ||
apiURL: `${NetworkExplorer.Game7OrbitBaseSepolia}/api`, | ||
browserURL: NetworkExplorer.Game7OrbitBaseSepolia, | ||
}, | ||
}, | ||
], | ||
}, | ||
networks: { | ||
[NetworkName.Ethereum]: { | ||
chainId: ChainId.Ethereum, | ||
url: rpcUrls[ChainId.Ethereum], | ||
gasReporter: { | ||
enabled: GAS_PROFILER, | ||
}, | ||
[NetworkName.ArbitrumOne]: { | ||
chainId: ChainId.ArbitrumOne, | ||
url: rpcUrls[ChainId.ArbitrumOne], | ||
etherscan: { | ||
apiKey: { | ||
[NetworkName.Ethereum]: ETHSCAN_API_KEY || '', | ||
[NetworkName.ArbitrumOne]: ARB_SCAN_API_KEY || '', | ||
[NetworkName.ArbitrumSepolia]: ARB_SCAN_API_KEY || '', | ||
}, | ||
customChains: [ | ||
{ | ||
network: NetworkName.Game7OrbitArbSepolia, | ||
chainId: ChainId.Game7OrbitArbSepolia, | ||
urls: { | ||
apiURL: `${NetworkExplorer.Game7OrbitArbSepolia}/api`, | ||
browserURL: NetworkExplorer.Game7OrbitArbSepolia, | ||
}, | ||
}, | ||
{ | ||
network: NetworkName.Game7OrbitBaseSepolia, | ||
chainId: ChainId.Game7OrbitBaseSepolia, | ||
urls: { | ||
apiURL: `${NetworkExplorer.Game7OrbitBaseSepolia}/api`, | ||
browserURL: NetworkExplorer.Game7OrbitBaseSepolia, | ||
}, | ||
}, | ||
], | ||
}, | ||
[NetworkName.Game7OrbitArbSepolia]: { | ||
url: rpcUrls[ChainId.Game7OrbitArbSepolia], | ||
chainId: ChainId.Game7OrbitArbSepolia, | ||
networks: { | ||
[NetworkName.Ethereum]: { | ||
chainId: ChainId.Ethereum, | ||
url: rpcUrls[ChainId.Ethereum], | ||
}, | ||
[NetworkName.ArbitrumOne]: { | ||
chainId: ChainId.ArbitrumOne, | ||
url: rpcUrls[ChainId.ArbitrumOne], | ||
}, | ||
[NetworkName.Game7OrbitArbSepolia]: { | ||
url: rpcUrls[ChainId.Game7OrbitArbSepolia], | ||
chainId: ChainId.Game7OrbitArbSepolia, | ||
}, | ||
[NetworkName.Game7OrbitBaseSepolia]: { | ||
url: rpcUrls[ChainId.Game7OrbitBaseSepolia], | ||
chainId: ChainId.Game7OrbitBaseSepolia, | ||
}, | ||
[NetworkName.ArbitrumSepolia]: { | ||
url: rpcUrls[ChainId.ArbitrumSepolia], | ||
chainId: ChainId.ArbitrumSepolia, | ||
}, | ||
}, | ||
[NetworkName.Game7OrbitBaseSepolia]: { | ||
url: rpcUrls[ChainId.Game7OrbitBaseSepolia], | ||
chainId: ChainId.Game7OrbitBaseSepolia, | ||
}, | ||
[NetworkName.ArbitrumSepolia]: { | ||
url: rpcUrls[ChainId.ArbitrumSepolia], | ||
chainId: ChainId.ArbitrumSepolia, | ||
} | ||
}, | ||
}; | ||
|
||
export default config; |
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.
These are the only bindings that should remain committed.