├── Design ├── Algorand_to_Ethereum.png ├── ConverterFour.png ├── ConverterOne.png ├── ConverterThree.png ├── ConverterTwo.png ├── Ethereum_to_Algorand.png └── readme.md ├── LICENSE ├── LinkContracts ├── Design.png ├── License.txt ├── README.md ├── contracts │ ├── ChainlinkContract.sol │ ├── ChainlinkContract_flat.sol │ ├── LinkTransfer.sol │ └── converter_contract.sol └── pseudocode.sol ├── Node ├── ChainLink-NodeValidator.sol └── README.md ├── README.md ├── TestNetLink ├── ABI.sol ├── Chainlink_flat.sol ├── License.txt ├── README.md ├── chainlink.json ├── chainlink_metadata.json ├── link.sol └── rinkbeyABI.sol ├── WhitePaper ├── WhitePaper (1).pdf └── readme.md ├── converter-backend ├── .gitignore ├── Procfile ├── README.md ├── app.ts ├── config │ └── default.ts ├── db │ └── index.ts ├── model │ └── model.ts ├── nodemon.json ├── package-lock.json ├── package.json ├── src │ └── controller.ts └── tsconfig.json ├── converter-frontend ├── .gitignore ├── README.md ├── config-overrides.js ├── package-lock.json ├── package.json ├── public │ ├── .DS_Store │ ├── _redirects │ ├── browserconfig.xml │ ├── index.html │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ ├── robots.txt │ └── site.webmanifest └── src │ ├── .DS_Store │ ├── App.jsx │ ├── assets │ ├── c.png │ └── correct.png │ ├── components │ ├── .DS_Store │ ├── AlertModal.jsx │ ├── Explorer-Component │ │ ├── EachExplorerData.jsx │ │ ├── EachExplorerData.scss │ │ ├── ExplorerList.jsx │ │ └── ExplorerList.scss │ ├── Navigation │ │ ├── MobileNav.jsx │ │ ├── MobileNav.scss │ │ └── NavBar.jsx │ ├── Scroll.jsx │ ├── Search-Input │ │ ├── Search-Input.jsx │ │ └── Search-Input.scss │ └── WalletConfirmation.jsx │ ├── contract-ABI │ └── chainlink.json │ ├── index.jsx │ ├── pages │ ├── ConverterPage │ │ └── Converter.jsx │ ├── ExplorerPage │ │ └── ExplorerPage.jsx │ ├── LandingPage │ │ ├── LandingPage.jsx │ │ └── LandingPage.scss │ └── MainPage.jsx │ ├── store │ ├── reducers.js │ └── stores.js │ ├── styles │ ├── .DS_Store │ ├── converter.css │ ├── index.css │ └── reset.css │ └── utils │ ├── algorand-transaction-confirmation.js │ └── contract-interact.js └── goLink ├── LINK-743260106 ├── icon.png └── icon.svg ├── config.py ├── decentralize.py ├── link.png ├── main.py ├── readme.md ├── run.py └── util.py /Design/Algorand_to_Ethereum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bhaney44/ChainLinkHackathonSpring2022/78b53a6ed1a44ca64961707c8dacbeb8c97a662d/Design/Algorand_to_Ethereum.png -------------------------------------------------------------------------------- /Design/ConverterFour.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bhaney44/ChainLinkHackathonSpring2022/78b53a6ed1a44ca64961707c8dacbeb8c97a662d/Design/ConverterFour.png -------------------------------------------------------------------------------- /Design/ConverterOne.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bhaney44/ChainLinkHackathonSpring2022/78b53a6ed1a44ca64961707c8dacbeb8c97a662d/Design/ConverterOne.png -------------------------------------------------------------------------------- /Design/ConverterThree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bhaney44/ChainLinkHackathonSpring2022/78b53a6ed1a44ca64961707c8dacbeb8c97a662d/Design/ConverterThree.png -------------------------------------------------------------------------------- /Design/ConverterTwo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bhaney44/ChainLinkHackathonSpring2022/78b53a6ed1a44ca64961707c8dacbeb8c97a662d/Design/ConverterTwo.png -------------------------------------------------------------------------------- /Design/Ethereum_to_Algorand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bhaney44/ChainLinkHackathonSpring2022/78b53a6ed1a44ca64961707c8dacbeb8c97a662d/Design/Ethereum_to_Algorand.png -------------------------------------------------------------------------------- /Design/readme.md: -------------------------------------------------------------------------------- 1 | # Design 2 | 3 | This directory provides designs and drawings for the fundemental architecture for the Chainlink Converter. 4 | The designs help to structure and integrate the frontend, backend, and connected software technologies. 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2022 Brian Haney, Samuel Tosin, David Kazeem, Eugene Nnamdi 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /LinkContracts/Design.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bhaney44/ChainLinkHackathonSpring2022/78b53a6ed1a44ca64961707c8dacbeb8c97a662d/LinkContracts/Design.png -------------------------------------------------------------------------------- /LinkContracts/License.txt: -------------------------------------------------------------------------------- 1 | Copyright 2022 Chainlink Converters 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /LinkContracts/README.md: -------------------------------------------------------------------------------- 1 | ## Directory for LINK Smart Contracts 2 | 3 |   4 | 5 | ### Overview On Smart Contracts 6 | 7 | A smart contract is a new type of technology at the confluence of contracts and blockchains. The term "smart contract" is defined in wide variance among blockchain developers and professionals. For example, the Founder of Ethereum, Vitalik Buterin defines smart contract as, “systems which automatically move digital assets according to arbitrary pre-specified rules.”[1](https://ethereum.org/en/whitepaper/) Another example, the former MIT professor and current Commissioner of the SEC Gary Gensler, adopts Nick Szabo’s definition of smart contract, “A set of promises, specified in digital form, including protocols within which the parties perform on these promises.”[2](https://ocw.mit.edu/courses/15-s12-blockchain-and-money-fall-2018/resources/session-6-smart-contracts-and-dapps/) 8 | 9 |   10 | 11 | ### Outline on LINK Contracts 12 | 13 | This repository includes Chainlink Smart Contracts used in the development of the Chainlink Converter. 14 | 15 | - The [main smart contract](https://github.com/Bhaney44/ChainLinkHackathonSpring2022/blob/main/LinkContracts/contracts/ChainlinkContract.sol) for the converter validates data from Algorand on Ethereum and is processed using a Chainlink node. 16 | ![Screenshot (16)](https://user-images.githubusercontent.com/85407620/170778488-7b165cc1-91e5-4f0c-b109-edff2092ffdf.png) 17 | 18 | - The node validates the data generating a Decentralized Oralcle Network link Algorand and Ethereum through Chainlink. 19 | 20 | - Using an interactable [LinkTransfer Contract](https://github.com/Bhaney44/ChainLinkHackathonSpring2022/blob/main/LinkContracts/contracts/LinkTransfer.sol) that can inherit from the [TestNet Link On Rinkeby](https://github.com/Bhaney44/ChainLinkHackathonSpring2022/blob/main/TestNetLink/link.sol), we can also transfer LINK to the address recieved from the [main smart contract](https://github.com/Bhaney44/ChainLinkHackathonSpring2022/blob/main/LinkContracts/contracts/ChainlinkContract.sol) 21 | - ![Screenshot (17)](https://user-images.githubusercontent.com/85407620/170778849-f0bd1910-b268-46ef-b9fe-70ed6d7b4890.png) 22 | 23 |   24 | 25 | ### Files Used 26 | - [ChainlinkContract.sol](https://github.com/Bhaney44/ChainLinkHackathonSpring2022/blob/main/LinkContracts/contracts/ChainlinkContract.sol) 27 | - [ChainlinkContract_flat.sol](https://github.com/Bhaney44/ChainLinkHackathonSpring2022/blob/main/LinkContracts/contracts/ChainlinkContract_flat.sol) 28 | - [LinkTransfer.sol](https://github.com/Bhaney44/ChainLinkHackathonSpring2022/blob/main/LinkContracts/contracts/LinkTransfer.sol) 29 |   30 | 31 | ### LINK CONTRACT VERIFIED ON [RINKEBY TEST NETWORK](https://rinkeby.etherscan.io/address/0x334cdcf3cc39cf0d84d6adb10961400fe204f8bc) 32 |   33 | 34 | ### Liscense 35 | - [MIT](https://spdx.org/licenses/MIT.html) 36 | -------------------------------------------------------------------------------- /LinkContracts/contracts/ChainlinkContract.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.7; 3 | 4 | import "@chainlink/contracts/src/v0.8/ChainlinkClient.sol"; 5 | 6 | contract ConverterResponse is ChainlinkClient { 7 | using Chainlink for Chainlink.Request; 8 | 9 | bytes public data; 10 | string public algo_address; 11 | uint256 public amount; 12 | 13 | constructor( 14 | ) { 15 | setChainlinkToken(0xa591AFBC1A81EA1c61edeFa3A36D54f50Ca05Cad); 16 | setChainlinkOracle(0x9f8f7c4dCF80Babff1081089F44A89619E82A211); 17 | } 18 | 19 | function requestAddressAndAmount( 20 | ) 21 | public 22 | { 23 | bytes32 specId = "cc6f897a15734e49bc41f21fce26fd28"; 24 | uint256 payment = 0; 25 | Chainlink.Request memory req = buildChainlinkRequest(specId, address(this), this.fulfillBytes.selector); 26 | req.add("eth_address", "0x4F03c13d9727AAF5ED7382F9A507b4109A5b23C6"); 27 | sendOperatorRequest(req, payment); 28 | } 29 | 30 | event RequestFulfilled( 31 | bytes32 indexed requestId, 32 | bytes indexed data, 33 | uint256 amount 34 | ); 35 | 36 | function fulfillBytes( 37 | bytes32 requestId, 38 | bytes memory bytesData, 39 | uint256 _amount 40 | ) 41 | public 42 | recordChainlinkFulfillment(requestId) 43 | { 44 | emit RequestFulfilled(requestId, bytesData, _amount); 45 | data = bytesData; 46 | algo_address = string(data); 47 | amount = _amount; 48 | } 49 | 50 | } 51 | 52 | // https://rinkeby.etherscan.io/address/0x334cdcf3cc39cf0d84d6adb10961400fe204f8bc 53 | -------------------------------------------------------------------------------- /LinkContracts/contracts/LinkTransfer.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.7; 4 | 5 | import "https://github.com/Bhaney44/ChainLinkHackathonSpring2022/blob/main/TestNetLink/link.sol"; 6 | 7 | 8 | contract LinkTransfer is Chainlink { 9 | address public owner; 10 | uint256 public balance; 11 | 12 | event TransferReceived(address _from, uint _amount); 13 | event TransferSent(address _from, address _destAddr, uint _amount); 14 | 15 | constructor() { 16 | owner = msg.sender; 17 | } 18 | 19 | receive() payable external { 20 | balance += msg.value; 21 | emit TransferReceived(msg.sender, msg.value); 22 | } 23 | 24 | 25 | function transferERC20(IERC20 token, address to, uint256 amount) public { 26 | require(msg.sender == owner, "Only owner can withdraw funds"); 27 | uint256 LINKbalance = token.balanceOf(address(this)); 28 | require(amount <= LINKbalance, "balance is low"); 29 | token.transfer(to, amount); 30 | emit TransferSent(msg.sender, to, amount); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /LinkContracts/contracts/converter_contract.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache2.0 2 | pragma solidity ^0.8.0; 3 | 4 | // * 5 | import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"; 6 | 7 | 8 | contract Converter is ERC20{ 9 | 10 | // Source account that sends Link to recipient 11 | address payable sourceAccount; 12 | 13 | // Ethereum address of user 14 | address payable[] public recipient; 15 | 16 | // variable to temporarily store amount of Link to be sent 17 | uint public amount; 18 | 19 | // constructor to initialize params... 20 | constructor (address recipient, uint amount){ 21 | sourceAccount = payable(msg.sender); 22 | recipient = recipient; 23 | amount = 0; 24 | 25 | } 26 | 27 | /// modifier to allow sourceAccount own some methods 28 | modifier onlyOwner() { 29 | require(msg.sender == sourceAccount); 30 | _; 31 | } 32 | 33 | 34 | /// function that sends goLink to the address(recipient) 35 | 36 | function transferFrom(address sourceAccount, address recipient, uint amount) public virtual override returns (bool) { 37 | address sourceAccount = _msgSender(); 38 | _transfer(sourceAccount, recipient, amount); 39 | return true; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /LinkContracts/pseudocode.sol: -------------------------------------------------------------------------------- 1 | // Copyright Brian Haney, Samuel Tosin, David Kazeem, and Eugene Nnamdi 2022 2 | // Apache License 3 | // Backend architecture prototyping 4 | 5 | // Purpose 6 | // The goal here is to build a smart contract that sends assets based on two parameters. 7 | // The first parameter is a user entered address. 8 | // The second parameter is a user entered amount. 9 | // This pseudocode is intended for logical development only. 10 | // This pseudocode is not intended for use or deployment. 11 | 12 | // Software version 13 | pragma solidity 0.8.7; 14 | 15 | // Logic for contract zero 16 | ///////////////////////////////// 17 | contract Converter_Zero{ 18 | address payable reciever; 19 | unit public amount = 0 20 | modifier reciever(address){ 21 | address payable reciever 22 | } 23 | modifier amount(unit){ 24 | unit public amount 25 | } 26 | function convert() { 27 | address payable reciever; 28 | unit public amount = amount 29 | } 30 | 31 | } 32 | ///////////////////////////////// 33 | 34 | // Logic for contract one 35 | ///////////////////////////////// 36 | contract Converter_One{ 37 | // Reciever and amount variables 38 | reciever = user_address_entry 39 | amount = user_amount_entry 40 | // Sends assets 41 | function send(address receiver, uint amount) public { 42 | if (amount > balances[msg.sender]) 43 | revert InsufficientBalance({ 44 | requested: amount, 45 | available: balances[msg.sender] 46 | }); 47 | balances[msg.sender] -= amount; 48 | balances[receiver] += amount; 49 | emit Sent(msg.sender, receiver, amount); 50 | } 51 | } 52 | ///////////////////////////////// 53 | -------------------------------------------------------------------------------- /Node/ChainLink-NodeValidator.sol: -------------------------------------------------------------------------------- 1 | //SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.7; 3 | 4 | import "@chainlink/contracts/src/v0.8/ChainlinkClient.sol"; 5 | 6 | contract GenericLargeResponse is ChainlinkClient { 7 | using Chainlink for Chainlink.Request; 8 | 9 | 10 | bytes public data; 11 | string public algo_address; 12 | uint256 public amount; 13 | 14 | constructor( 15 | ) { 16 | setChainlinkToken(0x01BE23585060835E02B77ef475b0Cc51aA1e0709); 17 | setChainlinkOracle(0x9f8f7c4dCF80Babff1081089F44A89619E82A211); 18 | } 19 | 20 | 21 | function requestAddressAndAmount( 22 | ) 23 | public 24 | { 25 | bytes32 specId = "cc6f897a15734e49bc41f21fce26fd28"; 26 | uint256 payment = 0; 27 | Chainlink.Request memory req = buildChainlinkRequest(specId, address(this), this.fulfillBytes.selector); 28 | req.add("eth_address", "0x2f318C334780961FB129D2a6c30D0763d9a5C340"); 29 | sendOperatorRequest(req, payment); 30 | } 31 | 32 | event RequestFulfilled( 33 | bytes32 indexed requestId, 34 | bytes indexed data, 35 | uint256 amount 36 | ); 37 | 38 | 39 | function fulfillBytes( 40 | bytes32 requestId, 41 | bytes memory bytesData, 42 | uint256 _amount 43 | ) 44 | public 45 | recordChainlinkFulfillment(requestId) 46 | { 47 | emit RequestFulfilled(requestId, bytesData, _amount); 48 | data = bytesData; 49 | algo_address = string(data); 50 | amount = _amount; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /Node/README.md: -------------------------------------------------------------------------------- 1 | # Chainlink node data validation 2 | 3 | This directory is for files relating to validating Algorand data on the Ethereum blockchain. 4 | The validation process utilizes a Chainlink node to inform a smart contract for asset conversion. 5 | 6 | We tapped the [block-farms.io](https://block-farms.io/) Chainlink node service which can connect any private or public, premium or free API endpoint and securely host the external adapter that our smart contract requires. 7 | 8 | The Chainlink node service enables us to tap data that the smart contract requires to process a payment. 9 | 10 | ``` 11 | curl -X POST -H "Content-type: application/json" -d '{"eth_address":"0x2f318C334780961FB129D2a6c30D0763d9a5C340"}' 'https://chainlink-backend.herokuapp.com/explorer/transaction' 12 | ``` 13 | 14 | The data from this curl request is made available to the Smart Contract. 15 | 16 | ``` 17 | //SPDX-License-Identifier: MIT 18 | pragma solidity ^0.8.7; 19 | 20 | import "@chainlink/contracts/src/v0.8/ChainlinkClient.sol"; 21 | 22 | contract GenericLargeResponse is ChainlinkClient { 23 | using Chainlink for Chainlink.Request; 24 | 25 | 26 | bytes public data; 27 | string public algo_address; 28 | uint256 public amount; 29 | 30 | constructor( 31 | ) { 32 | setChainlinkToken(0x01BE23585060835E02B77ef475b0Cc51aA1e0709); 33 | setChainlinkOracle(0x9f8f7c4dCF80Babff1081089F44A89619E82A211); 34 | } 35 | 36 | function requestAddressAndAmount( 37 | ) 38 | public 39 | { 40 | bytes32 specId = "cc6f897a15734e49bc41f21fce26fd28"; 41 | uint256 payment = 0; 42 | Chainlink.Request memory req = buildChainlinkRequest(specId, address(this), this.fulfillBytes.selector); 43 | req.add("eth_address", "0x2f318C334780961FB129D2a6c30D0763d9a5C340"); 44 | sendOperatorRequest(req, payment); 45 | } 46 | 47 | event RequestFulfilled( 48 | bytes32 indexed requestId, 49 | bytes indexed data, 50 | uint256 amount 51 | ); 52 | 53 | function fulfillBytes( 54 | bytes32 requestId, 55 | bytes memory bytesData, 56 | uint256 _amount 57 | ) 58 | public 59 | recordChainlinkFulfillment(requestId) 60 | { 61 | emit RequestFulfilled(requestId, bytesData, _amount); 62 | data = bytesData; 63 | algo_address = string(data); 64 | amount = _amount; 65 | } 66 | 67 | } 68 | ``` 69 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Chainlink Converter 2 | 3 | Screen Shot 2022-05-27 at 11 01 57 AM 4 | 5 | 6 | # Overview 7 | 8 | Linking blockchains is a hard problem, with a great solution – Chainlink. Chainlink is a series of Decentralized Oracle Networks (DONs), which are information systems maintained by a committee of nodes.[[1]](https://chain.link/whitepaper) DONs act as powerful abstraction layers, offering interfaces for smart contracts, and decentralized off-chain computing resources. Building with Chainlink, this Project provides a new solution to the interoperability problem, which refers to the ability of blockchains to seamlessly integrate with one another. 9 | 10 | Repository made for the Spring 2022 [ChainLink Hackathon](https://chain.link/hackathon). View our [Demo on YouTube](https://www.youtube.com/watch?v=s-b9t9b8WFk). Hackathon White Paper available on [GitHub](https://github.com/Bhaney44/ChainLinkHackathonSpring2022) and [SSRN](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4116942). Check out our [TestNet Demo on Netifly](https://chainlink-converter.netlify.app/). 11 | 12 | # Problem 13 | How do we create an interchain protocol between Ethereum and Algorand? The problem requires using a Chainlink node for data control, allowing for interchain data transmission, validation, and processing. Additionally, the problem requires creating a collatoral form of LINK on Algorand to allow for cross chain conversions. The collatoralized LINK will allow Chainlink smart contracts to recieve data from Algorand enabling Chainlink smart contracts to use Algorand data in automating asset distributions on Ethereum. 14 | 15 | # Solution 16 | Screen Shot 2022-05-25 at 1 28 12 AM 17 | 18 | Invent a converter for Algorand and Ethereum using Chainlink. The converter will allow interoperability between the two blockchains. A keystone to the converter is goLink. goLink allows for LINK transactions on the Algorand blockcahin, while the Chainlink Converter allows for asset movement between the Algorand and Ethereum blockchains. The Converter processes data from the Algorand blockchain which is sent to a Chainlink node for validation and then processed by a smart contract for on-chain distribution of LINK on Ethereum. Thus, Chainlink allows for the converter to operate in bi-lateral fashion, from Ethereum to Algorand and visa versa. As such, the Chainlink Converter strives to solve the interoperability problem between Algorand and Ethereum for Chainlink. 19 | 20 | # goLink 21 | 22 | The token goLink is validated LINK on Algorand. We launched goLink on both the Algorand MainNet and TestNet. 23 | 24 | [Algorand MainNet goLink](https://algoexplorer.io/asset/743260106) | [Algorand TestNet goLink](https://testnet.algoexplorer.io/asset/89483596) 25 | 26 | LINK Logo added to Algorand Network via [Pull Request #465](https://github.com/tinymanorg/asa-list/pull/465). 27 | 28 | Screen Shot 2022-05-25 at 9 25 23 AM 29 | 30 | # Value 31 | 32 | Chainklink Converters is designed to create value in DeFi and for DAOs through a software as a service model. For DeFi, creating interoperable systems helps projects grow their asset value with interoperable capability and by creating opportunity for cross chain arbitrage bots to improve market efficiencies across networks. For DAOs, the Converter allows for L2 DAOs to grow beyong a single blockchain which creates value through diversification and functional capabilities. For example, a DAO may wish to leverage DeFi on Ethereum, but choose to use Algorand for governance given the different offerings of the L1 blockchains. Our interchain software services using the Chainlink Converter may be made open to the public, or reserved for specific DeFi or DAO clientele. 33 | 34 | Screen Shot 2022-05-26 at 4 48 26 PM 35 | 36 | 37 | # Contributors 38 | - [Samuel Tosin](https://github.com/samuellyworld) 39 | - [David Kazeem](https://github.com/davonjagah) 40 | - [Brian Haney](https://github.com/bhaney44) 41 | - [Eugene Nnamdi](https://github.com/eugenennamdi) 42 | 43 | # Developer Resources 44 | [Chainlink: Deploy Your First Smart Contract](https://docs.chain.link/docs/deploy-your-first-contract/) 45 | 46 | [Chainlink: Consuming Data Feeds](https://docs.chain.link/docs/consuming-data-feeds/) 47 | 48 | [Chainlink: Getting Help](https://docs.chain.link/docs/getting-help/) 49 | 50 | [Chainlink: Acquire testnet LINK](https://docs.chain.link/docs/acquire-link/) 51 | 52 | [Chainlink: Running a Chainlink Node](https://docs.chain.link/docs/running-a-chainlink-node/) 53 | 54 | [Chainlink: Fullfilling Requests](https://docs.chain.link/docs/fulfilling-requests/) 55 | 56 | [Chainlink: Configuring Chainlink Nodes](https://docs.chain.link/docs/configuration-variables/) 57 | 58 | [Chainlink: Building External Adapters](https://docs.chain.link/docs/developers/) 59 | 60 | [Chainlink: Bridges: Adding External Adapters to Nodes](https://docs.chain.link/docs/node-operators/) 61 | 62 | [Chainlink: Webhook Jobs](https://docs.chain.link/docs/jobs/types/webhook/) 63 | 64 | [Chainlink: Building and Using External Adapters](https://blog.chain.link/build-and-use-external-adapters/) 65 | 66 | [Open Zeppelin: ERC 20](https://docs.openzeppelin.com/contracts/4.x/erc20) 67 | 68 | [Algorand: Create your Own Coin on TestNet](https://developer.algorand.org/tutorials/create-laylacoin/) 69 | 70 | [Algorand: Py-Algorand-SDK](https://github.com/algorand/py-algorand-sdk) 71 | 72 | [Algorand: Js-Algorand-SDK](https://github.com/algorand/js-algorand-sdk) 73 | 74 | -------------------------------------------------------------------------------- /TestNetLink/ABI.sol: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "string", 6 | "name": "name_", 7 | "type": "string" 8 | }, 9 | { 10 | "internalType": "string", 11 | "name": "symbol_", 12 | "type": "string" 13 | } 14 | ], 15 | "stateMutability": "nonpayable", 16 | "type": "constructor" 17 | }, 18 | { 19 | "anonymous": false, 20 | "inputs": [ 21 | { 22 | "indexed": true, 23 | "internalType": "address", 24 | "name": "owner", 25 | "type": "address" 26 | }, 27 | { 28 | "indexed": true, 29 | "internalType": "address", 30 | "name": "spender", 31 | "type": "address" 32 | }, 33 | { 34 | "indexed": false, 35 | "internalType": "uint256", 36 | "name": "value", 37 | "type": "uint256" 38 | } 39 | ], 40 | "name": "Approval", 41 | "type": "event" 42 | }, 43 | { 44 | "anonymous": false, 45 | "inputs": [ 46 | { 47 | "indexed": true, 48 | "internalType": "address", 49 | "name": "from", 50 | "type": "address" 51 | }, 52 | { 53 | "indexed": true, 54 | "internalType": "address", 55 | "name": "to", 56 | "type": "address" 57 | }, 58 | { 59 | "indexed": false, 60 | "internalType": "uint256", 61 | "name": "value", 62 | "type": "uint256" 63 | } 64 | ], 65 | "name": "Transfer", 66 | "type": "event" 67 | }, 68 | { 69 | "inputs": [ 70 | { 71 | "internalType": "address", 72 | "name": "owner", 73 | "type": "address" 74 | }, 75 | { 76 | "internalType": "address", 77 | "name": "spender", 78 | "type": "address" 79 | } 80 | ], 81 | "name": "allowance", 82 | "outputs": [ 83 | { 84 | "internalType": "uint256", 85 | "name": "", 86 | "type": "uint256" 87 | } 88 | ], 89 | "stateMutability": "view", 90 | "type": "function" 91 | }, 92 | { 93 | "inputs": [ 94 | { 95 | "internalType": "address", 96 | "name": "spender", 97 | "type": "address" 98 | }, 99 | { 100 | "internalType": "uint256", 101 | "name": "amount", 102 | "type": "uint256" 103 | } 104 | ], 105 | "name": "approve", 106 | "outputs": [ 107 | { 108 | "internalType": "bool", 109 | "name": "", 110 | "type": "bool" 111 | } 112 | ], 113 | "stateMutability": "nonpayable", 114 | "type": "function" 115 | }, 116 | { 117 | "inputs": [ 118 | { 119 | "internalType": "address", 120 | "name": "account", 121 | "type": "address" 122 | } 123 | ], 124 | "name": "balanceOf", 125 | "outputs": [ 126 | { 127 | "internalType": "uint256", 128 | "name": "", 129 | "type": "uint256" 130 | } 131 | ], 132 | "stateMutability": "view", 133 | "type": "function" 134 | }, 135 | { 136 | "inputs": [], 137 | "name": "decimals", 138 | "outputs": [ 139 | { 140 | "internalType": "uint8", 141 | "name": "", 142 | "type": "uint8" 143 | } 144 | ], 145 | "stateMutability": "view", 146 | "type": "function" 147 | }, 148 | { 149 | "inputs": [ 150 | { 151 | "internalType": "address", 152 | "name": "spender", 153 | "type": "address" 154 | }, 155 | { 156 | "internalType": "uint256", 157 | "name": "subtractedValue", 158 | "type": "uint256" 159 | } 160 | ], 161 | "name": "decreaseAllowance", 162 | "outputs": [ 163 | { 164 | "internalType": "bool", 165 | "name": "", 166 | "type": "bool" 167 | } 168 | ], 169 | "stateMutability": "nonpayable", 170 | "type": "function" 171 | }, 172 | { 173 | "inputs": [ 174 | { 175 | "internalType": "address", 176 | "name": "spender", 177 | "type": "address" 178 | }, 179 | { 180 | "internalType": "uint256", 181 | "name": "addedValue", 182 | "type": "uint256" 183 | } 184 | ], 185 | "name": "increaseAllowance", 186 | "outputs": [ 187 | { 188 | "internalType": "bool", 189 | "name": "", 190 | "type": "bool" 191 | } 192 | ], 193 | "stateMutability": "nonpayable", 194 | "type": "function" 195 | }, 196 | { 197 | "inputs": [], 198 | "name": "name", 199 | "outputs": [ 200 | { 201 | "internalType": "string", 202 | "name": "", 203 | "type": "string" 204 | } 205 | ], 206 | "stateMutability": "view", 207 | "type": "function" 208 | }, 209 | { 210 | "inputs": [], 211 | "name": "symbol", 212 | "outputs": [ 213 | { 214 | "internalType": "string", 215 | "name": "", 216 | "type": "string" 217 | } 218 | ], 219 | "stateMutability": "view", 220 | "type": "function" 221 | }, 222 | { 223 | "inputs": [], 224 | "name": "totalSupply", 225 | "outputs": [ 226 | { 227 | "internalType": "uint256", 228 | "name": "", 229 | "type": "uint256" 230 | } 231 | ], 232 | "stateMutability": "view", 233 | "type": "function" 234 | }, 235 | { 236 | "inputs": [ 237 | { 238 | "internalType": "address", 239 | "name": "to", 240 | "type": "address" 241 | }, 242 | { 243 | "internalType": "uint256", 244 | "name": "amount", 245 | "type": "uint256" 246 | } 247 | ], 248 | "name": "transfer", 249 | "outputs": [ 250 | { 251 | "internalType": "bool", 252 | "name": "", 253 | "type": "bool" 254 | } 255 | ], 256 | "stateMutability": "nonpayable", 257 | "type": "function" 258 | }, 259 | { 260 | "inputs": [ 261 | { 262 | "internalType": "address", 263 | "name": "from", 264 | "type": "address" 265 | }, 266 | { 267 | "internalType": "address", 268 | "name": "to", 269 | "type": "address" 270 | }, 271 | { 272 | "internalType": "uint256", 273 | "name": "amount", 274 | "type": "uint256" 275 | } 276 | ], 277 | "name": "transferFrom", 278 | "outputs": [ 279 | { 280 | "internalType": "bool", 281 | "name": "", 282 | "type": "bool" 283 | } 284 | ], 285 | "stateMutability": "nonpayable", 286 | "type": "function" 287 | } 288 | ] -------------------------------------------------------------------------------- /TestNetLink/Chainlink_flat.sol: -------------------------------------------------------------------------------- 1 | 2 | // File: @openzeppelin/contracts@4.6.0/utils/Context.sol 3 | 4 | 5 | // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) 6 | 7 | pragma solidity ^0.8.0; 8 | 9 | /** 10 | * @dev Provides information about the current execution context, including the 11 | * sender of the transaction and its data. While these are generally available 12 | * via msg.sender and msg.data, they should not be accessed in such a direct 13 | * manner, since when dealing with meta-transactions the account sending and 14 | * paying for execution may not be the actual sender (as far as an application 15 | * is concerned). 16 | * 17 | * This contract is only required for intermediate, library-like contracts. 18 | */ 19 | abstract contract Context { 20 | function _msgSender() internal view virtual returns (address) { 21 | return msg.sender; 22 | } 23 | 24 | function _msgData() internal view virtual returns (bytes calldata) { 25 | return msg.data; 26 | } 27 | } 28 | 29 | // File: @openzeppelin/contracts@4.6.0/token/ERC20/IERC20.sol 30 | 31 | 32 | // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) 33 | 34 | pragma solidity ^0.8.0; 35 | 36 | /** 37 | * @dev Interface of the ERC20 standard as defined in the EIP. 38 | */ 39 | interface IERC20 { 40 | /** 41 | * @dev Emitted when `value` tokens are moved from one account (`from`) to 42 | * another (`to`). 43 | * 44 | * Note that `value` may be zero. 45 | */ 46 | event Transfer(address indexed from, address indexed to, uint256 value); 47 | 48 | /** 49 | * @dev Emitted when the allowance of a `spender` for an `owner` is set by 50 | * a call to {approve}. `value` is the new allowance. 51 | */ 52 | event Approval(address indexed owner, address indexed spender, uint256 value); 53 | 54 | /** 55 | * @dev Returns the amount of tokens in existence. 56 | */ 57 | function totalSupply() external view returns (uint256); 58 | 59 | /** 60 | * @dev Returns the amount of tokens owned by `account`. 61 | */ 62 | function balanceOf(address account) external view returns (uint256); 63 | 64 | /** 65 | * @dev Moves `amount` tokens from the caller's account to `to`. 66 | * 67 | * Returns a boolean value indicating whether the operation succeeded. 68 | * 69 | * Emits a {Transfer} event. 70 | */ 71 | function transfer(address to, uint256 amount) external returns (bool); 72 | 73 | /** 74 | * @dev Returns the remaining number of tokens that `spender` will be 75 | * allowed to spend on behalf of `owner` through {transferFrom}. This is 76 | * zero by default. 77 | * 78 | * This value changes when {approve} or {transferFrom} are called. 79 | */ 80 | function allowance(address owner, address spender) external view returns (uint256); 81 | 82 | /** 83 | * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. 84 | * 85 | * Returns a boolean value indicating whether the operation succeeded. 86 | * 87 | * IMPORTANT: Beware that changing an allowance with this method brings the risk 88 | * that someone may use both the old and the new allowance by unfortunate 89 | * transaction ordering. One possible solution to mitigate this race 90 | * condition is to first reduce the spender's allowance to 0 and set the 91 | * desired value afterwards: 92 | * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 93 | * 94 | * Emits an {Approval} event. 95 | */ 96 | function approve(address spender, uint256 amount) external returns (bool); 97 | 98 | /** 99 | * @dev Moves `amount` tokens from `from` to `to` using the 100 | * allowance mechanism. `amount` is then deducted from the caller's 101 | * allowance. 102 | * 103 | * Returns a boolean value indicating whether the operation succeeded. 104 | * 105 | * Emits a {Transfer} event. 106 | */ 107 | function transferFrom( 108 | address from, 109 | address to, 110 | uint256 amount 111 | ) external returns (bool); 112 | } 113 | 114 | // File: @openzeppelin/contracts@4.6.0/token/ERC20/extensions/IERC20Metadata.sol 115 | 116 | 117 | // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) 118 | 119 | pragma solidity ^0.8.0; 120 | 121 | 122 | /** 123 | * @dev Interface for the optional metadata functions from the ERC20 standard. 124 | * 125 | * _Available since v4.1._ 126 | */ 127 | interface IERC20Metadata is IERC20 { 128 | /** 129 | * @dev Returns the name of the token. 130 | */ 131 | function name() external view returns (string memory); 132 | 133 | /** 134 | * @dev Returns the symbol of the token. 135 | */ 136 | function symbol() external view returns (string memory); 137 | 138 | /** 139 | * @dev Returns the decimals places of the token. 140 | */ 141 | function decimals() external view returns (uint8); 142 | } 143 | 144 | // File: @openzeppelin/contracts@4.6.0/token/ERC20/ERC20.sol 145 | 146 | 147 | // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol) 148 | 149 | pragma solidity ^0.8.0; 150 | 151 | 152 | 153 | 154 | /** 155 | * @dev Implementation of the {IERC20} interface. 156 | * 157 | * This implementation is agnostic to the way tokens are created. This means 158 | * that a supply mechanism has to be added in a derived contract using {_mint}. 159 | * For a generic mechanism see {ERC20PresetMinterPauser}. 160 | * 161 | * TIP: For a detailed writeup see our guide 162 | * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How 163 | * to implement supply mechanisms]. 164 | * 165 | * We have followed general OpenZeppelin Contracts guidelines: functions revert 166 | * instead returning `false` on failure. This behavior is nonetheless 167 | * conventional and does not conflict with the expectations of ERC20 168 | * applications. 169 | * 170 | * Additionally, an {Approval} event is emitted on calls to {transferFrom}. 171 | * This allows applications to reconstruct the allowance for all accounts just 172 | * by listening to said events. Other implementations of the EIP may not emit 173 | * these events, as it isn't required by the specification. 174 | * 175 | * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} 176 | * functions have been added to mitigate the well-known issues around setting 177 | * allowances. See {IERC20-approve}. 178 | */ 179 | contract ERC20 is Context, IERC20, IERC20Metadata { 180 | mapping(address => uint256) private _balances; 181 | 182 | mapping(address => mapping(address => uint256)) private _allowances; 183 | 184 | uint256 private _totalSupply; 185 | 186 | string private _name; 187 | string private _symbol; 188 | 189 | /** 190 | * @dev Sets the values for {name} and {symbol}. 191 | * 192 | * The default value of {decimals} is 18. To select a different value for 193 | * {decimals} you should overload it. 194 | * 195 | * All two of these values are immutable: they can only be set once during 196 | * construction. 197 | */ 198 | constructor(string memory name_, string memory symbol_) { 199 | _name = name_; 200 | _symbol = symbol_; 201 | } 202 | 203 | /** 204 | * @dev Returns the name of the token. 205 | */ 206 | function name() public view virtual override returns (string memory) { 207 | return _name; 208 | } 209 | 210 | /** 211 | * @dev Returns the symbol of the token, usually a shorter version of the 212 | * name. 213 | */ 214 | function symbol() public view virtual override returns (string memory) { 215 | return _symbol; 216 | } 217 | 218 | /** 219 | * @dev Returns the number of decimals used to get its user representation. 220 | * For example, if `decimals` equals `2`, a balance of `505` tokens should 221 | * be displayed to a user as `5.05` (`505 / 10 ** 2`). 222 | * 223 | * Tokens usually opt for a value of 18, imitating the relationship between 224 | * Ether and Wei. This is the value {ERC20} uses, unless this function is 225 | * overridden; 226 | * 227 | * NOTE: This information is only used for _display_ purposes: it in 228 | * no way affects any of the arithmetic of the contract, including 229 | * {IERC20-balanceOf} and {IERC20-transfer}. 230 | */ 231 | function decimals() public view virtual override returns (uint8) { 232 | return 18; 233 | } 234 | 235 | /** 236 | * @dev See {IERC20-totalSupply}. 237 | */ 238 | function totalSupply() public view virtual override returns (uint256) { 239 | return _totalSupply; 240 | } 241 | 242 | /** 243 | * @dev See {IERC20-balanceOf}. 244 | */ 245 | function balanceOf(address account) public view virtual override returns (uint256) { 246 | return _balances[account]; 247 | } 248 | 249 | /** 250 | * @dev See {IERC20-transfer}. 251 | * 252 | * Requirements: 253 | * 254 | * - `to` cannot be the zero address. 255 | * - the caller must have a balance of at least `amount`. 256 | */ 257 | function transfer(address to, uint256 amount) public virtual override returns (bool) { 258 | address owner = _msgSender(); 259 | _transfer(owner, to, amount); 260 | return true; 261 | } 262 | 263 | /** 264 | * @dev See {IERC20-allowance}. 265 | */ 266 | function allowance(address owner, address spender) public view virtual override returns (uint256) { 267 | return _allowances[owner][spender]; 268 | } 269 | 270 | /** 271 | * @dev See {IERC20-approve}. 272 | * 273 | * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on 274 | * `transferFrom`. This is semantically equivalent to an infinite approval. 275 | * 276 | * Requirements: 277 | * 278 | * - `spender` cannot be the zero address. 279 | */ 280 | function approve(address spender, uint256 amount) public virtual override returns (bool) { 281 | address owner = _msgSender(); 282 | _approve(owner, spender, amount); 283 | return true; 284 | } 285 | 286 | /** 287 | * @dev See {IERC20-transferFrom}. 288 | * 289 | * Emits an {Approval} event indicating the updated allowance. This is not 290 | * required by the EIP. See the note at the beginning of {ERC20}. 291 | * 292 | * NOTE: Does not update the allowance if the current allowance 293 | * is the maximum `uint256`. 294 | * 295 | * Requirements: 296 | * 297 | * - `from` and `to` cannot be the zero address. 298 | * - `from` must have a balance of at least `amount`. 299 | * - the caller must have allowance for ``from``'s tokens of at least 300 | * `amount`. 301 | */ 302 | function transferFrom( 303 | address from, 304 | address to, 305 | uint256 amount 306 | ) public virtual override returns (bool) { 307 | address spender = _msgSender(); 308 | _spendAllowance(from, spender, amount); 309 | _transfer(from, to, amount); 310 | return true; 311 | } 312 | 313 | /** 314 | * @dev Atomically increases the allowance granted to `spender` by the caller. 315 | * 316 | * This is an alternative to {approve} that can be used as a mitigation for 317 | * problems described in {IERC20-approve}. 318 | * 319 | * Emits an {Approval} event indicating the updated allowance. 320 | * 321 | * Requirements: 322 | * 323 | * - `spender` cannot be the zero address. 324 | */ 325 | function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { 326 | address owner = _msgSender(); 327 | _approve(owner, spender, allowance(owner, spender) + addedValue); 328 | return true; 329 | } 330 | 331 | /** 332 | * @dev Atomically decreases the allowance granted to `spender` by the caller. 333 | * 334 | * This is an alternative to {approve} that can be used as a mitigation for 335 | * problems described in {IERC20-approve}. 336 | * 337 | * Emits an {Approval} event indicating the updated allowance. 338 | * 339 | * Requirements: 340 | * 341 | * - `spender` cannot be the zero address. 342 | * - `spender` must have allowance for the caller of at least 343 | * `subtractedValue`. 344 | */ 345 | function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { 346 | address owner = _msgSender(); 347 | uint256 currentAllowance = allowance(owner, spender); 348 | require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); 349 | unchecked { 350 | _approve(owner, spender, currentAllowance - subtractedValue); 351 | } 352 | 353 | return true; 354 | } 355 | 356 | /** 357 | * @dev Moves `amount` of tokens from `sender` to `recipient`. 358 | * 359 | * This internal function is equivalent to {transfer}, and can be used to 360 | * e.g. implement automatic token fees, slashing mechanisms, etc. 361 | * 362 | * Emits a {Transfer} event. 363 | * 364 | * Requirements: 365 | * 366 | * - `from` cannot be the zero address. 367 | * - `to` cannot be the zero address. 368 | * - `from` must have a balance of at least `amount`. 369 | */ 370 | function _transfer( 371 | address from, 372 | address to, 373 | uint256 amount 374 | ) internal virtual { 375 | require(from != address(0), "ERC20: transfer from the zero address"); 376 | require(to != address(0), "ERC20: transfer to the zero address"); 377 | 378 | _beforeTokenTransfer(from, to, amount); 379 | 380 | uint256 fromBalance = _balances[from]; 381 | require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); 382 | unchecked { 383 | _balances[from] = fromBalance - amount; 384 | } 385 | _balances[to] += amount; 386 | 387 | emit Transfer(from, to, amount); 388 | 389 | _afterTokenTransfer(from, to, amount); 390 | } 391 | 392 | /** @dev Creates `amount` tokens and assigns them to `account`, increasing 393 | * the total supply. 394 | * 395 | * Emits a {Transfer} event with `from` set to the zero address. 396 | * 397 | * Requirements: 398 | * 399 | * - `account` cannot be the zero address. 400 | */ 401 | function _mint(address account, uint256 amount) internal virtual { 402 | require(account != address(0), "ERC20: mint to the zero address"); 403 | 404 | _beforeTokenTransfer(address(0), account, amount); 405 | 406 | _totalSupply += amount; 407 | _balances[account] += amount; 408 | emit Transfer(address(0), account, amount); 409 | 410 | _afterTokenTransfer(address(0), account, amount); 411 | } 412 | 413 | /** 414 | * @dev Destroys `amount` tokens from `account`, reducing the 415 | * total supply. 416 | * 417 | * Emits a {Transfer} event with `to` set to the zero address. 418 | * 419 | * Requirements: 420 | * 421 | * - `account` cannot be the zero address. 422 | * - `account` must have at least `amount` tokens. 423 | */ 424 | function _burn(address account, uint256 amount) internal virtual { 425 | require(account != address(0), "ERC20: burn from the zero address"); 426 | 427 | _beforeTokenTransfer(account, address(0), amount); 428 | 429 | uint256 accountBalance = _balances[account]; 430 | require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); 431 | unchecked { 432 | _balances[account] = accountBalance - amount; 433 | } 434 | _totalSupply -= amount; 435 | 436 | emit Transfer(account, address(0), amount); 437 | 438 | _afterTokenTransfer(account, address(0), amount); 439 | } 440 | 441 | /** 442 | * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. 443 | * 444 | * This internal function is equivalent to `approve`, and can be used to 445 | * e.g. set automatic allowances for certain subsystems, etc. 446 | * 447 | * Emits an {Approval} event. 448 | * 449 | * Requirements: 450 | * 451 | * - `owner` cannot be the zero address. 452 | * - `spender` cannot be the zero address. 453 | */ 454 | function _approve( 455 | address owner, 456 | address spender, 457 | uint256 amount 458 | ) internal virtual { 459 | require(owner != address(0), "ERC20: approve from the zero address"); 460 | require(spender != address(0), "ERC20: approve to the zero address"); 461 | 462 | _allowances[owner][spender] = amount; 463 | emit Approval(owner, spender, amount); 464 | } 465 | 466 | /** 467 | * @dev Updates `owner` s allowance for `spender` based on spent `amount`. 468 | * 469 | * Does not update the allowance amount in case of infinite allowance. 470 | * Revert if not enough allowance is available. 471 | * 472 | * Might emit an {Approval} event. 473 | */ 474 | function _spendAllowance( 475 | address owner, 476 | address spender, 477 | uint256 amount 478 | ) internal virtual { 479 | uint256 currentAllowance = allowance(owner, spender); 480 | if (currentAllowance != type(uint256).max) { 481 | require(currentAllowance >= amount, "ERC20: insufficient allowance"); 482 | unchecked { 483 | _approve(owner, spender, currentAllowance - amount); 484 | } 485 | } 486 | } 487 | 488 | /** 489 | * @dev Hook that is called before any transfer of tokens. This includes 490 | * minting and burning. 491 | * 492 | * Calling conditions: 493 | * 494 | * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens 495 | * will be transferred to `to`. 496 | * - when `from` is zero, `amount` tokens will be minted for `to`. 497 | * - when `to` is zero, `amount` of ``from``'s tokens will be burned. 498 | * - `from` and `to` are never both zero. 499 | * 500 | * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. 501 | */ 502 | function _beforeTokenTransfer( 503 | address from, 504 | address to, 505 | uint256 amount 506 | ) internal virtual {} 507 | 508 | /** 509 | * @dev Hook that is called after any transfer of tokens. This includes 510 | * minting and burning. 511 | * 512 | * Calling conditions: 513 | * 514 | * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens 515 | * has been transferred to `to`. 516 | * - when `from` is zero, `amount` tokens have been minted for `to`. 517 | * - when `to` is zero, `amount` of ``from``'s tokens have been burned. 518 | * - `from` and `to` are never both zero. 519 | * 520 | * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. 521 | */ 522 | function _afterTokenTransfer( 523 | address from, 524 | address to, 525 | uint256 amount 526 | ) internal virtual {} 527 | } 528 | 529 | // File: Chainlink.sol 530 | 531 | 532 | pragma solidity ^0.8.4; 533 | 534 | 535 | contract Chainlink is ERC20 { 536 | constructor() ERC20("Chainlink", "LINK") { 537 | _mint(msg.sender, 1000000000000000000000000000); 538 | } 539 | } 540 | -------------------------------------------------------------------------------- /TestNetLink/License.txt: -------------------------------------------------------------------------------- 1 | Copyright 2022 Chainlink Converters 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /TestNetLink/README.md: -------------------------------------------------------------------------------- 1 | # TestNet LINK 2 | 3 | We created a TestNet version of LINK on Ropsten and Rinkbey for development. 4 | We needed to create a new TestNet link to enable transferability with decentralized applications. 5 | We open sourced the code under the MIT License to allow dApp developers access to the ABI and JSON contract data. 6 |   7 | 8 | [RinkebyLINK on Etherscan](https://rinkeby.etherscan.io/token/0xa591afbc1a81ea1c61edefa3a36d54f50ca05cad) 9 | -------------------------------------------------------------------------------- /TestNetLink/chainlink_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "compiler": { 3 | "version": "0.8.7+commit.e28d00a7" 4 | }, 5 | "language": "Solidity", 6 | "output": { 7 | "abi": [ 8 | { 9 | "inputs": [], 10 | "stateMutability": "nonpayable", 11 | "type": "constructor" 12 | }, 13 | { 14 | "anonymous": false, 15 | "inputs": [ 16 | { 17 | "indexed": true, 18 | "internalType": "address", 19 | "name": "owner", 20 | "type": "address" 21 | }, 22 | { 23 | "indexed": true, 24 | "internalType": "address", 25 | "name": "spender", 26 | "type": "address" 27 | }, 28 | { 29 | "indexed": false, 30 | "internalType": "uint256", 31 | "name": "value", 32 | "type": "uint256" 33 | } 34 | ], 35 | "name": "Approval", 36 | "type": "event" 37 | }, 38 | { 39 | "anonymous": false, 40 | "inputs": [ 41 | { 42 | "indexed": true, 43 | "internalType": "address", 44 | "name": "from", 45 | "type": "address" 46 | }, 47 | { 48 | "indexed": true, 49 | "internalType": "address", 50 | "name": "to", 51 | "type": "address" 52 | }, 53 | { 54 | "indexed": false, 55 | "internalType": "uint256", 56 | "name": "value", 57 | "type": "uint256" 58 | } 59 | ], 60 | "name": "Transfer", 61 | "type": "event" 62 | }, 63 | { 64 | "inputs": [ 65 | { 66 | "internalType": "address", 67 | "name": "owner", 68 | "type": "address" 69 | }, 70 | { 71 | "internalType": "address", 72 | "name": "spender", 73 | "type": "address" 74 | } 75 | ], 76 | "name": "allowance", 77 | "outputs": [ 78 | { 79 | "internalType": "uint256", 80 | "name": "", 81 | "type": "uint256" 82 | } 83 | ], 84 | "stateMutability": "view", 85 | "type": "function" 86 | }, 87 | { 88 | "inputs": [ 89 | { 90 | "internalType": "address", 91 | "name": "spender", 92 | "type": "address" 93 | }, 94 | { 95 | "internalType": "uint256", 96 | "name": "amount", 97 | "type": "uint256" 98 | } 99 | ], 100 | "name": "approve", 101 | "outputs": [ 102 | { 103 | "internalType": "bool", 104 | "name": "", 105 | "type": "bool" 106 | } 107 | ], 108 | "stateMutability": "nonpayable", 109 | "type": "function" 110 | }, 111 | { 112 | "inputs": [ 113 | { 114 | "internalType": "address", 115 | "name": "account", 116 | "type": "address" 117 | } 118 | ], 119 | "name": "balanceOf", 120 | "outputs": [ 121 | { 122 | "internalType": "uint256", 123 | "name": "", 124 | "type": "uint256" 125 | } 126 | ], 127 | "stateMutability": "view", 128 | "type": "function" 129 | }, 130 | { 131 | "inputs": [], 132 | "name": "decimals", 133 | "outputs": [ 134 | { 135 | "internalType": "uint8", 136 | "name": "", 137 | "type": "uint8" 138 | } 139 | ], 140 | "stateMutability": "view", 141 | "type": "function" 142 | }, 143 | { 144 | "inputs": [ 145 | { 146 | "internalType": "address", 147 | "name": "spender", 148 | "type": "address" 149 | }, 150 | { 151 | "internalType": "uint256", 152 | "name": "subtractedValue", 153 | "type": "uint256" 154 | } 155 | ], 156 | "name": "decreaseAllowance", 157 | "outputs": [ 158 | { 159 | "internalType": "bool", 160 | "name": "", 161 | "type": "bool" 162 | } 163 | ], 164 | "stateMutability": "nonpayable", 165 | "type": "function" 166 | }, 167 | { 168 | "inputs": [ 169 | { 170 | "internalType": "address", 171 | "name": "spender", 172 | "type": "address" 173 | }, 174 | { 175 | "internalType": "uint256", 176 | "name": "addedValue", 177 | "type": "uint256" 178 | } 179 | ], 180 | "name": "increaseAllowance", 181 | "outputs": [ 182 | { 183 | "internalType": "bool", 184 | "name": "", 185 | "type": "bool" 186 | } 187 | ], 188 | "stateMutability": "nonpayable", 189 | "type": "function" 190 | }, 191 | { 192 | "inputs": [], 193 | "name": "name", 194 | "outputs": [ 195 | { 196 | "internalType": "string", 197 | "name": "", 198 | "type": "string" 199 | } 200 | ], 201 | "stateMutability": "view", 202 | "type": "function" 203 | }, 204 | { 205 | "inputs": [], 206 | "name": "symbol", 207 | "outputs": [ 208 | { 209 | "internalType": "string", 210 | "name": "", 211 | "type": "string" 212 | } 213 | ], 214 | "stateMutability": "view", 215 | "type": "function" 216 | }, 217 | { 218 | "inputs": [], 219 | "name": "totalSupply", 220 | "outputs": [ 221 | { 222 | "internalType": "uint256", 223 | "name": "", 224 | "type": "uint256" 225 | } 226 | ], 227 | "stateMutability": "view", 228 | "type": "function" 229 | }, 230 | { 231 | "inputs": [ 232 | { 233 | "internalType": "address", 234 | "name": "to", 235 | "type": "address" 236 | }, 237 | { 238 | "internalType": "uint256", 239 | "name": "amount", 240 | "type": "uint256" 241 | } 242 | ], 243 | "name": "transfer", 244 | "outputs": [ 245 | { 246 | "internalType": "bool", 247 | "name": "", 248 | "type": "bool" 249 | } 250 | ], 251 | "stateMutability": "nonpayable", 252 | "type": "function" 253 | }, 254 | { 255 | "inputs": [ 256 | { 257 | "internalType": "address", 258 | "name": "from", 259 | "type": "address" 260 | }, 261 | { 262 | "internalType": "address", 263 | "name": "to", 264 | "type": "address" 265 | }, 266 | { 267 | "internalType": "uint256", 268 | "name": "amount", 269 | "type": "uint256" 270 | } 271 | ], 272 | "name": "transferFrom", 273 | "outputs": [ 274 | { 275 | "internalType": "bool", 276 | "name": "", 277 | "type": "bool" 278 | } 279 | ], 280 | "stateMutability": "nonpayable", 281 | "type": "function" 282 | } 283 | ], 284 | "devdoc": { 285 | "kind": "dev", 286 | "methods": { 287 | "allowance(address,address)": { 288 | "details": "See {IERC20-allowance}." 289 | }, 290 | "approve(address,uint256)": { 291 | "details": "See {IERC20-approve}. NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on `transferFrom`. This is semantically equivalent to an infinite approval. Requirements: - `spender` cannot be the zero address." 292 | }, 293 | "balanceOf(address)": { 294 | "details": "See {IERC20-balanceOf}." 295 | }, 296 | "decimals()": { 297 | "details": "Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless this function is overridden; NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}." 298 | }, 299 | "decreaseAllowance(address,uint256)": { 300 | "details": "Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`." 301 | }, 302 | "increaseAllowance(address,uint256)": { 303 | "details": "Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address." 304 | }, 305 | "name()": { 306 | "details": "Returns the name of the token." 307 | }, 308 | "symbol()": { 309 | "details": "Returns the symbol of the token, usually a shorter version of the name." 310 | }, 311 | "totalSupply()": { 312 | "details": "See {IERC20-totalSupply}." 313 | }, 314 | "transfer(address,uint256)": { 315 | "details": "See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `amount`." 316 | }, 317 | "transferFrom(address,address,uint256)": { 318 | "details": "See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address. - `from` must have a balance of at least `amount`. - the caller must have allowance for ``from``'s tokens of at least `amount`." 319 | } 320 | }, 321 | "version": 1 322 | }, 323 | "userdoc": { 324 | "kind": "user", 325 | "methods": {}, 326 | "version": 1 327 | } 328 | }, 329 | "settings": { 330 | "compilationTarget": { 331 | "Chainlink.sol": "Chainlink" 332 | }, 333 | "evmVersion": "london", 334 | "libraries": {}, 335 | "metadata": { 336 | "bytecodeHash": "ipfs" 337 | }, 338 | "optimizer": { 339 | "enabled": false, 340 | "runs": 200 341 | }, 342 | "remappings": [] 343 | }, 344 | "sources": { 345 | "@openzeppelin/contracts@4.6.0/token/ERC20/ERC20.sol": { 346 | "keccak256": "0xe0c8b625a79bac0fe80f17cfb521e072805cc9cef1c96a5caf45b264e74812fa", 347 | "license": "MIT", 348 | "urls": [ 349 | "bzz-raw://12fd1efc9ad061ef675bd50fb0c8e3c6f2952a09f8df0e3c688b8d81b8918838", 350 | "dweb:/ipfs/QmawN6PjTwy91pU7ANjCSgbsLc8TDA6hwu9GsFFaNSuhb5" 351 | ] 352 | }, 353 | "@openzeppelin/contracts@4.6.0/token/ERC20/IERC20.sol": { 354 | "keccak256": "0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b", 355 | "license": "MIT", 356 | "urls": [ 357 | "bzz-raw://5a7d5b1ef5d8d5889ad2ed89d8619c09383b80b72ab226e0fe7bde1636481e34", 358 | "dweb:/ipfs/QmebXWgtEfumQGBdVeM6c71McLixYXQP5Bk6kKXuoY4Bmr" 359 | ] 360 | }, 361 | "@openzeppelin/contracts@4.6.0/token/ERC20/extensions/IERC20Metadata.sol": { 362 | "keccak256": "0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca", 363 | "license": "MIT", 364 | "urls": [ 365 | "bzz-raw://5a376d3dda2cb70536c0a45c208b29b34ac560c4cb4f513a42079f96ba47d2dd", 366 | "dweb:/ipfs/QmZQg6gn1sUpM8wHzwNvSnihumUCAhxD119MpXeKp8B9s8" 367 | ] 368 | }, 369 | "@openzeppelin/contracts@4.6.0/utils/Context.sol": { 370 | "keccak256": "0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7", 371 | "license": "MIT", 372 | "urls": [ 373 | "bzz-raw://6df0ddf21ce9f58271bdfaa85cde98b200ef242a05a3f85c2bc10a8294800a92", 374 | "dweb:/ipfs/QmRK2Y5Yc6BK7tGKkgsgn3aJEQGi5aakeSPZvS65PV8Xp3" 375 | ] 376 | }, 377 | "Chainlink.sol": { 378 | "keccak256": "0x18b574c48384cfeef8fdf46f90f65940e6fada49ffd3282440d794dd4031d7db", 379 | "license": "MIT", 380 | "urls": [ 381 | "bzz-raw://e6a654dd81fbd943a2b02435526c88620ace10ebf0a6bbc32994dbe1313c7bf3", 382 | "dweb:/ipfs/QmSqJFURgF9sqSKuFQkSrLEjKHG8ibhjzAfBA6wVSYnSkc" 383 | ] 384 | } 385 | }, 386 | "version": 1 387 | } -------------------------------------------------------------------------------- /TestNetLink/link.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.4; 3 | 4 | import "@openzeppelin/contracts@4.6.0/token/ERC20/ERC20.sol"; 5 | 6 | contract Chainlink is ERC20 { 7 | constructor() ERC20("Chainlink", "LINK") { 8 | _mint(msg.sender, 10000000000000000000000000000); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /TestNetLink/rinkbeyABI.sol: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "string", 6 | "name": "name_", 7 | "type": "string" 8 | }, 9 | { 10 | "internalType": "string", 11 | "name": "symbol_", 12 | "type": "string" 13 | } 14 | ], 15 | "stateMutability": "nonpayable", 16 | "type": "constructor" 17 | }, 18 | { 19 | "anonymous": false, 20 | "inputs": [ 21 | { 22 | "indexed": true, 23 | "internalType": "address", 24 | "name": "owner", 25 | "type": "address" 26 | }, 27 | { 28 | "indexed": true, 29 | "internalType": "address", 30 | "name": "spender", 31 | "type": "address" 32 | }, 33 | { 34 | "indexed": false, 35 | "internalType": "uint256", 36 | "name": "value", 37 | "type": "uint256" 38 | } 39 | ], 40 | "name": "Approval", 41 | "type": "event" 42 | }, 43 | { 44 | "anonymous": false, 45 | "inputs": [ 46 | { 47 | "indexed": true, 48 | "internalType": "address", 49 | "name": "from", 50 | "type": "address" 51 | }, 52 | { 53 | "indexed": true, 54 | "internalType": "address", 55 | "name": "to", 56 | "type": "address" 57 | }, 58 | { 59 | "indexed": false, 60 | "internalType": "uint256", 61 | "name": "value", 62 | "type": "uint256" 63 | } 64 | ], 65 | "name": "Transfer", 66 | "type": "event" 67 | }, 68 | { 69 | "inputs": [ 70 | { 71 | "internalType": "address", 72 | "name": "owner", 73 | "type": "address" 74 | }, 75 | { 76 | "internalType": "address", 77 | "name": "spender", 78 | "type": "address" 79 | } 80 | ], 81 | "name": "allowance", 82 | "outputs": [ 83 | { 84 | "internalType": "uint256", 85 | "name": "", 86 | "type": "uint256" 87 | } 88 | ], 89 | "stateMutability": "view", 90 | "type": "function" 91 | }, 92 | { 93 | "inputs": [ 94 | { 95 | "internalType": "address", 96 | "name": "spender", 97 | "type": "address" 98 | }, 99 | { 100 | "internalType": "uint256", 101 | "name": "amount", 102 | "type": "uint256" 103 | } 104 | ], 105 | "name": "approve", 106 | "outputs": [ 107 | { 108 | "internalType": "bool", 109 | "name": "", 110 | "type": "bool" 111 | } 112 | ], 113 | "stateMutability": "nonpayable", 114 | "type": "function" 115 | }, 116 | { 117 | "inputs": [ 118 | { 119 | "internalType": "address", 120 | "name": "account", 121 | "type": "address" 122 | } 123 | ], 124 | "name": "balanceOf", 125 | "outputs": [ 126 | { 127 | "internalType": "uint256", 128 | "name": "", 129 | "type": "uint256" 130 | } 131 | ], 132 | "stateMutability": "view", 133 | "type": "function" 134 | }, 135 | { 136 | "inputs": [], 137 | "name": "decimals", 138 | "outputs": [ 139 | { 140 | "internalType": "uint8", 141 | "name": "", 142 | "type": "uint8" 143 | } 144 | ], 145 | "stateMutability": "view", 146 | "type": "function" 147 | }, 148 | { 149 | "inputs": [ 150 | { 151 | "internalType": "address", 152 | "name": "spender", 153 | "type": "address" 154 | }, 155 | { 156 | "internalType": "uint256", 157 | "name": "subtractedValue", 158 | "type": "uint256" 159 | } 160 | ], 161 | "name": "decreaseAllowance", 162 | "outputs": [ 163 | { 164 | "internalType": "bool", 165 | "name": "", 166 | "type": "bool" 167 | } 168 | ], 169 | "stateMutability": "nonpayable", 170 | "type": "function" 171 | }, 172 | { 173 | "inputs": [ 174 | { 175 | "internalType": "address", 176 | "name": "spender", 177 | "type": "address" 178 | }, 179 | { 180 | "internalType": "uint256", 181 | "name": "addedValue", 182 | "type": "uint256" 183 | } 184 | ], 185 | "name": "increaseAllowance", 186 | "outputs": [ 187 | { 188 | "internalType": "bool", 189 | "name": "", 190 | "type": "bool" 191 | } 192 | ], 193 | "stateMutability": "nonpayable", 194 | "type": "function" 195 | }, 196 | { 197 | "inputs": [], 198 | "name": "name", 199 | "outputs": [ 200 | { 201 | "internalType": "string", 202 | "name": "", 203 | "type": "string" 204 | } 205 | ], 206 | "stateMutability": "view", 207 | "type": "function" 208 | }, 209 | { 210 | "inputs": [], 211 | "name": "symbol", 212 | "outputs": [ 213 | { 214 | "internalType": "string", 215 | "name": "", 216 | "type": "string" 217 | } 218 | ], 219 | "stateMutability": "view", 220 | "type": "function" 221 | }, 222 | { 223 | "inputs": [], 224 | "name": "totalSupply", 225 | "outputs": [ 226 | { 227 | "internalType": "uint256", 228 | "name": "", 229 | "type": "uint256" 230 | } 231 | ], 232 | "stateMutability": "view", 233 | "type": "function" 234 | }, 235 | { 236 | "inputs": [ 237 | { 238 | "internalType": "address", 239 | "name": "to", 240 | "type": "address" 241 | }, 242 | { 243 | "internalType": "uint256", 244 | "name": "amount", 245 | "type": "uint256" 246 | } 247 | ], 248 | "name": "transfer", 249 | "outputs": [ 250 | { 251 | "internalType": "bool", 252 | "name": "", 253 | "type": "bool" 254 | } 255 | ], 256 | "stateMutability": "nonpayable", 257 | "type": "function" 258 | }, 259 | { 260 | "inputs": [ 261 | { 262 | "internalType": "address", 263 | "name": "from", 264 | "type": "address" 265 | }, 266 | { 267 | "internalType": "address", 268 | "name": "to", 269 | "type": "address" 270 | }, 271 | { 272 | "internalType": "uint256", 273 | "name": "amount", 274 | "type": "uint256" 275 | } 276 | ], 277 | "name": "transferFrom", 278 | "outputs": [ 279 | { 280 | "internalType": "bool", 281 | "name": "", 282 | "type": "bool" 283 | } 284 | ], 285 | "stateMutability": "nonpayable", 286 | "type": "function" 287 | } 288 | ] -------------------------------------------------------------------------------- /WhitePaper/WhitePaper (1).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bhaney44/ChainLinkHackathonSpring2022/78b53a6ed1a44ca64961707c8dacbeb8c97a662d/WhitePaper/WhitePaper (1).pdf -------------------------------------------------------------------------------- /WhitePaper/readme.md: -------------------------------------------------------------------------------- 1 | # Hackathon White Paper 2 | 3 | In short, the Central contribution for this Paper is the Chainlink Converter is an Ethereum-Algorand DON for interoperability. Part I provides an overview of the two blockchains connected via the Chainlink converter. Part II dives deeper into Chainlink and DONs. Part III introduces the Chainlink Converter for interchain interoperability. 4 | 5 | Hackathon White Paper also available on [SSRN](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4116942). 6 | -------------------------------------------------------------------------------- /converter-backend/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | ./node_modules 3 | .DS_Store 4 | ./.DS_Store -------------------------------------------------------------------------------- /converter-backend/Procfile: -------------------------------------------------------------------------------- 1 | web: npm start -------------------------------------------------------------------------------- /converter-backend/README.md: -------------------------------------------------------------------------------- 1 | # ChainLink Converter Backend 2 | 3 | This is the backend folder responsible for feeding data to the chainlink node validator that goes into the smartcontract & Also Collating All Users Addresses 4 | 5 | ## Tools & Technologies 6 | 7 | - TypeScript 8 | - NodeJs 9 | - ExpressJs 10 | - Mongoose & MongoDB 11 | 12 | 13 | ## Requirements 14 | 15 | * NPM and Node installed, download [HERE](https://phoenixnap.com/kb/install-node-js-npm-on-windows) 16 | * [MongoDB Atlas](https://www.mongodb.com/atlas/database) cloud database or [MongoDB](https://www.mongodb.com/) for local environment must be installed. 17 | 18 | 19 | ## Run Backend On Local Machine 20 | 21 | * Git clone the repository 22 | 23 | ``` 24 | $ git clone https://github.com/Bhaney44/ChainLinkHackathonSpring2022.git 25 | ``` 26 | * Go into `converter-backend` directory 27 | 28 | ``` 29 | $ cd backend 30 | ``` 31 | * Install app dependencies 32 | ``` 33 | $ npm install 34 | ``` 35 | 36 | * Start backend server 37 | 38 | ``` 39 | $ npm run dev 40 | 41 | ``` 42 | 43 | 44 | 45 | # License 46 | 47 | [Apache](https://github.com/Bhaney44/ChainLinkHackathonSpring2022/blob/main/LICENSE) 48 | -------------------------------------------------------------------------------- /converter-backend/app.ts: -------------------------------------------------------------------------------- 1 | import express from "express"; 2 | import config from "config"; 3 | import dotenv from "dotenv"; 4 | import connect from "./db"; 5 | import cors from "cors"; 6 | import { Response, Request } from "express"; 7 | import { handleCreateUser, handleGetAllUsers , handleGetTransaction} from "./src/controller"; 8 | 9 | 10 | const port = config.get("port") as number; 11 | const host = config.get("host") as string; 12 | 13 | //using .env config 14 | dotenv.config(); 15 | 16 | const app = express(); 17 | 18 | 19 | // Parses incoming requests with JSON payloads 20 | app.use(express.json()); 21 | app.use(express.urlencoded({ extended: false })); 22 | 23 | //middlewares 24 | app.use(cors()); 25 | 26 | //home URl 27 | app.get('/', (req : Request,res : Response) => { 28 | res.json('goLink DB 🔞 is running') 29 | }) 30 | 31 | // submitting data for explorer port 32 | app.post('/explorer/post', (req: Request, res: Response) => { 33 | handleCreateUser(req, res); 34 | } ) 35 | 36 | //get all submitted data from db for explorer population 37 | app.get('/explorer/data', (req : Request, res : Response) => { 38 | handleGetAllUsers(req,res); 39 | }) 40 | 41 | //get transaction 42 | app.post('/explorer/transaction', (req : Request, res : Response) => { 43 | handleGetTransaction(req,res); 44 | }) 45 | 46 | app.listen(port, host, () => { 47 | console.log(`Server listening at http://${host}:${port}`) 48 | connect() 49 | ; 50 | }); -------------------------------------------------------------------------------- /converter-backend/config/default.ts: -------------------------------------------------------------------------------- 1 | // config/default.ts 2 | 3 | export default { 4 | port: 1337, 5 | host: "localhost", 6 | URI: "mongodb://localhost:27017/chainlink" 7 | } -------------------------------------------------------------------------------- /converter-backend/db/index.ts: -------------------------------------------------------------------------------- 1 | import mongoose, {ConnectOptions} from "mongoose"; 2 | import config from "config"; 3 | 4 | 5 | const connect = () => { 6 | const connectionString = config.get("URI") as string; 7 | 8 | return mongoose?.connect(connectionString, 9 | { 10 | useUnifiedTopology : true, 11 | useNewUrlParser : true, 12 | } as ConnectOptions) 13 | .then(() => { 14 | console.log("Database connected"); 15 | }) 16 | .catch((error) => { 17 | console.error("db error", error); 18 | process.exit(1); 19 | }); 20 | } 21 | 22 | export default connect; -------------------------------------------------------------------------------- /converter-backend/model/model.ts: -------------------------------------------------------------------------------- 1 | import mongoose from "mongoose"; 2 | 3 | export interface EachUserConverterDocument extends mongoose.Document { 4 | eth_address: string; 5 | algo_address: string; 6 | amount: Number; 7 | pending : boolean; 8 | } 9 | 10 | //defining model scheme 11 | const userSchema = new mongoose.Schema({ 12 | eth_address: {type : String, required: true}, 13 | algo_address:{ type: String, required: true}, 14 | amount: {type: String, required: true, }, 15 | pending : Boolean 16 | }) 17 | 18 | const user = mongoose.model('user', userSchema) 19 | 20 | export default user 21 | 22 | -------------------------------------------------------------------------------- /converter-backend/nodemon.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "restartable": "rs", 4 | "ignore": [".git", "node_modules/", "dist/", "coverage/"], 5 | "watch": ["src/"], 6 | "execMap": { 7 | "ts": "node -r ts-node/register" 8 | }, 9 | "env": { 10 | "NODE_ENV": "development" 11 | }, 12 | "ext": "js,json,ts" 13 | } -------------------------------------------------------------------------------- /converter-backend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "converter-backend", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "server.js", 6 | "scripts": { 7 | "start" : "node app.ts", 8 | "dev": "nodemon --config nodemon.json app.ts", 9 | "test": "echo \"Error: no test specified\" && exit 1" 10 | }, 11 | "author": "samuel aspirin", 12 | "license": "MIT", 13 | "dependencies": { 14 | "config": "^3.3.7", 15 | "cors": "^2.8.5", 16 | "dotenv": "^16.0.1", 17 | "express": "^4.18.1", 18 | "mongoose": "^6.3.4" 19 | }, 20 | "devDependencies": { 21 | "@types/config": "^0.0.41", 22 | "@types/cors": "^2.8.12", 23 | "@types/express": "^4.17.13", 24 | "@types/mongoose": "^5.11.97", 25 | "@types/node": "^17.0.35", 26 | "nodemon": "^2.0.16", 27 | "ts-node": "^10.8.0", 28 | "typescript": "^4.6.4" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /converter-backend/src/controller.ts: -------------------------------------------------------------------------------- 1 | import user from '../model/model'; 2 | import {Response, Request} from 'express'; 3 | 4 | export const handleCreateUser = (req: Request, res : Response) => { 5 | //validate request 6 | if(!req.body) { 7 | return res.status(400).json({ 8 | message : "all fields can not be empty" 9 | }) 10 | } 11 | if(!req.body.algo_address || !req.body.eth_address || !req.body.amount) { 12 | return res.status(400).json({ 13 | message : "fill all neccessary fields" 14 | }) 15 | } 16 | 17 | //Storing each user document 18 | const userDocument = new user({ 19 | eth_address : req.body.eth_address, 20 | algo_address : req.body.algo_address, 21 | amount : req.body.amount, 22 | pending : req.body.pending 23 | }) 24 | 25 | userDocument.save() 26 | .then((data) => { 27 | res.status(200).json({ 28 | message : 'User Document details successfully stored for explorer use only', 29 | data : data 30 | }) 31 | }) 32 | .catch(err => { 33 | res.status(500).json({ 34 | message: err.message || "error occurred while storing User Document details" 35 | }) 36 | }) 37 | 38 | 39 | } 40 | 41 | export const handleGetAllUsers = (req: Request, res: Response) => { 42 | user.find() 43 | .then(data => { 44 | res.status(200).json({ 45 | message : "Successfully gotten all information for explorer use", 46 | data : data 47 | }) 48 | }) 49 | .catch(err => { 50 | res.status(500).json({ 51 | message : err.message || "error getting all information" 52 | }) 53 | }) 54 | } 55 | 56 | export const handleGetTransaction = (req: Request, res: Response) => { 57 | user.findOne({address:req.body.eth_address, pending:true}) 58 | .then(data => { 59 | res.status(200).json({ 60 | message : "Successfully Gotten Data", 61 | data : data 62 | }) 63 | }) 64 | .catch(err => { 65 | res.status(500).json({ 66 | message : err.message || "error getting information" 67 | }) 68 | }) 69 | } 70 | 71 | 72 | -------------------------------------------------------------------------------- /converter-backend/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Visit https://aka.ms/tsconfig.json to read more about this file */ 4 | /* Projects */ 5 | // "incremental": true, /* Enable incremental compilation */ 6 | // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ 7 | // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */ 8 | // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */ 9 | // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ 10 | // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ 11 | 12 | /* Language and Environment */ 13 | "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ 14 | // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ 15 | // "jsx": "preserve", /* Specify what JSX code is generated. */ 16 | // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ 17 | // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ 18 | // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */ 19 | // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ 20 | // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */ 21 | // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */ 22 | // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ 23 | // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ 24 | 25 | /* Modules */ 26 | "module": "commonjs", /* Specify what module code is generated. */ 27 | // "rootDir": "./", /* Specify the root folder within your source files. */ 28 | // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ 29 | // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ 30 | // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ 31 | // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ 32 | // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */ 33 | // "types": [], /* Specify type package names to be included without being referenced in a source file. */ 34 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 35 | // "resolveJsonModule": true, /* Enable importing .json files */ 36 | // "noResolve": true, /* Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project. */ 37 | 38 | /* JavaScript Support */ 39 | // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */ 40 | // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ 41 | // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ 42 | 43 | /* Emit */ 44 | // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ 45 | // "declarationMap": true, /* Create sourcemaps for d.ts files. */ 46 | // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ 47 | // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ 48 | // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ 49 | // "outDir": "./", /* Specify an output folder for all emitted files. */ 50 | // "removeComments": true, /* Disable emitting comments. */ 51 | // "noEmit": true, /* Disable emitting files from a compilation. */ 52 | // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ 53 | // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ 54 | // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ 55 | // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ 56 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 57 | // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ 58 | // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ 59 | // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ 60 | // "newLine": "crlf", /* Set the newline character for emitting files. */ 61 | // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */ 62 | // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */ 63 | // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ 64 | // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */ 65 | // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ 66 | // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ 67 | 68 | /* Interop Constraints */ 69 | // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ 70 | // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ 71 | "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */ 72 | // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ 73 | "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ 74 | 75 | /* Type Checking */ 76 | "strict": true, /* Enable all strict type-checking options. */ 77 | // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */ 78 | // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */ 79 | // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ 80 | // "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */ 81 | // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ 82 | // "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */ 83 | // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */ 84 | // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ 85 | // "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */ 86 | // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */ 87 | // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ 88 | // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ 89 | // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ 90 | // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ 91 | // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ 92 | // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */ 93 | // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ 94 | // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ 95 | 96 | /* Completeness */ 97 | // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ 98 | "skipLibCheck": true /* Skip type checking all .d.ts files. */ 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /converter-frontend/.gitignore: -------------------------------------------------------------------------------- 1 | ./node_modules 2 | node_modules 3 | ./.DS_Store 4 | .DS_Store 5 | .env -------------------------------------------------------------------------------- /converter-frontend/README.md: -------------------------------------------------------------------------------- 1 | # ChainLink Converter Frontend 2 | 3 | ![image](https://i.postimg.cc/C5646St8/c.png) 4 | 5 | Contents 6 | ================= 7 | 8 | * [About](#About) 9 | * [Technologies-&-Tools](#Technologies-&-Tools) 10 | * [Requirements](#Requirements) 11 | * [Run-On-Local-Machine](#Run-On-Local-Machine) 12 | * [Links](#Links) 13 | * [License](#License) 14 | 15 | 16 | About 17 | ============ 18 | 19 | Inventing a converter for Algorand and Ethereum using Chainlink. The converter will allow interoperability between the two blockchains. A keystone to the converter is goLink. goLink allows for LINK transactions on the Algorand blockcahin, while the Chainlink Converter allows for asset movement between the Algorand and Ethereum blockchains. 20 | 21 | Technologies-&-Tools 22 | ============ 23 | 24 | - ReactJS 25 | - SCSS & CSS 26 | - Redux 27 | - AlgoSDK 28 | - Web3.js 29 | - Ethers 30 | 31 | Requirements 32 | ============ 33 | 34 | * NPM and Node installed, download [HERE](https://phoenixnap.com/kb/install-node-js-npm-on-windows) 35 | * [Create-React-app](https://reactjs.org/docs/create-a-new-react-app.html) must be installed 36 | 37 | Run-On-Local-Machine 38 | ============ 39 | 40 | * git clone the repository 41 | 42 | ``` 43 | $ git clone https://github.com/Bhaney44/ChainLinkHackathonSpring2022.git 44 | ``` 45 | * go into `converter-frontend` directory 46 | 47 | ``` 48 | $ cd converter-frontend 49 | ``` 50 | * install app dependencies 51 | ``` 52 | $ npm install 53 | ``` 54 | 55 | * start react scripts 56 | 57 | ``` 58 | $ npm run dev 59 | 60 | ``` 61 | 62 | 63 | Links 64 | ============ 65 | - [web app](https://chainlink-converter.netlify.app/) 66 | 67 | License 68 | ============ 69 | - [Apache](https://github.com/Bhaney44/ChainLinkHackathonSpring2022/blob/main/LICENSE) 70 | 71 | -------------------------------------------------------------------------------- /converter-frontend/config-overrides.js: -------------------------------------------------------------------------------- 1 | const webpack = require("webpack"); 2 | module.exports = function override(config, env) { 3 | config.resolve.fallback = { 4 | crypto: require.resolve("crypto-browserify"), 5 | stream: require.resolve("stream-browserify"), 6 | buffer: require.resolve("buffer"), 7 | }; 8 | config.plugins.push( 9 | new webpack.ProvidePlugin({ 10 | Buffer: ["buffer", "Buffer"], 11 | }) 12 | ); 13 | return config; 14 | }; 15 | -------------------------------------------------------------------------------- /converter-frontend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "frontend", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@alch/alchemy-web3": "~1.1.9", 7 | "@json-rpc-tools/utils": "^1.7.6", 8 | "@loadable/component": "^5.15.0", 9 | "@msgpack/msgpack": "^2.7.2", 10 | "@randlabs/myalgo-connect": "^1.1.2", 11 | "@react-hook/window-size": "^3.0.7", 12 | "@testing-library/jest-dom": "^5.16.3", 13 | "@testing-library/react": "^12.1.4", 14 | "@testing-library/user-event": "^13.5.0", 15 | "@walletconnect/client": "^1.7.7", 16 | "algorand-walletconnect-qrcode-modal": "^1.7.4", 17 | "algosdk": "^1.15.0", 18 | "axios": "^0.24.0", 19 | "chart.js": "^2.8.0", 20 | "dotenv": "^16.0.1", 21 | "ethers": "^5.6.8", 22 | "jquery": "^3.6.0", 23 | "lodash": "^4.17.21", 24 | "react": "~17.0.2", 25 | "react-chartjs-2": "^2.7.6", 26 | "react-copy-to-clipboard": "^5.0.4", 27 | "react-dom": "^17.0.2", 28 | "react-lottie": "^1.2.3", 29 | "react-query": "^3.34.19", 30 | "react-redux": "^7.2.8", 31 | "react-router-dom": "~6.0.2", 32 | "react-scripts": "~4.0.3", 33 | "react-spinners": "^0.11.0", 34 | "react-switch": "^6.0.0", 35 | "sass": "^1.52.1", 36 | "three": "^0.135.0", 37 | "web-vitals": "^2.1.4", 38 | "web3": "^1.7.3" 39 | }, 40 | "scripts": { 41 | "start": "serve -s build", 42 | "dev" : "react-scripts start", 43 | "build": "react-scripts build", 44 | "test": "react-scripts test", 45 | "eject": "react-scripts eject" 46 | }, 47 | "eslintConfig": { 48 | "extends": [ 49 | "react-app", 50 | "react-app/jest" 51 | ] 52 | }, 53 | "browserslist": { 54 | "production": [ 55 | ">0.2%", 56 | "not dead", 57 | "not op_mini all" 58 | ], 59 | "development": [ 60 | "last 1 chrome version", 61 | "last 1 firefox version", 62 | "last 1 safari version" 63 | ] 64 | }, 65 | "devDependencies": { 66 | "buffer": "^6.0.3", 67 | "crypto-browserify": "^3.12.0", 68 | "process": "^0.11.10", 69 | "react-app-rewired": "^2.2.1", 70 | "stream-browserify": "^3.0.0" 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /converter-frontend/public/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bhaney44/ChainLinkHackathonSpring2022/78b53a6ed1a44ca64961707c8dacbeb8c97a662d/converter-frontend/public/.DS_Store -------------------------------------------------------------------------------- /converter-frontend/public/_redirects: -------------------------------------------------------------------------------- 1 | /* /index.html 200 -------------------------------------------------------------------------------- /converter-frontend/public/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | #da532c 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /converter-frontend/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ChainLink Converter - A converter for Algorand and Ethereum using Chainlink 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | 16 | 18 | 20 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /converter-frontend/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bhaney44/ChainLinkHackathonSpring2022/78b53a6ed1a44ca64961707c8dacbeb8c97a662d/converter-frontend/public/logo192.png -------------------------------------------------------------------------------- /converter-frontend/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bhaney44/ChainLinkHackathonSpring2022/78b53a6ed1a44ca64961707c8dacbeb8c97a662d/converter-frontend/public/logo512.png -------------------------------------------------------------------------------- /converter-frontend/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "Link Converter", 3 | "name": "Link Converter", 4 | "description": "Invent a converter for Algorand and Ethereum using Chainlink. The converter will allow interoperability between the two blockchains. A keystone to the converter is goLink.", 5 | "orientation": "portrait", 6 | "Scope": "/", 7 | "icons": [ 8 | { 9 | "src": "favicon.ico", 10 | "sizes": "48x48", 11 | "type": "image/x-icon" 12 | }, 13 | { 14 | "src": "favicon-32x32.png", 15 | "sizes": "32x32", 16 | "type": "image/png" 17 | }, 18 | { 19 | "src": "favicon-16x16.png", 20 | "sizes": "16x16", 21 | "type": "image/png" 22 | }, 23 | { 24 | "src": "/android-chrome-192x192.png", 25 | "sizes": "192x192", 26 | "type": "image/png" 27 | }, 28 | { 29 | "src": "/android-chrome-384x384.png", 30 | "sizes": "384x384", 31 | "type": "image/png" 32 | }, 33 | { 34 | "src": "/apple-touch-icon.png", 35 | "sizes": "180x180", 36 | "type": "image/png" 37 | } 38 | ], 39 | "start_url": "/", 40 | "display": "standalone", 41 | "theme_color": "#000000", 42 | "background_color": "#ffffff" 43 | } -------------------------------------------------------------------------------- /converter-frontend/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /converter-frontend/public/site.webmanifest: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "Link Converter", 3 | "name": "Link Converter", 4 | "description": "Invent a converter for Algorand and Ethereum using Chainlink. The converter will allow interoperability between the two blockchains. A keystone to the converter is goLink.", 5 | "orientation": "portrait", 6 | "Scope": "/", 7 | "icons": [ 8 | { 9 | "src": "favicon.ico", 10 | "sizes": "48x48", 11 | "type": "image/x-icon" 12 | }, 13 | { 14 | "src": "favicon-32x32.png", 15 | "sizes": "32x32", 16 | "type": "image/png" 17 | }, 18 | { 19 | "src": "favicon-16x16.png", 20 | "sizes": "16x16", 21 | "type": "image/png" 22 | }, 23 | { 24 | "src": "/android-chrome-192x192.png", 25 | "sizes": "192x192", 26 | "type": "image/png" 27 | }, 28 | { 29 | "src": "/android-chrome-384x384.png", 30 | "sizes": "384x384", 31 | "type": "image/png" 32 | }, 33 | { 34 | "src": "/apple-touch-icon.png", 35 | "sizes": "180x180", 36 | "type": "image/png" 37 | } 38 | ], 39 | "start_url": "/", 40 | "display": "standalone", 41 | "theme_color": "#000000", 42 | "background_color": "#ffffff" 43 | } -------------------------------------------------------------------------------- /converter-frontend/src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bhaney44/ChainLinkHackathonSpring2022/78b53a6ed1a44ca64961707c8dacbeb8c97a662d/converter-frontend/src/.DS_Store -------------------------------------------------------------------------------- /converter-frontend/src/App.jsx: -------------------------------------------------------------------------------- 1 | import { Suspense } from "react"; 2 | import MainPage from "./pages/MainPage"; 3 | import stores from "./store/stores"; 4 | import AlertModal from "./components/AlertModal"; 5 | import WalletConfirmation from "./components/WalletConfirmation"; 6 | import { Provider as ReduxProvider } from "react-redux"; 7 | import { BrowserRouter as Router } from "react-router-dom"; 8 | import { QueryClient, QueryClientProvider } from "react-query"; 9 | 10 | const renderLoader = () =>

