Skip to content

Instantly share code, notes, and snippets.

View apogiatzis's full-sized avatar
:electron:
Stay awhile and listen.

APogiatzis apogiatzis

:electron:
Stay awhile and listen.
View GitHub Profile
@apogiatzis
apogiatzis / NFT.sol
Created November 24, 2022 01:22
ERC721 Contract for Comp1830
// SPDX-License-Identifier: Unlicensed
pragma solidity >=0.7.0 <0.9.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract Comp1830NFT is ERC721Enumerable, Ownable {
using Strings for uint256;
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
/**
* @title Ballot
* @dev Implements voting process along with vote delegation
*/
contract Ballot {
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
/**
* @title Storage
* @dev Store & retrieve value in a variable
*/
contract Storage {
LOAD CSV WITH HEADERS FROM
"https://gist.githubusercontent.com/apogiatzis/994b23af916ae7ee30665f1e4595739c/raw/20d3f719a734beddb08d3e38c24dac212884e55c/lab3_ex_persons.csv" AS csvLine
MERGE (e:Email {address: csvLine.email})
MERGE (t:Phone {number: csvLine.phone})
CREATE (p:Person {obj_id: csvLine.obj_id, first_name: csvLine.first_name, last_name: csvLine.last_name, date_of_birth: date(csvLine.date_of_birth), occupation: csvLine.occupation, nationality: csvLine.nationality, phone: csvLine.phone, ni_number: csvLine.ni_number})
CREATE (p)-[:HAS_EMAIL]->(e)
CREATE (p)-[:HAS_PHONE]->(t);
LOAD CSV WITH HEADERS FROM
"https://gist.githubusercontent.com/apogiatzis/726e0ed7416b530e40d81bc02ef32543/raw/678931d860273c8b903fa8005dfda1cf7cce7ede/lab3_ex_trusts.csv" AS csvLine
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 4 columns, instead of 3 in line 7.
obj_id,beneficiary,trustor,trustee
b853671b-f275-4865-ba87-4169ff68880d,580fc4ad-8b88-4f4b-9ef1-19ea974eafa3,744b9918-e57b-4c1b-9eed-44ef2318576c,64c496fa-07c1-4880-96f3-1513b14c90f7
5bf01e7b-7741-4906-9548-e2a90607f4c5,8fbe937d-4c5b-4db6-b758-85c955b3f9e1,7d7a8a83-c411-45e7-b814-3a37c8f0a97a,5dffd331-5897-4ad9-bef7-c2c26dbac91a
d5084e8a-9ea8-4607-982c-60954b4cb20d,b105432e-9b15-4321-87d6-64b3bc2d95d9,5a905799-1549-44ce-9870-f3abf87b1360,ca675d70-db39-4afb-a0d8-0d3fc75516ba
77f6be93-5b1c-4d10-8aa6-3a0ea05d0c63,fb1bbdf0-488b-4029-933e-8968a269ec1b,8d5852c9-1380-4bdf-840a-59bb3bf2dba6,2d64a3c6-7992-4057-8159-eb3dda0b54f6
087540b2-f249-479d-b847-7f64cfb54cb5,415f6874-e7ed-4702-92ae-fe1b0814c816,882d6977-8457-4375-84f2-7e7a81c24db9,0389157b-9bf5-44fa-aaac-c9c0e70e194c
bd641739-8a51-4f3b-b9aa-eb22c107f292,89f13862-c714-4679-bced-72a6d0d7c93c,651992d3-dc6d-4cd1-908a-70eb3e639251,39c5ac27-0688-4b5b-a703-c34e342eefc3
6240a372-9b9d-49fe-bfa9-41599e5c5081,60bf640c-352b-4efb-8bc2-682c260f8938,7fb73ab5-dbaf-4dea-9846-a51
We can make this file beautiful and searchable if this error is corrected: It looks like row 10 should actually have 6 columns, instead of 4 in line 9.
obj_id,balance,currency,owners,bank,opened_at
6b05e744-b186-46ce-bed7-d0ab3443b9e2,50956.0,GBP,b853671b-f275-4865-ba87-4169ff68880d,RCB,2014-03-06 02:56:36
38f2a17e-88a9-45ee-acab-8dbfd125241e,0.0,GBP,5bf01e7b-7741-4906-9548-e2a90607f4c5,Credit Suisse AG,2017-11-11 16:00:52
0f0888d9-1cdf-435d-bc74-6c1a7eb05153,0.0,GBP,d5084e8a-9ea8-4607-982c-60954b4cb20d,RCB,2020-07-15 07:19:30
5581edbb-3489-4f4b-b1d5-abb539296cf5,0.0,GBP,77f6be93-5b1c-4d10-8aa6-3a0ea05d0c63,Credit Suisse AG,2015-05-20 05:48:45
4d1d4ff5-9aa5-433c-9755-fb19bf907cd4,0.0,GBP,087540b2-f249-479d-b847-7f64cfb54cb5,RCB,2011-08-02 20:07:09
c39a04f1-a581-4ee2-ada5-bc3967c1e227,0.0,GBP,bd641739-8a51-4f3b-b9aa-eb22c107f292,Credit Suisse AG,2020-03-29 09:01:14
11e2c8ce-eabc-4aa0-84d2-e25257632980,0.0,GBP,6240a372-9b9d-49fe-bfa9-41599e5c5081,CitiBank,2015-05-22 03:46:43
23b4f2a6-31b8-4fbb-8d45-5685a2433d26,0.0,GBP,d1615bfc-014d-4eed-a0fa-4da97d0ee72b,Credit Suisse AG,2018-09-26 14:03:31
7a885967-4f42-4a03-93d2-6f6660f610ff,0.0,GBP,79e77c1a-0bd6-4914-8ac7-
obj_id amount currency sender recipient type timestamp
46cc67d3-7522-4d3b-86aa-fb61074916a8 4402.847864533552 GBP 41aeba1d-729e-4d6d-9d3b-96e70ad3baa5 d0153de6-a181-4a46-8896-cb7d39390fb6 TRANSFER 2022-02-06 15:43:16
db2292e6-504e-4494-b85c-e2361190d77a 4774.258055865538 GBP c031d259-694a-49df-a0ef-a523a04e1a33 da6df937-c734-4b81-bb55-cb074c27368d TRANSFER 2021-04-04 01:13:27
a4041f65-6df2-4cc7-a618-63d86b372ed1 1802.982096175261 GBP f29ac848-8c14-4d3f-a4ec-617e8e4d42a0 4df2d8e9-168c-4076-9969-a1539af41b05 TRANSFER 2016-11-06 15:56:12
67a0c123-dcd4-464f-8568-48614252f838 14374.735437136478 GBP ecda79b8-314b-4cca-924e-2f1e8bd1b749 376e92c8-9852-4a4f-ad52-0b7b4a558bc0 TRANSFER 2021-11-27 04:23:16
ebc2b465-4cb7-4410-af40-360498422935 1962.6293489675907 GBP a28fc8c0-3b89-495a-a993-c8fdfe2649cc 68902c04-4bce-4d4e-ba59-885ce4f489a6 TRANSFER 2021-01-09 06:11:35
241dec60-81d8-4a26-98b9-6c3e7d27af61 888.7481645593303 GBP f457c639-f9cb-4541-bf2f-3b4e3f5ace14 32554a24-12aa-437f-a080-d78a719d1333 TRANSFER 2009-06-04 07:2
obj_id beneficiary director
07b65b1e-1eef-4330-808e-ba762e4ed025 6c5de348-158f-4345-8ee7-f33130471e60 b0dd6b36-93b5-40e5-862c-2878ad96819f
14b1cf28-2469-4413-87a9-8ad59aa0b64e e82c8206-9c24-40ee-abc8-539dc0cc0ab5 764b8ab3-4684-4b4a-88b3-774ef70bee9e
ba3cf8d9-8648-4617-82fc-8daeea4c02a5 5d45879b-343d-4feb-8e27-d0c6a7fec6ab 4614acd8-4087-4595-a03c-20d65bd2afd5
6614dbfe-80a2-4146-a80e-948ac43b93c7 6d0a3f57-0edc-43ce-85ef-82109b12bb3f 5f11e350-81dd-4b3b-ac1e-5286cfb05d5c
2a135d2a-6e28-48bb-b426-f74301cfcb1a 2ee8c178-4546-4c45-b0a4-a4a6db7b1f4f c7b4677b-8216-4311-b9c6-e2e436ab200d
06710a50-b72b-4b56-a4c8-7be01e0b2a7c 29e63a45-f6a4-445f-883c-9d21d93bf070 95a205ec-f2c5-4c7b-9400-aaabb10dfb62
5108bf9c-7a0f-4ec0-bbb9-7760787e0691 03d8ee69-0d39-472d-8932-1c70cf720231 828a98dc-02f4-442a-9f65-6dc484cee4ac
a1edcb56-f36a-4913-89d6-ad83a6c1e24b 415f6874-e7ed-4702-92ae-fe1b0814c816 c2b0ea4a-325b-4664-b75d-d6827390c5aa
860954a3-8fde-4c3b-973b-6d155eddbda7 e82c8206-9c24-40ee-abc8-539dc0cc0ab5 768cd8d7-bd95-4c97-a552-91f29a3ec9
We can make this file beautiful and searchable if this error is corrected: It looks like row 10 should actually have 6 columns, instead of 4 in line 9.
obj_id,balance,currency,owners,bank,opened_at
1ca9586b-a72a-4bdb-8977-6a116ee25efa,0.0,GBP,07b65b1e-1eef-4330-808e-ba762e4ed025,RCB,2009-08-09 21:29:54
8ea99cd8-91c7-4d70-a617-202dbbda9bc2,0.0,GBP,14b1cf28-2469-4413-87a9-8ad59aa0b64e,Credit Suisse AG,2016-08-09 17:14:09
99e9d4b3-dfdd-4e87-a1ae-1d0d6a8a1b49,0.0,GBP,ba3cf8d9-8648-4617-82fc-8daeea4c02a5,CitiBank,2010-05-05 05:06:59
46e3598a-8ffd-4ee7-9d5e-bd45edc69d93,0.0,GBP,6614dbfe-80a2-4146-a80e-948ac43b93c7,CitiBank,2012-10-21 05:33:33
bd7b1d68-636e-4202-bdda-478f4ce952f5,0.0,GBP,2a135d2a-6e28-48bb-b426-f74301cfcb1a,Credit Suisse AG,2012-09-05 22:56:09
ddd26928-1b9b-408e-b17d-077566b6bcce,0.0,GBP,06710a50-b72b-4b56-a4c8-7be01e0b2a7c,Credit Suisse AG,2017-04-06 08:24:15
5408ab38-3ddf-4587-a9de-c3f87d445eca,0.0,GBP,5108bf9c-7a0f-4ec0-bbb9-7760787e0691,CitiBank,2018-03-21 01:48:25
9cd8dff1-3785-46ef-92fd-367aa02600a9,0.0,GBP,a1edcb56-f36a-4913-89d6-ad83a6c1e24b,RCB,2018-03-24 09:08:02
e6c18a15-dc54-4af5-812a-add6d3508cf2,0.0,GBP,860954a3-8fde-4c3b-973b-6d155ed
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 9 columns, instead of 5 in line 7.
obj_id,first_name,last_name,date_of_birth,occupation,nationality,phone,email,ni_number
817c1765-67a0-4df2-bce5-71fd0d262ca5,Emma,Reed,1998-08-15,Architect,Eritrea,+44(0)161 4960764,[email protected],ZZ 42 19 48 T
3e8ec471-fdea-415e-a394-4abe6b1afde2,Diana,Barker,1980-01-01,Insurance claims handler,Bolivia,+441632 960 157,[email protected],ZZ 387784 T
3ad1736b-be49-4bf3-8d0b-6102d942694c,Benjamin,Nelson,1970-12-16,Chief Financial Officer,Saint Helena,+44(0)8081570609,[email protected],ZZ 513933 T
4eac02e6-9be7-4015-ba77-73efea1451e0,Patrick,Roberts,2000-06-26,"Chemist, analytical",Belgium,+44(0)121 496 0871,[email protected],ZZ839894T
89d75914-b4a7-4d4a-a2a7-31f6dcaeda2f,Louise,Green,1996-03-11,Investment analyst,Montserrat,+44(0)29 2018332,[email protected],ZZ711220T
6c5de348-158f-4345-8ee7-f33130471e60,Jonathan,Sutton,1996-08-17,"Scientist, water quality",Falkland Islands (Malvinas),0191 4960339,[email protected],ZZ 515917 T
fe493a19-a827-4646-9aa8-b0cfd365a437,Kate,Yates,1982-12-15,Financ