Skip to content

Commit c85fb27

Browse files
committed
Fixing deploy farm
1 parent 671f7d6 commit c85fb27

9 files changed

Lines changed: 53 additions & 21 deletions

File tree

‎.gitignore‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ npm-debug.log
2828

2929
# local env variables
3030
.env
31+
.env.*
32+
env.*
3133

3234
# truffle build directory
3335
build/
@@ -59,6 +61,5 @@ artifacts
5961

6062
#local data
6163
db
62-
env.json
6364
/etherscan
6465
.openzeppelin

‎contracts/GenesisFarm.sol‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ contract GenesisFarm is Ownable, IManager {
3333
IEverdragons2Genesis everdragons2_,
3434
uint256 maxForSale_,
3535
uint256 maxClaimable_,
36-
uint16 price_,
36+
uint256 price_,
3737
uint256 saleStartAt_
3838
) {
3939
everdragons2Genesis = everdragons2_;
4040
require(everdragons2Genesis.mintEnded() == false, "Not an E2 token");
41-
require(saleStartAt_ > block.timestamp, "Invalid sale start time");
41+
require(saleStartAt_ > 0, "Invalid sale start time");
4242
maxForSale = maxForSale_; // 250
4343
maxClaimable = maxClaimable_; // 350
4444
_nextTokenId = maxClaimable_ + 1;
45-
price = uint256(price_).mul(10**18);
45+
price = price_;
4646
saleStartAt = saleStartAt_;
4747
}
4848

‎export/deployed.json‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
22
"1337": {
3-
"Everdragons2Genesis": "0x22753E4264FDDc6181dc7cce468904A80a363E44",
4-
"GenesisFarm": "0xA7c59f010700930003b33aB25a7a0679C860f29c"
3+
"Everdragons2Genesis": "0xffa7CA1AEEEbBc30C874d32C7e22F052BbEa0429",
4+
"GenesisFarm": "0x3aAde2dCD2Df6a8cAc689EE797591b2913658659"
5+
},
6+
"80001": {
7+
"Everdragons2Genesis": "0xeC3a1a418203827AD24391F6f44D4d60223270Df",
8+
"GenesisFarm": "0x87Ab04CC86A72349e63021413F461539b14C130c"
59
}
6-
}
10+
}

‎hardhat.config.js‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ require("@nomiclabs/hardhat-waffle");
22
require("@nomiclabs/hardhat-etherscan");
33
require('@openzeppelin/hardhat-upgrades');
44
// require("hardhat-gas-reporter");
5+
const requireOrMock = require('require-or-mock')
56

6-
let env = require('./env.json');
7+
let env = requireOrMock('env.js', {
8+
9+
});
710

811
if (process.env.GAS_REPORT === 'yes') {
912
require("hardhat-gas-reporter");
@@ -48,11 +51,11 @@ module.exports = {
4851
},
4952
rinkeby: {
5053
url: `https://rinkeby.infura.io/v3/${env.infuraApiKey}`,
51-
accounts: [env.privateKey]
54+
accounts: [env.privateKeyTestnet]
5255
},
5356
goerli: {
5457
url: `https://goerli.infura.io/v3/${env.infuraApiKey}`,
55-
accounts: [env.privateKey]
58+
accounts: [env.privateKeyTestnet]
5659
},
5760
ethereum: {
5861
url: `https://mainnet.infura.io/v3/${env.infuraApiKey}`,
@@ -62,19 +65,19 @@ module.exports = {
6265
url: "https://data-seed-prebsc-1-s1.binance.org:8545",
6366
chainId: 97,
6467
gasPrice: 20000000000,
65-
accounts: [env.privateKey]
68+
accounts: [env.privateKeyTestnet]
6669
},
6770
bsc: {
68-
url: "https://bsc-dataseed.binance.org/",
71+
url: "https://bsc-dataseed.binance.org",
6972
chainId: 56,
7073
gasPrice: 20000000000,
7174
accounts: [env.privateKey]
7275
},
7376
mumbai: {
74-
url: 'https://rpc-mumbai.maticvigil.com',
77+
url: 'https://rpc-mumbai.matic.today',
7578
chainId: 80001,
7679
gasPrice: 20000000000,
77-
accounts: [env.privateKey]
80+
accounts: [env.privateKeyTestnet]
7881
},
7982
matic: {
8083
url: `https://rpc-mainnet.maticvigil.com/v1/${env.maticvigilKey}`,

‎require-or-mock-config.js‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
'env.js': {
3+
mainnetAlchemyKey: 'some-fake-api',
4+
privateKey: '0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a',
5+
etherscanKey: 'some-fake-api',
6+
bscscanKey: 'some-fake-api',
7+
maticvigilKey: 'some-fake-api',
8+
infuraApiKey: 'some-fake-api',
9+
coinMarketCapAPIKey: 'some-fake-api',
10+
polygonscanAPIKey: 'some-fake-api'
11+
}
12+
}

‎scripts/deploy-e2genesis.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ async function main() {
2020

2121
console.log(
2222
"Deploying contracts with the account:",
23-
deployer.address
23+
deployer.address,
24+
'to', network
2425
);
2526

2627
console.log("Account balance:", (await deployer.getBalance()).toString());

‎scripts/deploy-genesisfarm.js‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ const requireOrMock = require('require-or-mock')
55

66
const {
77
initEthers,
8-
getTimestamp
8+
getTimestamp,
9+
normalize
910
} = require('../test/helpers')
1011

1112
const DeployUtils = require('./lib/DeployUtils')
@@ -33,9 +34,18 @@ async function main() {
3334
const everdragons2Genesis = Everdragons2Genesis.attach(deployed[chainId].Everdragons2Genesis)
3435

3536
const GenesisFarm = await ethers.getContractFactory("GenesisFarm")
36-
const genesisFarm = await GenesisFarm.deploy(everdragons2Genesis.address, 250, 600, 500,
37+
38+
const price = normalize(network === 'matic' ? 500 : 0.1)
39+
const delay = network === 'matic' ? 3600 : 10
40+
41+
const genesisFarm = await GenesisFarm.deploy(
42+
everdragons2Genesis.address,
43+
250,
44+
600,
45+
price,
3746
// sale start after one hour
38-
(await getTimestamp()) + 3600)
47+
(await getTimestamp()) + delay
48+
)
3949
await genesisFarm.deployed()
4050
console.log("GenesisFarm deployed to:", genesisFarm.address);
4151

‎test/GenesisFarm.test.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ describe("GenesisFarm", async function () {
3737
}
3838
everdragons2Genesis = await upgrades.deployProxy(Everdragons2Genesis, []);
3939
await everdragons2Genesis.deployed()
40-
genesisFarm = await GenesisFarm.deploy(everdragons2Genesis.address,
40+
genesisFarm = await GenesisFarm.deploy(
41+
everdragons2Genesis.address,
4142
25, // maxForSale
4243
10, // maxClaimable
43-
10, // price in MATIC
44+
normalize(10), // price in MATIC
4445
saleStartAt)
4546
await genesisFarm.deployed()
4647
await everdragons2Genesis.setManager(genesisFarm.address)

‎test/helpers.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const Helpers = {
4444
},
4545

4646
normalize(val, n = 18) {
47-
return '' + val + '0'.repeat(n)
47+
return ('' + val + '0'.repeat(n)).replace(/^0+/, '').replace(/\./, '')
4848
}
4949

5050
}

0 commit comments

Comments
 (0)