; 11 | 12 | const App = () => { 13 | const queryClient = new QueryClient(); 14 | return ( 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | ); 27 | }; 28 | 29 | export default App; 30 | -------------------------------------------------------------------------------- /converter-frontend/src/assets/c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bhaney44/ChainLinkHackathonSpring2022/78b53a6ed1a44ca64961707c8dacbeb8c97a662d/converter-frontend/src/assets/c.png -------------------------------------------------------------------------------- /converter-frontend/src/assets/correct.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bhaney44/ChainLinkHackathonSpring2022/78b53a6ed1a44ca64961707c8dacbeb8c97a662d/converter-frontend/src/assets/correct.png -------------------------------------------------------------------------------- /converter-frontend/src/components/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bhaney44/ChainLinkHackathonSpring2022/78b53a6ed1a44ca64961707c8dacbeb8c97a662d/converter-frontend/src/components/.DS_Store -------------------------------------------------------------------------------- /converter-frontend/src/components/AlertModal.jsx: -------------------------------------------------------------------------------- 1 | import { useSelector, useDispatch } from "react-redux"; 2 | 3 | const AlertModal = () => { 4 | const darkTheme = useSelector((state) => state.status.darkTheme); 5 | 6 | const dispatch = useDispatch(); 7 | 8 | const { openModal, modalContent } = useSelector( 9 | (state) => state.status.alertModal 10 | ); 11 | 12 | return ( 13 | 17 |
18 |
27 |
{ 44 | dispatch({ type: "close_modal" }); 45 | }} 46 | > 47 | 48 |
49 |
50 | 51 |
58 | <> 59 |
67 |

77 | Alert 78 |

79 |

87 | {modalContent} 88 |

89 |
90 | 91 |
92 |
93 |
94 | ); 95 | }; 96 | 97 | export default AlertModal; 98 | -------------------------------------------------------------------------------- /converter-frontend/src/components/Explorer-Component/EachExplorerData.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import './EachExplorerData.scss'; 3 | import { useWindowSize } from "@react-hook/window-size"; 4 | 5 | const EachData = ({eth, algo, amount}) => { 6 | const [width] = useWindowSize(); 7 | 8 | return( 9 | 10 |
11 | {width > 500 ? `${eth.substring(0, 19)}..` : `${eth.substring(0, 9)}...`} 12 | {width > 500 ? `${algo.substring(0, 19)}..` : `${algo.substring(0, 9)}..`} 13 | {amount} 14 |
15 | 16 | 17 | 18 | 19 | ) 20 | 21 | } 22 | 23 | export default EachData; -------------------------------------------------------------------------------- /converter-frontend/src/components/Explorer-Component/EachExplorerData.scss: -------------------------------------------------------------------------------- 1 | .explorer-item { 2 | width: 100%; 3 | display: flex; 4 | min-height: 30px; 5 | border-bottom: 1px solid darkgrey; 6 | padding: 15px 0; 7 | font-size: 16px; 8 | align-items: center; 9 | 10 | @media screen and (max-width: 760px) { 11 | font-size: 12px; 12 | } 13 | 14 | .eth, 15 | .algo, 16 | .amount { 17 | width: 40%; 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /converter-frontend/src/components/Explorer-Component/ExplorerList.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import './ExplorerList.scss'; 3 | import EachData from "./EachExplorerData"; 4 | 5 | const ExplorerList = ({explorerlist}) => { 6 | return ( 7 |
8 |
9 |
10 | Ethereum Address 11 |
12 |
13 | Algorand Address 14 |
15 |
16 | Amount 17 |
18 |
19 | { 20 | explorerlist.map((data, i) =>{ 21 | return( 22 | 28 | ) 29 | } ) 30 | } 31 | 32 | 33 |
34 | ) 35 | } 36 | 37 | export default ExplorerList; -------------------------------------------------------------------------------- /converter-frontend/src/components/Explorer-Component/ExplorerList.scss: -------------------------------------------------------------------------------- 1 | @import url('https://fonts.googleapis.com/css2?family=Anybody&family=Roboto+Flex:opsz@8..144&display=swap'); 2 | 3 | .explorer-page { 4 | width: 70%; 5 | min-height: 90vh; 6 | display: flex; 7 | flex-direction : column; 8 | align-items: center; 9 | margin: 50px auto 0; 10 | 11 | .explorer-header { 12 | width: 100%; 13 | height: 40px; 14 | display: flex; 15 | justify-content : space-between; 16 | border-bottom: 2.1px solid blue; 17 | margin-left: 20px ; 18 | 19 | @media screen and (max-width: 800px){ 20 | width : 71vw; 21 | margin-left: 30px; 22 | 23 | } 24 | 25 | @media screen and (max-width: 500px) and (min-width: 300px) { 26 | margin-left: -2px; 27 | } 28 | .header-block { 29 | text-transform: capitalize; 30 | width: 23%; 31 | 32 | @media screen and (max-width: 800px){ 33 | margin-right: 10px; 34 | margin-left: 10px; 35 | } 36 | 37 | span { 38 | font-family: 'Roboto Flex', sans-serif !important; 39 | } 40 | 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /converter-frontend/src/components/Navigation/MobileNav.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import './MobileNav.scss'; 3 | 4 | const MobileNav = ({NavLink}) => { 5 | 6 | const isWalletConnected = 7 | localStorage.getItem("wallet-type") === null ? false : true; 8 | 9 | const LogOut = () => { 10 | localStorage.removeItem("address"); 11 | localStorage.removeItem("addresses"); 12 | localStorage.removeItem("wallet-type"); 13 | localStorage.removeItem("walletconnect"); 14 | localStorage.removeItem("metaAddresses"); 15 | localStorage.removeItem("metaAddress"); 16 | window.location.reload(); 17 | console.log("data"); 18 | }; 19 | 20 | return ( 21 | 22 |
34 |
35 |
36 |
37 | 40 |
41 | 42 |
43 |
44 | 45 | 48 |

49 | Converter 50 |

51 |
52 |
53 |
56 | 60 |

61 | Explorer 62 |

63 |
64 |
65 | { 66 | isWalletConnected ? 67 |
70 | 71 |

72 | Disconnect 73 |

74 |
: null 75 | } 76 | 77 | 78 |
79 |
80 |
81 |
82 | ) 83 | } 84 | 85 | export default MobileNav; -------------------------------------------------------------------------------- /converter-frontend/src/components/Navigation/MobileNav.scss: -------------------------------------------------------------------------------- 1 | .navigation { 2 | border: none !important; 3 | } -------------------------------------------------------------------------------- /converter-frontend/src/components/Navigation/NavBar.jsx: -------------------------------------------------------------------------------- 1 | import algosdk from "algosdk"; 2 | import { useDispatch, useSelector } from "react-redux"; 3 | import { useEffect, useState} from "react"; 4 | import MyAlgoConnect from "@randlabs/myalgo-connect"; 5 | import img from '../../assets/c.png'; 6 | import { CopyToClipboard } from "react-copy-to-clipboard"; 7 | import corect from '../../assets/correct.png'; 8 | import {Link} from 'react-router-dom'; 9 | import WalletConnect from "@walletconnect/client"; 10 | import QRCodeModal from "algorand-walletconnect-qrcode-modal"; 11 | import {ethers} from 'ethers'; 12 | import { useWindowSize } from "@react-hook/window-size"; 13 | 14 | 15 | 16 | const NavBar = ({NavLink}) => { 17 | const dispatch = useDispatch(); 18 | const ASSET_ID = 89483596; 19 | 20 | const addressNum = useSelector((state) => state.status.addressNum); 21 | const isWalletConnected = 22 | localStorage.getItem("wallet-type") === null ? false : true; 23 | 24 | const [copyToClipBoard , setCopyToClipBoard] = useState(null) 25 | 26 | const handyCopyToClipBoard = () => { 27 | setCopyToClipBoard(true) 28 | setTimeout(() => { 29 | setCopyToClipBoard(false) 30 | 31 | }, 500); 32 | } 33 | 34 | const [width] = useWindowSize(); 35 | 36 | const LogOut = () => { 37 | localStorage.removeItem("address"); 38 | localStorage.removeItem("addresses"); 39 | localStorage.removeItem("wallet-type"); 40 | localStorage.removeItem("walletconnect"); 41 | localStorage.removeItem("metaAddresses"); 42 | localStorage.removeItem("metaAddress"); 43 | window.location.reload(); 44 | console.log("data"); 45 | }; 46 | 47 | 48 | 49 | const [balance, setBalance] = useState([]); 50 | 51 | const algodClient = new algosdk.Algodv2( 52 | { 53 | "X-API-Key": "", //your API key gotten from purestake API, 54 | }, 55 | "https://testnet-algorand.api.purestake.io/ps2", 56 | "" 57 | ); 58 | 59 | const walletAddress = localStorage.getItem("address"); 60 | const eth_address = localStorage.getItem("metaAddress") 61 | const addresses = localStorage.getItem("addresses")?.split(","); 62 | 63 | let addrArr = []; 64 | 65 | useEffect(() => { 66 | if(walletAddress) { 67 | addresses?.forEach(async (item) => { 68 | const myAccountInfo = await algodClient.accountInformation(item).do(); 69 | const bal = 70 | myAccountInfo.assets.find((element) => element["asset-id"] === ASSET_ID) 71 | ?.amount / 1000000; 72 | 73 | 74 | addrArr.push({ balance: !!bal ? bal : 0, address: item }); 75 | 76 | 77 | 78 | dispatch({ 79 | type: "getBalance", 80 | balance : addrArr 81 | }) 82 | 83 | 84 | if (addrArr?.length === addresses?.length) { 85 | dispatch({ 86 | type: "setAlgoAddress", 87 | addressIndex: 0, 88 | addr: addrArr[0]?.address, 89 | }); 90 | setBalance(addrArr); 91 | 92 | } 93 | }); 94 | } 95 | else if(eth_address) { 96 | // const bal = async () => await getAccountBalance(eth_address) 97 | // console.log(bal) 98 | 99 | 100 | // Requesting balance method 101 | window.ethereum 102 | .request({ 103 | method: "eth_getBalance", 104 | params: [eth_address, "latest"] 105 | }) 106 | .then((bal) => { 107 | const eth_bal = ethers.utils.formatEther(bal) 108 | addrArr.push({ 109 | balance : Number(eth_bal).toFixed(2) , 110 | address: eth_address 111 | }) 112 | setBalance(addrArr) 113 | dispatch({ 114 | type: "getBalance", 115 | balance : addrArr 116 | }) 117 | }) 118 | } 119 | 120 | 121 | 122 | 123 | // eslint-disable-next-line react-hooks/exhaustive-deps 124 | }, []); 125 | 126 | const myAlgoConnect = async () => { 127 | dispatch({ 128 | type: "confirm_wallet", 129 | alertContent : "Connecting MyAlgo wallet" 130 | }) 131 | 132 | const myAlgoWallet = new MyAlgoConnect({ shouldSelectOneAccount: false }); 133 | 134 | try { 135 | const accounts = await myAlgoWallet.connect({ 136 | shouldSelectOneAccount: true, 137 | }); 138 | console.log(accounts, 'accounts') 139 | const addresses = accounts.map((item) => item?.address); 140 | const address = accounts[0].address; 141 | 142 | console.log(address, 'address') 143 | console.log(addresses, 'addresses') 144 | 145 | // close modal. 146 | localStorage.setItem("wallet-type", "my-algo"); 147 | localStorage.setItem("address", address); 148 | localStorage.setItem("addresses", addresses); 149 | 150 | window.location.reload(); 151 | } catch (error) { 152 | dispatch({ 153 | type: "close_wallet" 154 | }) 155 | 156 | dispatch({ 157 | type: "alert_modal", 158 | alertContent: 159 | "Error occurred while connecting wallet, Try again later.", 160 | }) 161 | console.log(error); 162 | } 163 | }; 164 | 165 | const connectWallet = () => { 166 | 167 | const connector = new WalletConnect({ 168 | bridge: "https://bridge.walletconnect.org", 169 | qrcodeModal: QRCodeModal, 170 | }); 171 | 172 | if (!connector.connected) { 173 | 174 | connector.createSession(); 175 | 176 | } 177 | 178 | connector.on("connect", (error, payload) => { 179 | if (error) { 180 | dispatch({ 181 | type: "confirm_wallet", 182 | alertContent : "Error Connecting Pera wallet" 183 | }) 184 | setTimeout(() => { 185 | dispatch({ 186 | type: "close_wallet" 187 | }) 188 | }, 2000) 189 | throw error; 190 | 191 | } 192 | 193 | dispatch({ 194 | type: "close_wallet" 195 | }) 196 | 197 | 198 | const { accounts } = payload.params[0]; 199 | 200 | const addresses = accounts.map((item) => item); 201 | const address = accounts[0]; 202 | 203 | localStorage.setItem("wallet-type", "walletconnect"); 204 | localStorage.setItem("address", address); 205 | localStorage.setItem("addresses", addresses); 206 | 207 | window.location.reload(); 208 | }); 209 | 210 | connector.on("session_update", (error, payload) => { 211 | if (error) { 212 | dispatch({ 213 | type: "confirm_wallet", 214 | alertContent : "Error Connecting Pera wallet" 215 | }) 216 | setTimeout(() => { 217 | dispatch({ 218 | type: "close_wallet" 219 | }) 220 | }, 2000) 221 | throw error; 222 | } 223 | 224 | const { accounts } = payload.params[0]; 225 | 226 | const addresses = accounts.map((item) => item); 227 | const address = accounts[0]; 228 | 229 | localStorage.setItem("wallet-type", "walletconnect"); 230 | localStorage.setItem("address", address); 231 | localStorage.setItem("addresses", addresses); 232 | 233 | window.location.reload(); 234 | }); 235 | 236 | connector.on("disconnect", (error, payload) => { 237 | if (error) { 238 | dispatch({ 239 | type: "confirm_wallet", 240 | alertContent : "Error Connecting Pera wallet" 241 | }) 242 | 243 | setTimeout(() => { 244 | dispatch({ 245 | type: "close_wallet" 246 | }) 247 | }, 2000) 248 | 249 | console.log(error); 250 | } 251 | }); 252 | }; 253 | 254 | const metamaskConnection = async ()=> { 255 | 256 | dispatch({ 257 | type: "confirm_wallet", 258 | alertContent : "Connecting to metamask" 259 | }) 260 | // Check if MetaMask is installed on user's browser 261 | if(window.ethereum) { 262 | const account = await window.ethereum.request({ method: "eth_requestAccounts" }); 263 | console.log(account, "accounts"); 264 | 265 | const addresses = account 266 | const metaAddress = account[0]; 267 | 268 | console.log(metaAddress, 'metaAddress'); 269 | console.log(addresses, 'metaAddresses'); 270 | 271 | localStorage.setItem("wallet-type", "metamask"); 272 | localStorage.setItem("metaAddress", metaAddress); 273 | localStorage.setItem("metaAddresses", addresses); 274 | 275 | window.location.reload(); 276 | 277 | // const chainId = await window.ethereum.request({ method: 'eth_chainId'}); 278 | } else { 279 | // Show alert if Ethereum provider is not detected 280 | dispatch({ 281 | type: "close_wallet" 282 | }) 283 | 284 | dispatch({ 285 | type: "alert_modal", 286 | alertContent: "Please Install MetaMask!", 287 | }); 288 | } 289 | 290 | } 291 | 292 | const algoSignerConnect = async () => { 293 | 294 | try { 295 | dispatch({ 296 | type: "confirm_wallet", 297 | alertContent : "Connecting Algosigner wallet" 298 | }) 299 | 300 | if (typeof window.AlgoSigner === "undefined") { 301 | 302 | dispatch({ 303 | type: "confirm_wallet", 304 | alertContent : "ALgosigner is not set up yet." 305 | }) 306 | setTimeout(() => { 307 | dispatch({ 308 | type: "close_wallet" 309 | }) 310 | }, 4000) 311 | window.open( 312 | "https://chrome.google.com/webstore/detail/algosigner/kmmolakhbgdlpkjkcjkebenjheonagdm", 313 | "_blank" 314 | ); 315 | } else { 316 | await window.AlgoSigner.connect({ 317 | ledger: "TestNet", 318 | }); 319 | const accounts = await window.AlgoSigner.accounts({ 320 | ledger: "TestNet", 321 | }); 322 | 323 | const addresses = accounts.map((item) => item?.address); 324 | const address = accounts[0].address; 325 | 326 | 327 | // close modal. 328 | localStorage.setItem("wallet-type", "algosigner"); 329 | localStorage.setItem("address", address); 330 | localStorage.setItem("addresses", addresses); 331 | 332 | window.location.reload(); 333 | } 334 | } catch (error) { 335 | dispatch({ 336 | type: "close_wallet" 337 | }) 338 | 339 | dispatch({ 340 | type: "alert_modal", 341 | alertContent: "AlgoSigner not set up yet!", 342 | }); 343 | } 344 | }; 345 | 346 | 347 | 348 | return ( 349 |
350 |
351 | 359 | logo 360 | 361 | 362 |
369 | {!!isWalletConnected? ( 370 | <> 371 |
372 |
373 |
374 |
375 | {balance[addressNum]?.balance} chain logo 376 |
377 | 378 | 379 |
380 |

{balance[addressNum]?.address}

381 | {copyToClipBoard ? (check) : ( handyCopyToClipBoard()} className="uil uil-copy">)} 383 | 384 |
385 |
386 |
387 |
388 | 389 |
390 | {balance?.map((item, index) => { 391 | return ( 392 |
{ 396 | // dispatch({ 397 | // type: "setAlgoAddress", 398 | // addressIndex: index, 399 | // addr: item.address, 400 | // }); 401 | // }} 402 | > 403 |

404 | {item.address} 405 |

406 |
407 | ); 408 | })} 409 |
410 |
411 | 412 | ) : ( 413 |
414 |
415 | 424 |
425 | 426 |
427 |
428 |
429 | 433 |
434 |

My Algo Wallet

435 |
436 |
440 |
441 | 445 |
446 |

447 | MetaMask 448 |

449 |
450 | 451 |
455 |
456 | 460 |
461 |

462 | {typeof window.AlgoSigner === undefined 463 | ? "Install AlgoSigner" 464 | : "AlgoSigner"} 465 |

466 |
467 | 468 |
469 |
470 | 474 |
475 |

476 | Pera Wallet 477 |

478 |
479 |
480 |
481 | )} 482 |
483 |
484 | 485 | 486 |
600 ? "var(--background)" : "initial", 499 | height: width>600 ? "var(--sm-hd-height-half)" : "0px", 500 | justifyContent: "space-between", 501 | borderTop: "1px solid var(--border-default)", 502 | }} 503 | > 504 | {width > 600 && ( 505 |
    506 |
  • 507 | { 509 | return { 510 | color : isActive ? "var(--nav-active)" : "var(--nav-not-active)", 511 | display: "flex", 512 | opacity: isActive ? "1" : "0.6", 513 | alignItems: "center", 514 | flexDirection: "column", 515 | }; 516 | }} 517 | to={`/`} 518 | key={"home"} 519 | > 520 | Home 521 | 522 |
  • 523 | 524 |
  • 525 | { 527 | return { 528 | color : isActive ? "var(--nav-active)" : "var(--nav-not-active)", 529 | display: "flex", 530 | opacity: isActive ? "1" : "0.6", 531 | alignItems: "center", 532 | flexDirection: "column", 533 | }; 534 | }} 535 | to={`/converter`} 536 | key={"converter"} 537 | > 538 | converter 539 | 540 |
  • 541 | 542 |
  • 543 | { 545 | return { 546 | color : isActive ? "var(--nav-active)" : "var(--nav-not-active)", 547 | display: "flex", 548 | opacity: isActive ? "1" : "0.6", 549 | alignItems: "center", 550 | flexDirection: "column", 551 | }; 552 | }} 553 | to={`/explorer`} 554 | key={"explorer"} 555 | > 556 | Explorer 557 | 558 |
  • 559 | 560 | 561 |
  • {isWalletConnected ? "Disconnect" : null}
  • 562 |
563 | )} 564 | 565 | {/*

{isWalletConnected ? "Disconnect ☎️" : null}

*/} 566 | 567 |
568 |
569 | ); 570 | }; 571 | 572 | export default NavBar; 573 | -------------------------------------------------------------------------------- /converter-frontend/src/components/Scroll.jsx: -------------------------------------------------------------------------------- 1 | const Scroll = ({ word }) => { 2 | return ( 3 |
4 |
5 |
6 |

20 | {word} 21 | 22 |

23 |
24 | 25 |
26 |

40 | {word} 41 | {/* */} 42 | 43 | {/* */} 44 | 45 |

46 |
47 |
48 |

62 | {word} 63 | 64 |

65 |
66 |
67 |

80 | {word} 81 | 82 |

83 |
84 |
85 |
86 | ); 87 | }; 88 | export default Scroll; 89 | -------------------------------------------------------------------------------- /converter-frontend/src/components/Search-Input/Search-Input.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import './Search-Input.scss'; 3 | 4 | 5 | const SearchInput = ({searchChange}) => { 6 | return( 7 |
8 | 11 | 12 |
13 | ); 14 | 15 | } 16 | 17 | export default SearchInput; -------------------------------------------------------------------------------- /converter-frontend/src/components/Search-Input/Search-Input.scss: -------------------------------------------------------------------------------- 1 | .search { 2 | display: flex; 3 | text-align: center; 4 | justify-content: center; 5 | margin-top: 154px; 6 | 7 | input { 8 | border: solid 2px grey; 9 | width : 30vw; 10 | border-radius: 10px; 11 | height: 35px; 12 | background-color: lightblue; 13 | text-align: center; 14 | 15 | @media screen and (max-width : 600px) { 16 | width: 60vw; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /converter-frontend/src/components/WalletConfirmation.jsx: -------------------------------------------------------------------------------- 1 | import { useSelector, useDispatch } from "react-redux"; 2 | import BarLoader from "react-spinners/BarLoader"; 3 | 4 | const WalletConfirmation = () => { 5 | const dispatch = useDispatch() 6 | const { openWallet, walletContent } = useSelector( 7 | (state) => state.status.confirmWallet 8 | ); 9 | 10 | return( 11 |
33 | 34 |
{ 52 | dispatch({ type: "close_wallet" }); 53 | }} 54 | > 55 | 56 |
57 | 58 |

66 | {walletContent} 67 |

68 | 75 | 76 |
77 | ) 78 | } 79 | 80 | export default WalletConfirmation; -------------------------------------------------------------------------------- /converter-frontend/src/contract-ABI/chainlink.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "stateMutability": "nonpayable", 5 | "type": "constructor" 6 | }, 7 | { 8 | "anonymous": false, 9 | "inputs": [ 10 | { 11 | "indexed": true, 12 | "internalType": "address", 13 | "name": "owner", 14 | "type": "address" 15 | }, 16 | { 17 | "indexed": true, 18 | "internalType": "address", 19 | "name": "spender", 20 | "type": "address" 21 | }, 22 | { 23 | "indexed": false, 24 | "internalType": "uint256", 25 | "name": "value", 26 | "type": "uint256" 27 | } 28 | ], 29 | "name": "Approval", 30 | "type": "event" 31 | }, 32 | { 33 | "anonymous": false, 34 | "inputs": [ 35 | { 36 | "indexed": true, 37 | "internalType": "address", 38 | "name": "from", 39 | "type": "address" 40 | }, 41 | { 42 | "indexed": true, 43 | "internalType": "address", 44 | "name": "to", 45 | "type": "address" 46 | }, 47 | { 48 | "indexed": false, 49 | "internalType": "uint256", 50 | "name": "value", 51 | "type": "uint256" 52 | } 53 | ], 54 | "name": "Transfer", 55 | "type": "event" 56 | }, 57 | { 58 | "inputs": [ 59 | { 60 | "internalType": "address", 61 | "name": "owner", 62 | "type": "address" 63 | }, 64 | { 65 | "internalType": "address", 66 | "name": "spender", 67 | "type": "address" 68 | } 69 | ], 70 | "name": "allowance", 71 | "outputs": [ 72 | { 73 | "internalType": "uint256", 74 | "name": "", 75 | "type": "uint256" 76 | } 77 | ], 78 | "stateMutability": "view", 79 | "type": "function" 80 | }, 81 | { 82 | "inputs": [ 83 | { 84 | "internalType": "address", 85 | "name": "spender", 86 | "type": "address" 87 | }, 88 | { 89 | "internalType": "uint256", 90 | "name": "amount", 91 | "type": "uint256" 92 | } 93 | ], 94 | "name": "approve", 95 | "outputs": [ 96 | { 97 | "internalType": "bool", 98 | "name": "", 99 | "type": "bool" 100 | } 101 | ], 102 | "stateMutability": "nonpayable", 103 | "type": "function" 104 | }, 105 | { 106 | "inputs": [ 107 | { 108 | "internalType": "address", 109 | "name": "account", 110 | "type": "address" 111 | } 112 | ], 113 | "name": "balanceOf", 114 | "outputs": [ 115 | { 116 | "internalType": "uint256", 117 | "name": "", 118 | "type": "uint256" 119 | } 120 | ], 121 | "stateMutability": "view", 122 | "type": "function" 123 | }, 124 | { 125 | "inputs": [], 126 | "name": "decimals", 127 | "outputs": [ 128 | { 129 | "internalType": "uint8", 130 | "name": "", 131 | "type": "uint8" 132 | } 133 | ], 134 | "stateMutability": "view", 135 | "type": "function" 136 | }, 137 | { 138 | "inputs": [ 139 | { 140 | "internalType": "address", 141 | "name": "spender", 142 | "type": "address" 143 | }, 144 | { 145 | "internalType": "uint256", 146 | "name": "subtractedValue", 147 | "type": "uint256" 148 | } 149 | ], 150 | "name": "decreaseAllowance", 151 | "outputs": [ 152 | { 153 | "internalType": "bool", 154 | "name": "", 155 | "type": "bool" 156 | } 157 | ], 158 | "stateMutability": "nonpayable", 159 | "type": "function" 160 | }, 161 | { 162 | "inputs": [ 163 | { 164 | "internalType": "address", 165 | "name": "spender", 166 | "type": "address" 167 | }, 168 | { 169 | "internalType": "uint256", 170 | "name": "addedValue", 171 | "type": "uint256" 172 | } 173 | ], 174 | "name": "increaseAllowance", 175 | "outputs": [ 176 | { 177 | "internalType": "bool", 178 | "name": "", 179 | "type": "bool" 180 | } 181 | ], 182 | "stateMutability": "nonpayable", 183 | "type": "function" 184 | }, 185 | { 186 | "inputs": [], 187 | "name": "name", 188 | "outputs": [ 189 | { 190 | "internalType": "string", 191 | "name": "", 192 | "type": "string" 193 | } 194 | ], 195 | "stateMutability": "view", 196 | "type": "function" 197 | }, 198 | { 199 | "inputs": [], 200 | "name": "symbol", 201 | "outputs": [ 202 | { 203 | "internalType": "string", 204 | "name": "", 205 | "type": "string" 206 | } 207 | ], 208 | "stateMutability": "view", 209 | "type": "function" 210 | }, 211 | { 212 | "inputs": [], 213 | "name": "totalSupply", 214 | "outputs": [ 215 | { 216 | "internalType": "uint256", 217 | "name": "", 218 | "type": "uint256" 219 | } 220 | ], 221 | "stateMutability": "view", 222 | "type": "function" 223 | }, 224 | { 225 | "inputs": [ 226 | { 227 | "internalType": "address", 228 | "name": "to", 229 | "type": "address" 230 | }, 231 | { 232 | "internalType": "uint256", 233 | "name": "amount", 234 | "type": "uint256" 235 | } 236 | ], 237 | "name": "transfer", 238 | "outputs": [ 239 | { 240 | "internalType": "bool", 241 | "name": "", 242 | "type": "bool" 243 | } 244 | ], 245 | "stateMutability": "nonpayable", 246 | "type": "function" 247 | }, 248 | { 249 | "inputs": [ 250 | { 251 | "internalType": "address", 252 | "name": "from", 253 | "type": "address" 254 | }, 255 | { 256 | "internalType": "address", 257 | "name": "to", 258 | "type": "address" 259 | }, 260 | { 261 | "internalType": "uint256", 262 | "name": "amount", 263 | "type": "uint256" 264 | } 265 | ], 266 | "name": "transferFrom", 267 | "outputs": [ 268 | { 269 | "internalType": "bool", 270 | "name": "", 271 | "type": "bool" 272 | } 273 | ], 274 | "stateMutability": "nonpayable", 275 | "type": "function" 276 | } 277 | ] -------------------------------------------------------------------------------- /converter-frontend/src/index.jsx: -------------------------------------------------------------------------------- 1 | import "./styles/index.css"; 2 | import React from "react"; 3 | import ReactDOM from "react-dom"; 4 | import App from "./App"; 5 | 6 | ReactDOM.render( 7 | 8 | 9 | , 10 | document.getElementById("root") 11 | ); 12 | -------------------------------------------------------------------------------- /converter-frontend/src/pages/ExplorerPage/ExplorerPage.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import SearchInput from "../../components/Search-Input/Search-Input"; 3 | import ExplorerList from "../../components/Explorer-Component/ExplorerList"; 4 | import { useEffect, useState } from "react"; 5 | import BarLoader from 'react-spinners/BarLoader'; 6 | import axios from "axios"; 7 | const ExplorerPage = () => { 8 | const [data, setData] = useState([]); 9 | const [searchField, setSearchField] = useState(''); 10 | 11 | const onSearchChange = (event) => { 12 | setSearchField(event.target.value); 13 | } 14 | // eslint-disable-next-line 15 | const filteredData = data.filter(address =>{ 16 | if(address.algo_address.toLowerCase().includes(searchField.toLowerCase())) { 17 | return address.algo_address.toLowerCase().includes(searchField.toLowerCase()) 18 | } else if(address.eth_address.toLowerCase().includes(searchField.toLowerCase())) { 19 | return address.eth_address.toLowerCase().includes(searchField.toLowerCase()); 20 | } 21 | 22 | 23 | }) 24 | 25 | useEffect(() => { 26 | axios.get('https://chainlink-backend.herokuapp.com/explorer/data') 27 | .then((response => { 28 | setData(response.data.data) 29 | } 30 | 31 | )) 32 | }, []) 33 | return ( 34 |
35 | 36 | { 37 | !data.length ? ( 38 |
52 |

LOADING...

53 | 59 |
60 | ) : 61 | 62 | } 63 | 64 |
65 | ) 66 | 67 | } 68 | export default ExplorerPage; -------------------------------------------------------------------------------- /converter-frontend/src/pages/LandingPage/LandingPage.jsx: -------------------------------------------------------------------------------- 1 | import './LandingPage.scss'; 2 | 3 | const LandingPage = () => { 4 | return( 5 |
6 | 7 |
8 |
9 |

10 | ChainLink Converter: Focusing narrowly on the interoperability problem between two blockchains, Ethereum and 11 | Algorand 12 |

13 |

14 | Inventing a converter for Algorand and Ethereum using Chainlink. The converter will allow interoperability between the two blockchains. A keystone to the converter is goLink. goLink allows for LINK transactions on the Algorand blockcahin, while the Chainlink Converter allows for asset movement between the Algorand and Ethereum blockchains. 15 |
16 |
17 | The Converter processes data from the Algorand blockchain which is sent to a Chainlink node for validation and then processed by a smart contract for on-chain distribution of LINK on Ethereum. Thus, Chainlink allows for the converter to operate in bi-lateral fashion, from Ethereum to Algorand and visa versa. As such, the Chainlink Converter strives to solve the interoperability problem between Algorand and Ethereum for Chainlink. 18 |

19 |
20 |
21 |
22 | ) 23 | } 24 | 25 | export default LandingPage; -------------------------------------------------------------------------------- /converter-frontend/src/pages/LandingPage/LandingPage.scss: -------------------------------------------------------------------------------- 1 | .landing { 2 | width: 100vw; 3 | overflow: hidden; 4 | position: relative; 5 | padding: var(--sm-hd-height) 0vw 0px; 6 | color: var(--txt-alt); 7 | 8 | display: flex; 9 | align-items: center; 10 | flex-direction: column; 11 | } 12 | /* **************** */ 13 | .land_cov { 14 | z-index: 2; 15 | padding-top: 4vh; 16 | 17 | width: var(--container-width); 18 | max-width: 85vw; 19 | margin-bottom: 15vh; 20 | } 21 | 22 | .landing .Marquee__Wrapper { 23 | margin: 0px !important; 24 | padding-top: 0px !important; 25 | } 26 | 27 | .land_item1 { 28 | width: 100%; 29 | color: var(--wht); 30 | } 31 | .land_item1 .hdy { 32 | opacity: 0.9; 33 | display: flex; 34 | font-size: 33px; 35 | margin: 13px 0px; 36 | font-weight: 400; 37 | line-height: 45px; 38 | margin-bottom: 30px; 39 | letter-spacing: 0.7px; 40 | } 41 | 42 | .land_item1 .suby { 43 | opacity: 0.7; 44 | display: flex; 45 | font-weight: 400; 46 | margin: 13px 0px; 47 | line-height: 23px; 48 | letter-spacing: 0.3px; 49 | } 50 | 51 | .light_theme .land_item1 .hdy { 52 | font-weight: 500; 53 | } 54 | .light_theme .land_item1 .suby { 55 | font-weight: 500; 56 | opacity: 0.9; 57 | } 58 | 59 | .land_item2 { 60 | width: 100%; 61 | min-height: 250px; 62 | padding: 20px; 63 | margin: 0px 0px 70px; 64 | border-radius: 20px; 65 | position: relative; 66 | overflow: hidden; 67 | border-bottom-left-radius: 180px; 68 | /* background: var(--back-1); */ 69 | } -------------------------------------------------------------------------------- /converter-frontend/src/pages/MainPage.jsx: -------------------------------------------------------------------------------- 1 | import NavBar from "../components/Navigation/NavBar"; 2 | import Scroll from "../components/Scroll"; 3 | import { NavLink, Route, Routes } from "react-router-dom"; 4 | import { useWindowSize } from "@react-hook/window-size"; 5 | import Converter from "./ConverterPage/Converter"; 6 | import ExplorerPage from "./ExplorerPage/ExplorerPage"; 7 | import LandingPage from "./LandingPage/LandingPage"; 8 | import MobileNav from "../components/Navigation/MobileNav"; 9 | 10 | const MainPage = () => { 11 | 12 | const [width] = useWindowSize(); 13 | 14 | 15 | return ( 16 |
20 |
35 | 36 | { 37 | width < 600 ? : null 38 | } 39 | 40 | 41 | 42 | } /> 43 | } /> 44 | } /> 45 | 46 | 47 |
48 | ); 49 | }; 50 | 51 | export default MainPage; 52 | -------------------------------------------------------------------------------- /converter-frontend/src/store/reducers.js: -------------------------------------------------------------------------------- 1 | import { combineReducers } from "redux"; 2 | 3 | const status = ( 4 | state = { 5 | 6 | alertModal: { openModal: false, modalContent: "" }, 7 | confirmWallet: { openWallet: false, walletContent: ""}, 8 | addressNum: 0, 9 | address: null, 10 | balance : [] 11 | }, 12 | action 13 | ) => { 14 | switch (action.type) { 15 | 16 | case "getBalance" : 17 | return {...state, balance : action.balance} 18 | 19 | case "setAlgoAddress" : 20 | localStorage.setItem("address", `${action?.addr}`); 21 | return { ...state, addressNum: action.addressIndex }; 22 | 23 | case "alert_modal": 24 | return { 25 | ...state, 26 | alertModal: { openModal: true, modalContent: action.alertContent }, 27 | }; 28 | 29 | 30 | case "close_modal": 31 | return { ...state, alertModal: { openModal: false, modalContent: "" } }; 32 | 33 | case "confirm_wallet": 34 | return {...state, confirmWallet : { openWallet : true, walletContent: action.alertContent }} ; 35 | 36 | case "close_wallet" : 37 | return {...state, confirmWallet : {openWallet : false, walletContent : ""} }; 38 | default: 39 | return state; 40 | } 41 | }; 42 | 43 | export default combineReducers({ status }); 44 | -------------------------------------------------------------------------------- /converter-frontend/src/store/stores.js: -------------------------------------------------------------------------------- 1 | import { createStore } from "redux"; 2 | import rootReducer from "./reducers"; 3 | 4 | let initialState = {}; 5 | 6 | const store = createStore(rootReducer, initialState); 7 | export default store; 8 | -------------------------------------------------------------------------------- /converter-frontend/src/styles/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bhaney44/ChainLinkHackathonSpring2022/78b53a6ed1a44ca64961707c8dacbeb8c97a662d/converter-frontend/src/styles/.DS_Store -------------------------------------------------------------------------------- /converter-frontend/src/styles/converter.css: -------------------------------------------------------------------------------- 1 | .create_elt { 2 | width: 100%; 3 | min-height: 50vh; 4 | position: relative; 5 | display: flex; 6 | color: var(--txt-alt); 7 | padding: 15vh 5vw 5vh; 8 | flex-direction: column; 9 | 10 | font-weight: 400; 11 | 12 | align-items: center; 13 | } 14 | 15 | .create_elt_inn { 16 | width: 420px; 17 | max-width: 88vw; 18 | } 19 | 20 | .crt_hd { 21 | display: flex; 22 | font-size: 15px; 23 | color: var(--wht); 24 | text-transform: uppercase; 25 | letter-spacing: 1px; 26 | padding: 15px 0px 16px; 27 | font-family: "Barlow", sans-serif; 28 | 29 | position: -webkit-sticky; 30 | position: sticky; 31 | z-index: 2; 32 | top: calc(var(--sm-hd-height)); 33 | border-bottom: 1px solid var(--border-default); 34 | } 35 | .crt_hd p { 36 | opacity: 0.7; 37 | } 38 | 39 | .light_theme .crt_hd, 40 | .light_theme .create_elt { 41 | font-weight: 500; 42 | } 43 | 44 | .vote_sect { 45 | width: 100%; 46 | display: flex; 47 | padding: 20px 0px; 48 | justify-content: center; 49 | flex-direction: column; 50 | } 51 | .vote_sect_img { 52 | display: flex; 53 | flex-direction: row; 54 | margin-bottom: 20px; 55 | align-items: center; 56 | } 57 | .vote_hd_img { 58 | width: 50px; 59 | height: 50px; 60 | overflow: hidden; 61 | display: flex; 62 | font-size: 20px; 63 | justify-content: center; 64 | align-items: center; 65 | margin-right: 30px; 66 | background: var(--back-1); 67 | border: 1px solid var(--back-1); 68 | } 69 | .vote_hd_img img { 70 | width: 100%; 71 | } 72 | 73 | .vote_add_img { 74 | flex: 1; 75 | display: flex; 76 | font-size: 13px; 77 | font-weight: 500; 78 | line-height: 14px; 79 | border-radius: 8px; 80 | padding: 15px 20px; 81 | letter-spacing: 1px; 82 | color: var(--white); 83 | align-items: center; 84 | justify-content: center; 85 | text-transform: uppercase; 86 | background: var(--back-1); 87 | cursor: pointer; 88 | } 89 | .vote_add_img p { 90 | opacity: 0.7; 91 | color: var(--wht); 92 | } 93 | 94 | .v_r1 { 95 | display: flex; 96 | align-items: center; 97 | flex-direction: row; 98 | justify-content: space-between; 99 | } 100 | 101 | .v_inp_cov { 102 | width: calc(50% - 10px); 103 | margin: 0px 0px 25px; 104 | } 105 | 106 | .inpCont_full { 107 | width: 100%; 108 | } 109 | 110 | .inpCont_cand { 111 | width: 100%; 112 | } 113 | 114 | .v_inp_cov .inp_tit { 115 | font-size: 15px; 116 | margin-bottom: 12px; 117 | padding-left: 2px; 118 | color: var(--wht); 119 | opacity: 0.7; 120 | } 121 | 122 | .v_inp_cov input { 123 | width: 100%; 124 | 125 | /* Might be removed */ 126 | flex: 1; 127 | 128 | font-size: 15px; 129 | padding: 10px 12px; 130 | border-radius: 12px; 131 | border: 1px solid var(--bord-dark); 132 | } 133 | 134 | .v_inp_cov input::placeholder { 135 | font-size: 14px; 136 | letter-spacing: 0.3px; 137 | } 138 | 139 | .add_item_sect { 140 | display: flex; 141 | flex-direction: column; 142 | } 143 | 144 | .add_item_sect_r1 { 145 | display: flex; 146 | width: 100%; 147 | align-items: center; 148 | flex-direction: row; 149 | } 150 | 151 | .item_img_preview { 152 | width: 40px; 153 | height: 40px; 154 | overflow: hidden; 155 | display: flex; 156 | font-size: 18px; 157 | justify-content: center; 158 | align-items: center; 159 | margin-left: 15px; 160 | border-radius: 100%; 161 | background: var(--back-1); 162 | border: 1px solid var(--back-1); 163 | } 164 | .item_img_preview img { 165 | width: 100%; 166 | } 167 | 168 | .addItemButt { 169 | flex: 1; 170 | display: flex; 171 | font-size: 13px; 172 | font-weight: 500; 173 | line-height: 14px; 174 | border-radius: 8px; 175 | padding: 15px 20px; 176 | letter-spacing: 1px; 177 | align-items: center; 178 | justify-content: center; 179 | text-transform: uppercase; 180 | background: var(--back-1); 181 | cursor: pointer; 182 | margin-top: 20px; 183 | } 184 | .addItemButt p { 185 | opacity: 0.7; 186 | color: var(--wht); 187 | } 188 | 189 | .add_item_sect_r1 .add_butt { 190 | display: flex; 191 | cursor: pointer; 192 | font-weight: 600; 193 | color: #3a4be8; 194 | font-size: 12px; 195 | margin-left: 20px; 196 | padding: 14px 20px; 197 | border-radius: 8px; 198 | white-space: nowrap; 199 | flex-direction: row; 200 | align-items: center; 201 | text-transform: uppercase; 202 | background: var(--back-1); 203 | } 204 | 205 | .add_butt p { 206 | opacity: 0.7; 207 | color: var(--wht); 208 | } 209 | 210 | .ensure_txt { 211 | opacity: 0.6; 212 | font-size: 12px; 213 | color: var(--wht); 214 | margin-top: 10px; 215 | padding-left: 2px; 216 | } 217 | 218 | .item_list { 219 | width: 100%; 220 | display: flex; 221 | align-items: center; 222 | flex-direction: row; 223 | margin-bottom: 15px; 224 | justify-content: space-between; 225 | } 226 | 227 | .item_list_img { 228 | width: 40px; 229 | height: 40px; 230 | overflow: hidden; 231 | display: flex; 232 | font-size: 18px; 233 | justify-content: center; 234 | align-items: center; 235 | margin-right: 15px; 236 | border-radius: 100%; 237 | background: var(--back-1); 238 | border: 1px solid var(--back-1); 239 | } 240 | .item_list_img img { 241 | width: 100%; 242 | } 243 | 244 | .rm_butt, 245 | .item_list_name { 246 | display: flex; 247 | cursor: pointer; 248 | font-weight: 600; 249 | font-size: 12px; 250 | padding: 15px 15px; 251 | border-radius: 10px; 252 | white-space: nowrap; 253 | flex-direction: row; 254 | align-items: center; 255 | text-transform: uppercase; 256 | background: var(--back-1); 257 | } 258 | .rm_butt p, 259 | .item_list_name p { 260 | opacity: 0.7; 261 | color: var(--wht); 262 | text-align: center; 263 | } 264 | .item_list_name { 265 | flex: 1; 266 | margin-right: 15px; 267 | } 268 | 269 | /* ************ */ 270 | 271 | .crt_butt { 272 | margin: 0px 0px; 273 | display: flex; 274 | align-items: center; 275 | flex-direction: column; 276 | } 277 | 278 | .crt_butt button { 279 | display: flex; 280 | font-size: 13px; 281 | font-weight: 600; 282 | line-height: 14px; 283 | border-radius: 8px; 284 | padding: 18px 20px; 285 | letter-spacing: 1px; 286 | align-items: center; 287 | justify-content: center; 288 | text-transform: uppercase; 289 | background: #2958ff; 290 | color: #ccf381; 291 | width: 100%; 292 | } 293 | 294 | .crt_butt a { 295 | font-size: 12px; 296 | color: #555; 297 | padding: 0px 5px; 298 | } 299 | 300 | .safety { 301 | margin-top: 15px; 302 | font-size: 10px; 303 | padding-left: 15px; 304 | text-align: center; 305 | } 306 | 307 | .safety span { 308 | line-height: 13px; 309 | } 310 | 311 | input:invalid { 312 | border: solid 1px #ff4343 !important; 313 | } 314 | 315 | .check { 316 | display: flex; 317 | margin-top: 12px; 318 | } 319 | 320 | .conditions { 321 | margin-right: 120px; 322 | } 323 | 324 | @media screen and (max-width: 400px) { 325 | .conditions{ 326 | margin-right: 33px; 327 | } 328 | 329 | } -------------------------------------------------------------------------------- /converter-frontend/src/styles/index.css: -------------------------------------------------------------------------------- 1 | @import "./reset.css"; 2 | @import url('https://fonts.googleapis.com/css2?family=Roboto+Mono&display=swap'); 3 | @import url('https://fonts.googleapis.com/css2?family=Anybody&display=swap'); 4 | 5 | 6 | html, 7 | body { 8 | margin: 0; 9 | padding: 0; 10 | width: 100vw; 11 | height: 100vh; 12 | overflow-x: hidden; 13 | -webkit-text-size-adjust: 100%; 14 | 15 | font-weight: 400; 16 | -webkit-font-smoothing: antialiased; 17 | -moz-osx-font-smoothing: grayscale; 18 | } 19 | body { 20 | position: relative; 21 | } 22 | * { 23 | box-sizing: border-box !important; 24 | font-family: "Open sans" !important; 25 | } 26 | 27 | #root { 28 | z-index: 21474836470; 29 | } 30 | 31 | :root { 32 | --wht: #fff; 33 | --txt: #999; 34 | --list_h: 68px; 35 | --l1: #e6e6e635; 36 | --white: #fdfdfd; 37 | --back-1: #363636; 38 | --back-2: #4a4a4a; 39 | --bord-dark: #666; 40 | --txt-alt: #808080; 41 | --txt-alt-2: #aaaa; 42 | --sm-hd-height: 60px; 43 | --dark-800: #242424; 44 | --dark-800: #1a1a1a; 45 | --sm-nav-height: 70px; 46 | --main-col: #2958ff; 47 | --container-width: 550px; 48 | --sm-hd-height-half: 60px; 49 | --main-col-inv: #ccf381; 50 | --list-border: 1px solid rgba(255, 255, 255, 8%); 51 | } 52 | 53 | main { 54 | width: 100vw; 55 | min-height: 100vh; 56 | overflow-y: scroll; 57 | } 58 | 59 | .light_theme { 60 | --white : #fff; 61 | --color: "#808080"; 62 | --txt-alt: #555; 63 | --wht: #000; 64 | --nav-active : black; 65 | --nav-not-active: rgb(41, 38, 38); 66 | 67 | --back-1: #fdfdfd; 68 | 69 | --back-2: #f2f2f2; 70 | 71 | --l1: #333; 72 | 73 | 74 | --list-border: 1px solid rgba(0, 0, 0, 18%); 75 | 76 | --background: var(--white); 77 | --border-default: rgba(0, 0, 0, 18%); 78 | background-color: var(--background); 79 | --timer : blue; 80 | --wallet-content : whitesmoke; 81 | 82 | } 83 | 84 | 85 | 86 | 87 | .big_screen { 88 | --sm-hd-height: 120px; 89 | } 90 | 91 | .small_header { 92 | top: 16px; 93 | left: 0; 94 | z-index: 90; 95 | width: 100vw; 96 | display: flex; 97 | font-size: 13px; 98 | color: var(--wht); 99 | position: fixed; 100 | background: var(--background); 101 | flex-direction: column; 102 | /* border-bottom: 1px solid var(--border-default); */ 103 | } 104 | 105 | /* ****************** */ 106 | .listNavBig { 107 | display: flex; 108 | align-items: center; 109 | justify-content: center; 110 | text-transform: uppercase; 111 | } 112 | 113 | .listNavBig li { 114 | /* opacity: 0.8; */ 115 | font-size: 12px; 116 | margin: 0px 8px; 117 | cursor: pointer; 118 | letter-spacing: 0.5px; 119 | padding-bottom: 3px; 120 | } 121 | .listNavBig li a:focus, 122 | .listNavBig li a:hover { 123 | border: none; 124 | outline: none; 125 | } 126 | .listNavBig li:hover { 127 | border-bottom: 1px solid var(--wht); 128 | } 129 | 130 | /* Addresses 131 | ****************** */ 132 | .addrDisplay { 133 | position: relative; 134 | z-index: 9999; 135 | } 136 | .addrDispMain { 137 | display: flex; 138 | align-items: center; 139 | justify-content: center; 140 | height: var(--sm-hd-height-half); 141 | } 142 | .addrDisplay .dropDownConnect_items { 143 | right: 0; 144 | position: absolute; 145 | flex-direction: column; 146 | background: var(--back-1); 147 | border-radius: 8px; 148 | display: none; 149 | border: 1px solid var(--border-default); 150 | } 151 | .addrDisplay .dropDownConnect_item { 152 | padding: 15px 20px; 153 | } 154 | 155 | .addrDisplay:hover .dropDownConnect_items { 156 | display: flex; 157 | } 158 | 159 | .addrDisplay .dropDownConnect_item_txt { 160 | width: 200px; 161 | max-width: 200px; 162 | overflow: hidden; 163 | text-overflow: ellipsis; 164 | } 165 | 166 | /* *************** */ 167 | .dropDownConnect { 168 | position: relative; 169 | z-index: 99999999; 170 | } 171 | 172 | /* */ 173 | 174 | .addrDisplayInn { 175 | color: var(--wht); 176 | font-size: 12px; 177 | background: var(--back-1); 178 | padding: 8px 14px; 179 | border-radius: 8px; 180 | cursor: pointer; 181 | letter-spacing: 0.4px; 182 | white-space: nowrap; 183 | text-transform: uppercase; 184 | display: flex; 185 | flex-direction: row; 186 | align-items: center; 187 | max-width: 60vw; 188 | overflow: hidden; 189 | border: 1px solid var(--border-default); 190 | } 191 | .addrBalance, 192 | .addressTxt { 193 | display: flex; 194 | padding: 4px 10px; 195 | flex-direction: row; 196 | } 197 | .addrBalance { 198 | border-right: 1px solid var(--border-default); 199 | } 200 | .addressTxt { 201 | max-width: 120px; 202 | } 203 | .addressTxt p { 204 | flex: 1; 205 | overflow: hidden; 206 | text-overflow: ellipsis; 207 | } 208 | 209 | /* Connect Wallet */ 210 | .dropDownConnect .dropDownConnect_button { 211 | display: flex; 212 | align-items: center; 213 | flex-direction: row; 214 | height: var(--sm-hd-height-half); 215 | } 216 | .dropDownConnect .dropDownConnect_items { 217 | right: 0; 218 | position: absolute; 219 | flex-direction: column; 220 | background: var(--back-1); 221 | border-radius: 8px; 222 | display: none; 223 | border: 1px solid var(--border-default); 224 | } 225 | 226 | .dropDownConnect:hover .dropDownConnect_items { 227 | display: flex; 228 | } 229 | 230 | .dropDownConnect_item { 231 | display: flex; 232 | flex-direction: row; 233 | align-items: center; 234 | padding: 10px 10px; 235 | padding-right: 40px; 236 | cursor: pointer; 237 | } 238 | .dropDownConnect_item { 239 | border-bottom: 1px solid var(--border-default); 240 | } 241 | .dropDownConnect_item:last-child { 242 | border-bottom: none; 243 | } 244 | .dropDownConnect_img { 245 | width: 20px; 246 | height: 20px; 247 | border-radius: 100%; 248 | overflow: hidden; 249 | display: flex; 250 | font-size: 14px; 251 | margin-right: 12px; 252 | align-items: center; 253 | justify-content: center; 254 | border: 1px solid #aaa; 255 | } 256 | .dropDownConnect_img img { 257 | width: 20px; 258 | height: 20px; 259 | object-fit: cover; 260 | border-radius: 100%; 261 | } 262 | 263 | .dropDownConnect_item_txt { 264 | font-size: 15px; 265 | opacity: 0.7; 266 | white-space: nowrap; 267 | } 268 | 269 | /* */ 270 | .connect_wallet_button { 271 | color: var(--wht); 272 | font-size: 12px; 273 | background: var(--back-1); 274 | padding: 10px 14px; 275 | border-radius: 8px; 276 | cursor: pointer; 277 | letter-spacing: 0.4px; 278 | white-space: nowrap; 279 | text-transform: uppercase; 280 | border: 1px solid var(--border-default); 281 | } 282 | .connect_wallet_button p { 283 | display: flex; 284 | opacity: 0.8; 285 | align-items: center; 286 | flex-direction: row; 287 | } 288 | 289 | .small_header_inn { 290 | width: 100%; 291 | display: flex; 292 | font-size: 13px; 293 | padding: 0px 5vw; 294 | flex-direction: row; 295 | height: var(--sm-hd-height-half); 296 | justify-content: space-between; 297 | } 298 | 299 | .small_header_inn p { 300 | opacity: 0.8; 301 | } 302 | 303 | .light_theme .small_header_inn { 304 | font-weight: 500; 305 | } 306 | 307 | .sm_act_menu_butt { 308 | height: 60px; 309 | display: flex; 310 | align-items: center; 311 | flex-direction: row; 312 | justify-content: center; 313 | padding-bottom: 2px; 314 | margin-right: 20px; 315 | } 316 | 317 | /* Navbar Mobile */ 318 | .ft_sm { 319 | bottom: 0; 320 | width: 100vw; 321 | z-index: 90; 322 | height: var(--sm-nav-height); 323 | position: fixed; 324 | display: flex; 325 | justify-content: center; 326 | flex-direction: column; 327 | background-color: var(--background); 328 | border-top: 1px solid var(--border-default); 329 | } 330 | 331 | .ft_sm_inn { 332 | color: var(--wht); 333 | height: 100%; 334 | display: flex; 335 | width: 90vw; 336 | flex-direction: row; 337 | max-width: 400px; 338 | margin: auto; 339 | align-items: center; 340 | justify-content: space-around; 341 | } 342 | .ft_sm_li { 343 | display: flex; 344 | font-size: 13px; 345 | align-items: center; 346 | flex-direction: column; 347 | } 348 | .ft_sm_li a:active, 349 | .ft_sm_li a:focus { 350 | border: none; 351 | outline: none; 352 | } 353 | 354 | .ft_sm_li i { 355 | font-size: 20px; 356 | margin-bottom: 2px; 357 | } 358 | 359 | /* Menu Mobile */ 360 | .mn_sm { 361 | top: 0px; 362 | width: 100vw; 363 | height: 100%; 364 | z-index: 99; 365 | position: fixed; 366 | overflow: hidden; 367 | 368 | display: flex; 369 | align-items: center; 370 | justify-content: center; 371 | flex-direction: column; 372 | 373 | background: rgba(0, 0, 0, 0.6); 374 | } 375 | .mn_sm_modal { 376 | width: 350px; 377 | max-width: 87vw; 378 | display: flex; 379 | color: var(--wht); 380 | font-size: 15px; 381 | align-items: center; 382 | box-sizing: border-box; 383 | flex-direction: column; 384 | overflow: hidden; 385 | border-top: 1px solid var(--border-default); 386 | } 387 | .mn_sm_modal_inn { 388 | width: 100%; 389 | padding: 20px; 390 | border-radius: 12px; 391 | margin: 20px 0px; 392 | border: 1px solid var(--l1); 393 | } 394 | .mn_l1 { 395 | padding-bottom: 10px; 396 | border-bottom: 1px solid var(--l1); 397 | } 398 | .mn_l1 li { 399 | margin-bottom: 16px; 400 | } 401 | .mn_l1 li a i { 402 | margin-right: 15px; 403 | } 404 | 405 | .mn_l2 { 406 | padding-top: 25px; 407 | padding-bottom: 10px; 408 | border-bottom: 1px solid var(--l1); 409 | } 410 | .mn_l2 li a { 411 | display: flex; 412 | flex-direction: row; 413 | margin-bottom: 16px; 414 | } 415 | .mn_l2 li a i { 416 | margin-right: 15px; 417 | } 418 | 419 | .mn_sm_modal .Marquee__Wrapper { 420 | margin: 0px !important; 421 | margin-top: 4px; 422 | } 423 | .mn_sm_modal .Marquee__TextGroup { 424 | animation-duration: 60s !important; 425 | } 426 | .mn_sm_modal .Marquee__Word { 427 | opacity: 0.4; 428 | font-size: 12px; 429 | font-weight: 400; 430 | word-spacing: 4px; 431 | padding: 20px 0px; 432 | text-transform: uppercase; 433 | } 434 | 435 | /* Algo connect */ 436 | .algo_connect_hd { 437 | display: flex; 438 | font-size: 15px; 439 | color: var(--wht); 440 | text-transform: uppercase; 441 | letter-spacing: 1px; 442 | padding: 13px 0px 16px; 443 | 444 | position: -webkit-sticky; 445 | position: sticky; 446 | z-index: 2; 447 | opacity: 0.7; 448 | background: var(--background); 449 | top: calc(var(--sm-hd-height)); 450 | } 451 | 452 | .connect_butt { 453 | display: flex; 454 | padding: 25px 0px; 455 | align-items: center; 456 | flex-direction: row; 457 | margin: 10px 0px; 458 | cursor: pointer; 459 | border-bottom: 1px solid var(--l1); 460 | } 461 | .connect_butt:nth-child(3) { 462 | margin-bottom: 20px; 463 | border-bottom: none; 464 | } 465 | .connect_wallet_img { 466 | width: 20px; 467 | height: 20px; 468 | border-radius: 100%; 469 | overflow: hidden; 470 | display: flex; 471 | font-size: 14px; 472 | align-items: center; 473 | justify-content: center; 474 | border: 1px solid #aaa; 475 | } 476 | .connect_wallet_img img { 477 | width: 20px; 478 | height: 20px; 479 | object-fit: cover; 480 | border-radius: 100%; 481 | } 482 | .connect_wallet_txt { 483 | font-size: 14px; 484 | font-weight: 500; 485 | margin-left: 15px; 486 | } 487 | 488 | 489 | 490 | /* Elections Modal */ 491 | .modal_cov { 492 | top: 0px; 493 | width: 100vw; 494 | height: 100vh; 495 | z-index: 100; 496 | position: fixed; 497 | 498 | display: flex; 499 | align-items: center; 500 | justify-content: center; 501 | flex-direction: column; 502 | 503 | background: rgba(0, 0, 0, 0.4); 504 | } 505 | .close_modal { 506 | width: 420px; 507 | display: flex; 508 | max-width: 88vw; 509 | font-size: 13px; 510 | font-weight: 600; 511 | margin-top: 10px; 512 | color: var(--main-col); 513 | border-radius: 8px; 514 | align-items: center; 515 | background: #eeeeee; 516 | flex-direction: column; 517 | justify-content: center; 518 | text-transform: uppercase; 519 | border: var(--list-border); 520 | padding: 14px 18px 14px 16px; 521 | } 522 | 523 | .modal_cont { 524 | width: 420px; 525 | max-width: 88vw; 526 | min-height: 300px; 527 | 528 | display: flex; 529 | border-radius: 8px; 530 | flex-direction: column; 531 | background: var(--back-1); 532 | background: #eeeeee; 533 | border: var(--list-border); 534 | padding: 12px 18px 12px 16px; 535 | } 536 | .modal_r1 { 537 | display: flex; 538 | flex-direction: row; 539 | align-items: center; 540 | } 541 | .modal_elt_img img { 542 | width: 30px; 543 | height: 30px; 544 | object-fit: cover; 545 | border-radius: 100%; 546 | border: 1px solid #ccc; 547 | border: 1px solid var(--main-col); 548 | } 549 | .modal_elt_tit { 550 | margin-left: 20px; 551 | font-weight: 500; 552 | font-size: 14px; 553 | /* color: var(--main-col); */ 554 | } 555 | 556 | .modal_elt_desc { 557 | margin-top: 10px; 558 | font-size: 12px; 559 | line-height: 14px; 560 | } 561 | 562 | /* */ 563 | .modal_cand { 564 | margin-top: 20px; 565 | } 566 | .modal_cand_hd { 567 | display: flex; 568 | font-size: 13px; 569 | opacity: 0.7; 570 | margin: 13px 0px; 571 | flex-wrap: wrap; 572 | text-transform: uppercase; 573 | } 574 | 575 | .modal_cand_list { 576 | display: flex; 577 | flex-wrap: wrap; 578 | flex-direction: row; 579 | } 580 | .cand_item { 581 | display: flex; 582 | align-items: center; 583 | flex-direction: row; 584 | margin-right: 15px; 585 | margin-bottom: 10px; 586 | } 587 | .cand_img_cont img { 588 | width: 20px; 589 | height: 20px; 590 | object-fit: cover; 591 | border-radius: 100%; 592 | border: 1px solid #ccc; 593 | } 594 | 595 | .cand_det { 596 | font-size: 12px; 597 | font-weight: 500; 598 | margin-left: 5px; 599 | } 600 | .modal_butts { 601 | display: flex; 602 | margin: 30px 0px 20px; 603 | align-items: center; 604 | flex-direction: row; 605 | justify-content: space-between; 606 | } 607 | .modal_butts button { 608 | font-size: 13px; 609 | color: var(--wht); 610 | padding: 10px 20px; 611 | background: #000; 612 | border-radius: 8px; 613 | } 614 | 615 | .land_item1 h3{ 616 | font-family: 'Roboto Mono', monospace !important; 617 | } 618 | /* ************************* */ 619 | 620 | .Marquee__Wrapper { 621 | z-index: 10; 622 | top: -3px; 623 | display: flex; 624 | height: 24px; 625 | width: 100%; 626 | padding: 10px 0px; 627 | /* margin: 0px 0px 15vh; */ 628 | flex-direction: row; 629 | overflow: hidden; 630 | white-space: nowrap; 631 | position: fixed; 632 | background-color: white; 633 | } 634 | .Marquee__TextHolder { 635 | 636 | margin-top: -22px; 637 | display: flex; 638 | flex-direction: row; 639 | } 640 | 641 | .Marquee__TextGroup { 642 | animation: 20s linear 0s infinite normal none running marquee; 643 | display: inline-block; 644 | } 645 | .Marquee__Word { 646 | font-family: 'Anybody', 'Courier New', Courier, monospace !important ; 647 | display: inline-block; 648 | font-size: 14px; 649 | /* opacity: 0.8; */ 650 | } 651 | .scroll { 652 | font-family: 'Anybody', 'Courier New', Courier, monospace !important ; 653 | } 654 | .Marquee__Dot { 655 | display: inline-block; 656 | width: 4px; 657 | height: 4px; 658 | border-radius: 100%; 659 | background: var(--main-col); 660 | vertical-align: middle; 661 | margin: 0px 30px; 662 | } 663 | 664 | @media screen and (max-width: 850px) { 665 | .Marquee__Dot { 666 | width: 4px; 667 | height: 4px; 668 | margin-top: -4px; 669 | margin-left: 18px; 670 | margin-right: 18px; 671 | } 672 | } 673 | 674 | @keyframes marquee { 675 | 0% { 676 | transform: translate3d(0px, 0px, 0px); 677 | } 678 | 100% { 679 | transform: translate3d(-100%, 0px, 0px); 680 | } 681 | } 682 | 683 | @media (max-width: 1020px) { 684 | .ft_hfr_1 { 685 | width: 70%; 686 | margin-right: 20%; 687 | } 688 | 689 | .ft_hfr_1 p:first-child { 690 | font-size: 28px; 691 | } 692 | 693 | .ft_hdr { 694 | margin-bottom: 7vh; 695 | } 696 | /* .Marquee__Wrapper { 697 | margin: 5vh 0px 5vh; 698 | } */ 699 | 700 | .get_inv { 701 | display: none; 702 | } 703 | 704 | .ft_r1 ul { 705 | align-items: center; 706 | } 707 | } 708 | @media (max-width: 760px) { 709 | .ft_inn ul li a p { 710 | width: 0px; 711 | overflow: hidden; 712 | } 713 | .ft_cont { 714 | font-size: 13px; 715 | } 716 | .ft_r3 { 717 | margin-top: 30px; 718 | font-size: 12px; 719 | } 720 | .ft_inn { 721 | margin-bottom: 7vh; 722 | } 723 | } 724 | 725 | @media (max-width: 700px) { 726 | .ft_hfr_1 { 727 | margin-right: 0px; 728 | width: 100%; 729 | } 730 | } 731 | 732 | @media (max-width: 500px) { 733 | .Marquee__Word { 734 | display: inline-block; 735 | font-size: 15px; 736 | } 737 | 738 | .hm_ft { 739 | padding-top: 0px; 740 | padding: 5vh 5vw 0px; 741 | } 742 | .ft_hfr_1 { 743 | width: 90%; 744 | } 745 | .ft_hfr_1 p:nth-child(2) { 746 | font-size: 16px; 747 | } 748 | } 749 | 750 | /* My Algo Wallets */ 751 | #walletconnect-wrapper { 752 | transform: scale(0.75) !important; 753 | } 754 | 755 | iframe { 756 | pointer-events: none !important; 757 | } 758 | 759 | .header_nav{ 760 | background-image: linear-gradient( 761 | -225deg, 762 | rgb(211, 206, 134) 0%, 763 | rgb(134, 119, 119) 29%, 764 | grey 67%, 765 | rgb(119, 153, 119) 100% 766 | ); 767 | background-size: auto auto; 768 | background-clip: border-box; 769 | background-size: 200% auto; 770 | color: #fff; 771 | background-clip: text; 772 | -webkit-text-fill-color: transparent; 773 | -webkit-background-clip: text; 774 | -webkit-text-fill-color: transparent; 775 | animation: textclip 2s linear infinite; 776 | display: inline-block; 777 | 778 | } 779 | 780 | @keyframes textclip { 781 | to { 782 | background-position: 200% center; 783 | } 784 | } 785 | 786 | @media screen and (max-width : 400px) and (min-width: 350px ) { 787 | .amountToCommit input { 788 | font-size: 10px !important; 789 | padding: 7px 8px !important; 790 | margin-left: -18px !important; 791 | } 792 | .max { 793 | font-size: 9px !important; 794 | } 795 | } 796 | 797 | @media screen and (max-width : 454px) and (min-width: 400px ) { 798 | .amountToCommit input { 799 | font-size: 11px !important; 800 | margin-left: -8px; 801 | } 802 | } 803 | 804 | @media screen and (max-width:415px) and (min-width: 400px) { 805 | .timer { 806 | font-size: 10px !important; 807 | margin-top: -11px !important; 808 | margin-left: 9px !important; 809 | } 810 | 811 | .disconnect_button { 812 | margin-right: 5vw !important; 813 | } 814 | 815 | } 816 | @media screen and (max-width:400px) and (min-width: 360px) { 817 | .timer { 818 | font-size: 9px !important; 819 | margin-top: -11px !important; 820 | margin-left: 9px !important; 821 | } 822 | 823 | .disconnect_button { 824 | margin-right: 5vw !important; 825 | } 826 | 827 | .addressTxt { 828 | max-width: 100px !important; 829 | } 830 | .decisions { 831 | margin: 10px !important; 832 | padding: 5px !important; 833 | } 834 | } 835 | 836 | /* @media screen and (max-width:600px) and (min-width: 400px) { 837 | .timer { 838 | font-size: 12px !important; 839 | } 840 | } */ 841 | 842 | /* .record_vote { 843 | background : #27ae60 !important; 844 | } 845 | 846 | .button:hover, .button:active{ 847 | background: #1e7743 !important; 848 | } 849 | .button:active { 850 | transform: translateY(-4px) !important; 851 | } */ 852 | 853 | .timer { 854 | text-transform: uppercase !important; 855 | } 856 | /* .check { 857 | color: #2958ff !important; 858 | } */ 859 | 860 | .wallet_content { 861 | font-family: 'Anybody', 'Courier New', Courier, monospace !important ; 862 | } 863 | 864 | @media screen and (max-width : 850px) { 865 | .confirmation { 866 | bottom: 60px !important; 867 | right: 7px !important; 868 | } 869 | } 870 | 871 | /* disconnect & election timer */ 872 | /* .disconnect { 873 | display: block; 874 | text-align: right; 875 | text-transform: uppercase; 876 | } */ 877 | /* .disconnect_button { 878 | cursor: pointer; 879 | font-family: 'Anybody', 'Courier New', Courier, monospace !important ; 880 | margin-right: 10vw; 881 | font-weight: bold; 882 | font-size: 14px; 883 | border: solid 1px rgb(202, 202, 202); 884 | padding: 3px; 885 | background: whitesmoke; 886 | border-radius: 3px; 887 | } */ 888 | 889 | .timer { 890 | font-family: 'Anybody', 'Courier New', Courier, monospace !important ; 891 | display: block; 892 | font-size: 13px; 893 | text-align: left; 894 | font-weight: bold; 895 | margin-top: 0px; 896 | margin-left: 20px; 897 | } 898 | 899 | .navigation { 900 | border: none !important; 901 | background: initial !important; 902 | } 903 | .display { 904 | position: fixed !important; 905 | } 906 | .each { 907 | padding: 19px 2px !important; 908 | text-align: center !important; 909 | } 910 | 911 | @media screen and (max-width: 430px) { 912 | .mobilenav { 913 | right : 229px !important; 914 | } 915 | .dropDownConnect_items { 916 | right: -34px !important; 917 | } 918 | } 919 | 920 | .converter-header { 921 | font-weight: bolder; 922 | color: blue; 923 | font-family: 'Anybody', 'Courier New', Courier, monospace !important ; 924 | 925 | } 926 | -------------------------------------------------------------------------------- /converter-frontend/src/styles/reset.css: -------------------------------------------------------------------------------- 1 | @import url("https://fonts.googleapis.com/css?family=Oswald:300;700&display=swap"); 2 | @import url("https://fonts.googleapis.com/css2?family=Raleway:wght@100;200;300;400;500;600;700;800;900&display=swap"); 3 | @import url("https://fonts.googleapis.com/css2?family=Open%20Sans:wght@100;200;300;400;500;600;700;800;900&display=swap"); 4 | @import url("https://fonts.googleapis.com/css2?family=Barlow:wght@100;200;300;400;500;600;700;800;900&display=swap"); 5 | 6 | @import "https://unicons.iconscout.com/release/v3.0.6/css/line.css"; 7 | @import "https://use.fontawesome.com/releases/v5.15.4/css/all.css"; 8 | 9 | html, 10 | body, 11 | div, 12 | span, 13 | applet, 14 | object, 15 | iframe, 16 | h1, 17 | h2, 18 | h3, 19 | h4, 20 | h5, 21 | h6, 22 | p, 23 | blockquote, 24 | pre, 25 | a, 26 | abbr, 27 | acronym, 28 | address, 29 | big, 30 | cite, 31 | code, 32 | del, 33 | dfn, 34 | em, 35 | img, 36 | ins, 37 | kbd, 38 | q, 39 | s, 40 | samp, 41 | small, 42 | strike, 43 | strong, 44 | sub, 45 | sup, 46 | tt, 47 | var, 48 | b, 49 | u, 50 | i, 51 | center, 52 | dl, 53 | dt, 54 | dd, 55 | ol, 56 | ul, 57 | li, 58 | fieldset, 59 | form, 60 | label, 61 | legend, 62 | table, 63 | caption, 64 | tbody, 65 | tfoot, 66 | thead, 67 | tr, 68 | th, 69 | td, 70 | article, 71 | aside, 72 | canvas, 73 | details, 74 | embed, 75 | figure, 76 | figcaption, 77 | footer, 78 | header, 79 | hgroup, 80 | menu, 81 | nav, 82 | output, 83 | ruby, 84 | section, 85 | summary, 86 | time, 87 | mark, 88 | audio, 89 | video { 90 | margin: 0; 91 | padding: 0; 92 | border: 0; 93 | font-size: 100%; 94 | font: inherit; 95 | vertical-align: baseline; 96 | } 97 | 98 | /* make sure to set some focus styles for accessibility */ 99 | :focus { 100 | outline: 0; 101 | } 102 | 103 | /* HTML5 display-role reset for older browsers */ 104 | article, 105 | aside, 106 | details, 107 | figcaption, 108 | figure, 109 | footer, 110 | header, 111 | hgroup, 112 | menu, 113 | nav, 114 | section { 115 | display: block; 116 | } 117 | 118 | body { 119 | line-height: 1; 120 | overflow: auto; 121 | } 122 | 123 | ol, 124 | ul { 125 | list-style: none; 126 | } 127 | 128 | blockquote, 129 | q { 130 | quotes: none; 131 | } 132 | 133 | blockquote:before, 134 | blockquote:after, 135 | q:before, 136 | q:after { 137 | content: ""; 138 | content: none; 139 | } 140 | 141 | table { 142 | border-collapse: collapse; 143 | border-spacing: 0; 144 | } 145 | 146 | input[type="search"]::-webkit-search-cancel-button, 147 | input[type="search"]::-webkit-search-decoration, 148 | input[type="search"]::-webkit-search-results-button, 149 | input[type="search"]::-webkit-search-results-decoration { 150 | -webkit-appearance: none; 151 | -moz-appearance: none; 152 | } 153 | 154 | input[type="search"] { 155 | -webkit-appearance: none; 156 | -moz-appearance: none; 157 | -webkit-box-sizing: content-box; 158 | -moz-box-sizing: content-box; 159 | box-sizing: content-box; 160 | } 161 | 162 | textarea { 163 | overflow: auto; 164 | vertical-align: top; 165 | resize: vertical; 166 | } 167 | 168 | /** 169 | * Correct `inline-block` display not defined in IE 6/7/8/9 and Firefox 3. 170 | */ 171 | 172 | audio, 173 | canvas, 174 | video { 175 | display: inline-block; 176 | display: inline; 177 | zoom: 1; 178 | max-width: 100%; 179 | } 180 | 181 | /** 182 | * Prevent modern browsers from displaying `audio` without controls. 183 | * Remove excess height in iOS 5 devices. 184 | */ 185 | 186 | audio:not([controls]) { 187 | display: none; 188 | height: 0; 189 | } 190 | 191 | /** 192 | * Address styling not present in IE 7/8/9, Firefox 3, and Safari 4. 193 | * Known issue: no IE 6 support. 194 | */ 195 | 196 | [hidden] { 197 | display: none; 198 | } 199 | 200 | /** 201 | * 1. Correct text resizing oddly in IE 6/7 when body `font-size` is set using 202 | * `em` units. 203 | * 2. Prevent iOS text size adjust after orientation change, without disabling 204 | * user zoom. 205 | */ 206 | 207 | html { 208 | font-size: 100%; /* 1 */ 209 | -webkit-text-size-adjust: 100%; /* 2 */ 210 | -ms-text-size-adjust: 100%; /* 2 */ 211 | } 212 | 213 | /** 214 | * Address `outline` inconsistency between Chrome and other browsers. 215 | */ 216 | 217 | a:focus { 218 | outline: thin dotted; 219 | } 220 | 221 | /** 222 | * Improve readability when focused and also mouse hovered in all browsers. 223 | */ 224 | 225 | a:active, 226 | a:hover { 227 | outline: 0; 228 | } 229 | 230 | /** 231 | * 1. Remove border when inside `a` element in IE 6/7/8/9 and Firefox 3. 232 | * 2. Improve image quality when scaled in IE 7. 233 | */ 234 | 235 | img { 236 | border: 0; /* 1 */ 237 | -ms-interpolation-mode: bicubic; /* 2 */ 238 | } 239 | 240 | /** 241 | * Address margin not present in IE 6/7/8/9, Safari 5, and Opera 11. 242 | */ 243 | 244 | figure { 245 | margin: 0; 246 | } 247 | 248 | /** 249 | * Correct margin displayed oddly in IE 6/7. 250 | */ 251 | 252 | form { 253 | margin: 0; 254 | } 255 | 256 | /** 257 | * Define consistent border, margin, and padding. 258 | */ 259 | 260 | fieldset { 261 | border: 1px solid #c0c0c0; 262 | margin: 0 2px; 263 | padding: 0.35em 0.625em 0.75em; 264 | } 265 | 266 | /** 267 | * 1. Correct color not being inherited in IE 6/7/8/9. 268 | * 2. Correct text not wrapping in Firefox 3. 269 | * 3. Correct alignment displayed oddly in IE 6/7. 270 | */ 271 | 272 | legend { 273 | border: 0; /* 1 */ 274 | padding: 0; 275 | white-space: normal; /* 2 */ 276 | *margin-left: -7px; /* 3 */ 277 | } 278 | 279 | /** 280 | * 1. Correct font size not being inherited in all browsers. 281 | * 2. Address margins set differently in IE 6/7, Firefox 3+, Safari 5, 282 | * and Chrome. 283 | * 3. Improve appearance and consistency in all browsers. 284 | */ 285 | 286 | button, 287 | input, 288 | select, 289 | textarea { 290 | font-size: 100%; /* 1 */ 291 | margin: 0; /* 2 */ 292 | vertical-align: baseline; /* 3 */ 293 | *vertical-align: middle; /* 3 */ 294 | } 295 | 296 | /** 297 | * Address Firefox 3+ setting `line-height` on `input` using `!important` in 298 | * the UA stylesheet. 299 | */ 300 | 301 | button, 302 | input { 303 | line-height: normal; 304 | } 305 | 306 | /** 307 | * Address inconsistent `text-transform` inheritance for `button` and `select`. 308 | * All other form control elements do not inherit `text-transform` values. 309 | * Correct `button` style inheritance in Chrome, Safari 5+, and IE 6+. 310 | * Correct `select` style inheritance in Firefox 4+ and Opera. 311 | */ 312 | 313 | button, 314 | select { 315 | text-transform: none; 316 | } 317 | 318 | /** 319 | * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` 320 | * and `video` controls. 321 | * 2. Correct inability to style clickable `input` types in iOS. 322 | * 3. Improve usability and consistency of cursor style between image-type 323 | * `input` and others. 324 | * 4. Remove inner spacing in IE 7 without affecting normal text inputs. 325 | * Known issue: inner spacing remains in IE 6. 326 | */ 327 | 328 | button, 329 | html input[type="button"], /* 1 */ 330 | input[type="reset"], 331 | input[type="submit"] { 332 | -webkit-appearance: button; /* 2 */ 333 | cursor: pointer; /* 3 */ 334 | *overflow: visible; /* 4 */ 335 | } 336 | 337 | /** 338 | * Re-set default cursor for disabled elements. 339 | */ 340 | 341 | button[disabled], 342 | html input[disabled] { 343 | cursor: default; 344 | } 345 | 346 | /** 347 | * 1. Address box sizing set to content-box in IE 8/9. 348 | * 2. Remove excess padding in IE 8/9. 349 | * 3. Remove excess padding in IE 7. 350 | * Known issue: excess padding remains in IE 6. 351 | */ 352 | 353 | input[type="checkbox"], 354 | input[type="radio"] { 355 | box-sizing: border-box; /* 1 */ 356 | padding: 0; /* 2 */ 357 | *height: 13px; /* 3 */ 358 | *width: 13px; /* 3 */ 359 | } 360 | 361 | /** 362 | * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome. 363 | * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome 364 | * (include `-moz` to future-proof). 365 | */ 366 | 367 | input[type="search"] { 368 | -webkit-appearance: textfield; /* 1 */ 369 | -moz-box-sizing: content-box; 370 | -webkit-box-sizing: content-box; /* 2 */ 371 | box-sizing: content-box; 372 | } 373 | 374 | /** 375 | * Remove inner padding and search cancel button in Safari 5 and Chrome 376 | * on OS X. 377 | */ 378 | 379 | input[type="search"]::-webkit-search-cancel-button, 380 | input[type="search"]::-webkit-search-decoration { 381 | -webkit-appearance: none; 382 | } 383 | 384 | /** 385 | * Remove inner padding and border in Firefox 3+. 386 | */ 387 | 388 | button::-moz-focus-inner, 389 | input::-moz-focus-inner { 390 | border: 0; 391 | padding: 0; 392 | } 393 | 394 | /** 395 | * 1. Remove default vertical scrollbar in IE 6/7/8/9. 396 | * 2. Improve readability and alignment in all browsers. 397 | */ 398 | 399 | textarea { 400 | overflow: auto; /* 1 */ 401 | vertical-align: top; /* 2 */ 402 | } 403 | 404 | /** 405 | * Remove most spacing between table cells. 406 | */ 407 | 408 | table { 409 | border-collapse: collapse; 410 | border-spacing: 0; 411 | } 412 | 413 | html, 414 | button, 415 | input, 416 | select, 417 | textarea { 418 | color: #222; 419 | } 420 | 421 | ::-moz-selection { 422 | background: #b3d4fc; 423 | text-shadow: none; 424 | } 425 | 426 | ::selection { 427 | background: #b3d4fc; 428 | text-shadow: none; 429 | } 430 | 431 | img { 432 | vertical-align: middle; 433 | } 434 | 435 | fieldset { 436 | border: 0; 437 | margin: 0; 438 | padding: 0; 439 | } 440 | 441 | textarea { 442 | resize: vertical; 443 | } 444 | 445 | /* Mine 446 | ================ */ 447 | a, 448 | li, 449 | ul, 450 | p { 451 | margin: 0; 452 | padding: 0; 453 | color: inherit; 454 | list-style: none; 455 | text-decoration: none; 456 | } 457 | button, 458 | input { 459 | border: none; 460 | outline: none; 461 | background: initial; 462 | color: inherit; 463 | } 464 | 465 | * { 466 | box-sizing: border-box; 467 | 468 | -webkit-tap-highlight-color: transparent; 469 | } 470 | 471 | *::-webkit-scrollbar { 472 | display: none; 473 | } 474 | -------------------------------------------------------------------------------- /converter-frontend/src/utils/algorand-transaction-confirmation.js: -------------------------------------------------------------------------------- 1 | //verification function 2 | export const waitForConfirmation = async function (algodClient, txId) { 3 | let lastround = (await algodClient.status().do())["last-round"]; 4 | while (true) { 5 | const pendingInfo = await algodClient 6 | .pendingTransactionInformation(txId) 7 | .do(); 8 | if ( 9 | pendingInfo["confirmed-round"] !== null && 10 | pendingInfo["confirmed-round"] > 0 11 | ) { 12 | //Got the completed Transaction 13 | console.log( 14 | "Voting confirmed in round " + pendingInfo["confirmed-round"] 15 | ); 16 | break; 17 | } 18 | lastround++; 19 | await algodClient.statusAfterBlock(lastround).do(); 20 | } 21 | }; -------------------------------------------------------------------------------- /converter-frontend/src/utils/contract-interact.js: -------------------------------------------------------------------------------- 1 | import dotenv from 'dotenv'; 2 | import web3 from 'web3'; 3 | 4 | import {createAlchemyWeb3} from "@alch/alchemy-web3"; 5 | dotenv.config(); 6 | const alchemyKey = process.env.REACT_APP_ALCHEMY_KEY; 7 | const Web3 = createAlchemyWeb3(alchemyKey); 8 | 9 | const contractAddress = web3.utils.toChecksumAddress("0xa591AFBC1A81EA1c61edeFa3A36D54f50Ca05Cad"); 10 | 11 | const contractABI = require('../contract-ABI/chainlink.json'); 12 | 13 | export const smartContract = new Web3.eth.Contract( 14 | contractABI, 15 | contractAddress 16 | ); 17 | 18 | 19 | 20 | export const getAccountBalance = async (address) => { 21 | //input error handling 22 | if (!window.ethereum || address === null) { 23 | return { 24 | status: 25 | "💡 Connect your Metamask wallet to update the message on the blockchain.", 26 | }; 27 | } 28 | 29 | const message = await smartContract.methods.balances(address).call(); 30 | return message; 31 | 32 | }; 33 | 34 | export const transferBalance = async (address, transferAddress, amount) => { 35 | //input error handling 36 | if (!window.ethereum || address === null || transferAddress === null) { 37 | return { 38 | status: 39 | "💡 Connect your Metamask wallet to update the message on the blockchain.", 40 | }; 41 | } 42 | 43 | //set up transaction parameters 44 | const transactionParameters = { 45 | to: contractAddress, // Required except during contract publications. 46 | from: address, // must match user's active address. 47 | data: smartContract.methods.transfer(transferAddress, amount).encodeABI(), 48 | }; 49 | 50 | //sign the transaction 51 | try { 52 | await window.ethereum.request({ 53 | method: "eth_sendTransaction", 54 | params: [transactionParameters], 55 | }); 56 | 57 | return { 58 | status: "success" 59 | }; 60 | 61 | } catch (error) { 62 | return { 63 | error: "😥 " + error.message, 64 | }; 65 | } 66 | }; -------------------------------------------------------------------------------- /goLink/LINK-743260106/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bhaney44/ChainLinkHackathonSpring2022/78b53a6ed1a44ca64961707c8dacbeb8c97a662d/goLink/LINK-743260106/icon.png -------------------------------------------------------------------------------- /goLink/config.py: -------------------------------------------------------------------------------- 1 | #Creator Credentials 2 | creator_address = "" 3 | creator_passphrase = "" 4 | 5 | #algod_address = "https://testnet-algorand.api.purestake.io/ps2" 6 | algod_address = "https://mainnet-algorand.api.purestake.io/ps2" 7 | algod_token = "" 8 | 9 | # Details of the asset creation transaction. 10 | asset_details = { 11 | "asset_name": "goLink", 12 | "unit_name": "LINK", 13 | "total": 1000000000000000, 14 | "decimals": 6, 15 | "default_frozen": False, 16 | "manager": creator_address, 17 | "reserve": creator_address, 18 | "freeze": creator_address, 19 | "clawback": creator_address, 20 | "url": "https://chain.link/", 21 | "metadata_hash": "" 22 | } 23 | 24 | metadata_file = "link.png" 25 | metadatahash_b64 = b'szcRiszR7+XlAUH1ZsCtwzlhB+smx8cyy8GF37dp5aM=' 26 | 27 | #TestNet 28 | #asset_id = 89483596 29 | #MainNet 30 | asset_id = 743260106 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /goLink/decentralize.py: -------------------------------------------------------------------------------- 1 | # Apache License 2 | from algosdk import account, encoding, mnemonic,algod 3 | from algosdk.future.transaction import AssetTransferTxn, PaymentTxn, AssetConfigTxn 4 | from algosdk.future.transaction import AssetFreezeTxn 5 | from algosdk.v2client import algod 6 | 7 | algod_address = "https://testnet-algorand.api.purestake.io/ps2" 8 | # algod_address = "https://mainnet-algorand.api.purestake.io/ps2" 9 | algod_token = "" 10 | headers = {"X-API-Key": "",} 11 | algod_client = algod.AlgodClient(algod_token,algod_address,headers) 12 | 13 | #Creator Information 14 | creator_address = "" 15 | creator_mnemonic = "" 16 | creator_key = mnemonic.to_private_key(creator_mnemonic) 17 | 18 | def link_mod(): 19 | #TestNet 20 | #asset_id = 89483596 21 | asset_id = 743260106 22 | params = algod_client.suggested_params() 23 | transaction = AssetConfigTxn(creator_address, params, index = asset_id, manager = creator_address, reserve = creator_address, freeze = "", clawback = "", strict_empty_address_check = False) 24 | signature = transaction.sign(creator_key) 25 | algod_client.send_transaction(signature) 26 | transaction_id = transaction.get_txid() 27 | transaction_id = str(transaction_id) 28 | print("Your transaction information is at: " + transaction_id) 29 | link_mod() -------------------------------------------------------------------------------- /goLink/link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bhaney44/ChainLinkHackathonSpring2022/78b53a6ed1a44ca64961707c8dacbeb8c97a662d/goLink/link.png -------------------------------------------------------------------------------- /goLink/main.py: -------------------------------------------------------------------------------- 1 | #Imports 2 | from config import * 3 | from algosdk.v2client import algod 4 | from algosdk import account, mnemonic 5 | from algosdk.future.transaction import write_to_file 6 | from algosdk.future.transaction import AssetConfigTxn, AssetTransferTxn 7 | from util import sign_and_send, balance_formatter 8 | 9 | # Client 10 | algod_address = "https://testnet-algorand.api.purestake.io/ps2" 11 | #algod_address = "https://mainnet-algorand.api.purestake.io/ps2" 12 | algod_token = "" 13 | headers = {"X-API-Key": algod_token } 14 | client = algod.AlgodClient(algod_token, algod_address, headers) 15 | 16 | # Create Function 17 | def create(passphrase=None): 18 | params = client.suggested_params() 19 | txn = AssetConfigTxn(creator_address, params, **asset_details) 20 | if passphrase: 21 | txinfo = sign_and_send(txn, passphrase, client) 22 | asset_id = txinfo.get('asset-index') 23 | print("Asset ID: {}".format(asset_id)) 24 | else: 25 | write_to_file([txn], "create_coin.txn") 26 | 27 | -------------------------------------------------------------------------------- /goLink/readme.md: -------------------------------------------------------------------------------- 1 | # goLink 2 | 3 | The token goLink is collatoralized LINK on Algorand. goLink is availible on both the Algorand MainNet and TestNet. 4 | 5 | [Algorand MainNet goLink](https://algoexplorer.io/asset/743260106) 6 | 7 | [Algorand TestNet goLink](https://testnet.algoexplorer.io/asset/89483596) 8 | 9 | LINK Logo added to Algorand Network via [Pull Request #465](https://github.com/tinymanorg/asa-list/pull/465). 10 | 11 | icon 12 | -------------------------------------------------------------------------------- /goLink/run.py: -------------------------------------------------------------------------------- 1 | #Copyright Brian Haney 2022 2 | 3 | # Imports 4 | import util 5 | import main 6 | import config 7 | 8 | ## Hash image 9 | from util import hash_file_data 10 | x = hash_file_data('link.png') 11 | y = hash_file_data('link.png', 'base64') 12 | print(x) 13 | print(y) 14 | 15 | ## Create Asset 16 | from main import create 17 | from config import creator_passphrase 18 | create(creator_passphrase) 19 | -------------------------------------------------------------------------------- /goLink/util.py: -------------------------------------------------------------------------------- 1 | # Imports 2 | import hashlib 3 | import base64 4 | import algosdk 5 | from algosdk import account, mnemonic 6 | 7 | def hash_file_data(filename, return_type="bytes"): 8 | filebytes = open(filename, 'rb').read() 9 | h = hashlib.sha256() 10 | h.update(filebytes) 11 | if return_type == "bytes": 12 | return h.digest() 13 | elif return_type == "base64": 14 | return base64.b64encode(h.digest()) 15 | 16 | def sign_and_send(txn, passphrase, client): 17 | private_key = mnemonic.to_private_key(passphrase) 18 | stxn = txn.sign(private_key) 19 | txid = stxn.transaction.get_txid() 20 | client.send_transaction(stxn) 21 | wait_for_confirmation(client, txid, 5) 22 | print('Confirmed TXID: {}'.format(txid)) 23 | txinfo = client.pending_transaction_info(txid) 24 | return txinfo 25 | --------------------------------------------------------------------------------