Skip to content

Commit

Permalink
update contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Dec 4, 2020
1 parent 78d8f28 commit 003f0b0
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ yarn-error.log
*.env
.env.prod

.openzeppelin
.openzeppelin/dev-*.json
.openzeppelin/.session
25 changes: 25 additions & 0 deletions .openzeppelin/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"manifestVersion": "2.2",
"contracts": {
"DarkForestCore": "DarkForestCore"
},
"dependencies": {},
"name": "darkforest-eth",
"version": "1.0.0",
"compiler": {
"compilerSettings": {
"optimizer": {
"enabled": true,
"runs": "200"
}
},
"typechain": {
"enabled": false
},
"manager": "openzeppelin",
"solcVersion": "0.6.12",
"artifactsDir": "build/contracts",
"contractsDir": "contracts"
},
"telemetryOptIn": false
}
50 changes: 42 additions & 8 deletions contracts/DarkForestCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,45 @@ contract DarkForestCore is Initializable, DarkForestStorageV1 {
}
}

function bulkGetPlanetsByIds(uint256[] calldata ids)
public
view
returns (DarkForestTypes.Planet[] memory ret)
{
ret = new DarkForestTypes.Planet[](ids.length);

for (uint256 i = 0; i < ids.length; i++) {
ret[i] = planets[ids[i]];
}
}

function bulkGetPlanetArrivalsByIds(uint256[] calldata ids)
public
view
returns (DarkForestTypes.ArrivalData[][] memory)
{
DarkForestTypes.ArrivalData[][] memory ret
= new DarkForestTypes.ArrivalData[][](ids.length);

for (uint256 i = 0; i < ids.length; i++) {
ret[i] = getPlanetArrivals(ids[i]);
}

return ret;
}

function bulkGetPlanetsExtendedInfoByIds(uint256[] calldata ids)
public
view
returns (DarkForestTypes.PlanetExtendedInfo[] memory ret)
{
ret = new DarkForestTypes.PlanetExtendedInfo[](ids.length);

for (uint256 i = 0; i < ids.length; i++) {
ret[i] = planetsExtendedInfo[ids[i]];
}
}

function bulkGetPlanets(uint256 startIdx, uint256 endIdx)
public
view
Expand Down Expand Up @@ -252,10 +291,8 @@ contract DarkForestCore is Initializable, DarkForestStorageV1 {
returns (DarkForestTypes.ArrivalData[][] memory)
{
// return array of planets corresponding to planetIds[startIdx] through planetIds[endIdx - 1]


DarkForestTypes.ArrivalData[][] memory ret
= new DarkForestTypes.ArrivalData[][](endIdx - startIdx);
DarkForestTypes.ArrivalData[][] memory ret
= new DarkForestTypes.ArrivalData[][](endIdx - startIdx);
for (uint256 i = startIdx; i < endIdx; i++) {
ret[i - startIdx] = getPlanetArrivals(planetIds[i]);
}
Expand Down Expand Up @@ -570,10 +607,7 @@ contract DarkForestCore is Initializable, DarkForestStorageV1 {
}
}

function buyHat(uint256 _location)
public
payable
{
function buyHat(uint256 _location) public payable {
require(
planetsExtendedInfo[_location].isInitialized == true,
"Planet is not initialized"
Expand Down
2 changes: 1 addition & 1 deletion last_updated.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
last updated: Wed Dec 2 18:41:59 UTC 2020
last updated: Fri Dec 4 22:33:43 UTC 2020
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
"ts-node": "^8.10.2"
},
"scripts": {
"deploy:dev": "NODE_ENV=development ts-node src/deploy.ts",
"deploy:prod": "NODE_ENV=production ts-node src/deploy.ts",
"test": "oz compile --optimizer on && mocha --exit --recursive test --timeout 25000"
"deploy:dev": "yarn run compile && NODE_ENV=development ts-node src/deploy.ts",
"deploy:prod": "yarn run compile && NODE_ENV=production ts-node src/deploy.ts",
"compile": "oz compile --optimizer on",
"test": "yarn run compile && mocha --exit --recursive test --timeout 25000"
}
}

0 comments on commit 003f0b0

Please sign in to comment.