From 003f0b0a77c747ebf2f50b6843d8964335a0a9e2 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Fri, 4 Dec 2020 22:33:43 +0000 Subject: [PATCH] update contracts --- .gitignore | 2 +- .openzeppelin/project.json | 25 ++++++++++++++++++ contracts/DarkForestCore.sol | 50 ++++++++++++++++++++++++++++++------ last_updated.txt | 2 +- package.json | 7 ++--- 5 files changed, 73 insertions(+), 13 deletions(-) create mode 100644 .openzeppelin/project.json diff --git a/.gitignore b/.gitignore index 617bcf1..1d2c24c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,5 @@ yarn-error.log *.env .env.prod -.openzeppelin +.openzeppelin/dev-*.json .openzeppelin/.session diff --git a/.openzeppelin/project.json b/.openzeppelin/project.json new file mode 100644 index 0000000..b935e7d --- /dev/null +++ b/.openzeppelin/project.json @@ -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 +} diff --git a/contracts/DarkForestCore.sol b/contracts/DarkForestCore.sol index 1d58065..b936622 100644 --- a/contracts/DarkForestCore.sol +++ b/contracts/DarkForestCore.sol @@ -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 @@ -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]); } @@ -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" diff --git a/last_updated.txt b/last_updated.txt index cc04cbe..408e9a0 100644 --- a/last_updated.txt +++ b/last_updated.txt @@ -1 +1 @@ -last updated: Wed Dec 2 18:41:59 UTC 2020 +last updated: Fri Dec 4 22:33:43 UTC 2020 diff --git a/package.json b/package.json index d7f48a2..5fb5fd8 100644 --- a/package.json +++ b/package.json @@ -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" } }