This repository was archived by the owner on Apr 30, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
Build: Completed Bank Card Payment Validator #31
Open
emmaodia
wants to merge
5
commits into
iExecBlockchainComputing:master
Choose a base branch
from
emmaodia:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0d0c126
Build: Completed Bank Card Payment Validator
emmaodia e64158d
Updated Build after code review
emmaodia a481f08
Build: tlsNotaryDOracle
emmaodia bbfa37c
Build Updated
emmaodia 9ea7c55
Merge pull request #1 from emmaodia/tlsNotaryDOracle
emmaodia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| DWOLLA_APP_KEY='yTS7SjznX9BndQi0wgqS72Dx0T1oNhg5KLofB3Hb9hifrahzBg' | ||
| DWOLLA_APP_SECRET='zr5fbPQaTnEJ6LIzNMPk6nMFrTxPQqRrkwQ8xF7AwezHEhn2oI' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| FROM node:11-alpine | ||
| COPY dwolla-card-validator.js /src/dwolla-card-validator.js | ||
| COPY entrypoint.sh /entrypoint.sh | ||
| RUN npm i https ethers fs dwolla-v2 | ||
| RUN chmod +x /entrypoint.sh | ||
| ENTRYPOINT ["/entrypoint.sh"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| const https = require('https'); | ||
| const ethers = require('ethers'); | ||
| const fs = require('fs'); | ||
| require('dotenv').config(); | ||
|
|
||
| const root = 'iexec_out'; | ||
| const determinismFilePath = `${root}/determinism.iexec`; | ||
| const callbackFilePath = `${root}/callback.iexec`; | ||
| const errorFilePath = `${root}/error.iexec`; | ||
|
|
||
|
|
||
| /***************************************************************************** | ||
| * TOOLS * | ||
| *****************************************************************************/ | ||
|
|
||
| const Client = require("dwolla-v2").Client; | ||
|
|
||
| /***************************************************************************** | ||
| * CONFIG * | ||
| *****************************************************************************/ | ||
|
|
||
| // dwolla api key | ||
| const APIKEY = process.env.DWOLLA_APP_KEY; | ||
| const SECRET = process.env.DWOLLA_APP_SECRET | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where are these envvar coming from? I don't see them set anywhere. Should they come from a dataset? You cannot expect the worker to have them "by default" |
||
|
|
||
| /***************************************************************************** | ||
| * ARGUMENTS * | ||
| *****************************************************************************/ | ||
|
|
||
| var dwolla = new Client({ | ||
| environment: "sandbox" // defaults to 'production' | ||
| }); | ||
|
|
||
| /***************************************************************************** | ||
| * HTTP QUERY * | ||
| *****************************************************************************/ | ||
| let URL='/api-sandbox.dwolla.com/transfers/${id}'; //In production use api.dwolla.com | ||
|
|
||
| const query = { | ||
| method: 'GET', | ||
| port: 443, | ||
| host: 'api-sandbox.dwolla.com', //In production use api.dwolla.com | ||
| path: URL | ||
| }; | ||
|
|
||
| /***************************************************************************** | ||
| * EXECUTE * | ||
| *****************************************************************************/ | ||
| new Promise(async (resolve, reject) => { | ||
|
|
||
| console.log(`- Calling API ${query.host}${query.path}`); | ||
| let chunks = []; | ||
| let request = https.request(query, res => { | ||
| res.on('data', (chunk) => { | ||
| chunks.push(chunk); | ||
| }); | ||
| res.on('end', () => { | ||
| if (chunks.length) | ||
| { | ||
| resolve(chunks.join('')); | ||
| } | ||
| else | ||
| { | ||
| reject(`[HTTP ERROR]\nstatusCode: ${res.statusCode}`); | ||
| } | ||
| }); | ||
| }); | ||
| request.on('error', reject); | ||
| request.end(); | ||
| }) | ||
| .then(data => { | ||
| let results = JSON.parse(data.toString()); | ||
|
|
||
| if (results.error !== undefined) | ||
| { | ||
| throw new Error(results.error); | ||
| } | ||
|
|
||
| .then(res => const response = { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this then isn't attached to anything. |
||
| return { | ||
| amount: { currency: res.currency, | ||
| value: res.value } | ||
| correlationId: res.correlationId, | ||
| request: { | ||
| type: 'GET', | ||
| } | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where are these values ( |
||
| } ); | ||
|
|
||
| var iexeccallback = ethers.utils.defaultAbiCoder.encode(['uint256', 'string', 'uint256'], [id, amount, value]); | ||
| var iexecconsensus = ethers.utils.keccak256(iexeccallback); | ||
| fs.writeFile(callbackFilePath, iexeccallback , (err) => {}); | ||
| fs.writeFile(determinismFilePath, iexecconsensus, (err) => {}); | ||
|
|
||
| console.log(`- Success: ${results}`); | ||
| }) | ||
| .catch(error => { | ||
| fs.writeFile( | ||
| errorFilePath, | ||
| error.toString(), | ||
| (err) => {} | ||
| ); | ||
| fs.writeFile( | ||
| determinismFilePath, | ||
| ethers.utils.solidityKeccak256(['string'],[error.toString()]), | ||
| (err) => {} | ||
| ); | ||
| console.log(error.toString()); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| node src/price-feed.js $@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| { | ||
| "default": "kovan", | ||
| "chains": { | ||
| "dev": { | ||
| "host": "http://localhost:8545", | ||
| "sms": "http://localhost:5000", | ||
| "id": "17", | ||
| "hub": "0x60E25C038D70A15364DAc11A042DB1dD7A2cccBC" | ||
| }, | ||
| "ropsten": { | ||
| "host": "https://ropsten.infura.io/v3/f3e0664e01504f5ab2b4360853ce0dc7", | ||
| "id": "3" | ||
| }, | ||
| "rinkeby": { | ||
| "host": "https://rinkeby.infura.io/v3/f3e0664e01504f5ab2b4360853ce0dc7", | ||
| "id": "4" | ||
| }, | ||
| "kovan": { | ||
| "host": "https://kovan.infura.io/v3/f3e0664e01504f5ab2b4360853ce0dc7", | ||
| "id": "42", | ||
| "sms": "https://sms-kovan.iex.ec" | ||
| }, | ||
| "mainnet": { | ||
| "host": "https://mainnet.infura.io/v3/f3e0664e01504f5ab2b4360853ce0dc7", | ||
| "id": "1", | ||
| "sms": "https://sms-mainnet.iex.ec" | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "app": { | ||
| "42": "0x71bA4A5aDE91b7e05577bFC17C71cad1c71ecbe3" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| { | ||
| "description": "My iExec ressource description, must be at least 150 chars long in order to pass the validation checks. Describe your application, dataset or workerpool to your users", | ||
| "license": "MIT", | ||
| "author": "?", | ||
| "social": { | ||
| "website": "?", | ||
| "github": "?" | ||
| }, | ||
| "logo": "logo.png", | ||
| "buyConf": { | ||
| "params": "", | ||
| "tag": "0x0000000000000000000000000000000000000000000000000000000000000000", | ||
| "trust": "0", | ||
| "callback": "0x0000000000000000000000000000000000000000" | ||
| }, | ||
| "app": { | ||
| "owner": "0x3591CCE5B7318dCAA4597ABe846EF7Df7C5BCDcC", | ||
| "name": "DwollaCardValidator", | ||
| "type": "DOCKER", | ||
| "multiaddr": "registry.hub.docker.com/emmaodia/dwolla-card-validator:1.0.0", | ||
| "checksum": "0x131600405f0e8c32340a359b493d170d582c6bf911a38694947e65bd92efa559", | ||
| "mrenclave": "" | ||
| }, | ||
| "order": { | ||
| "apporder": { | ||
| "app": "0x71bA4A5aDE91b7e05577bFC17C71cad1c71ecbe3", | ||
| "appprice": "0", | ||
| "volume": "1000000", | ||
| "tag": "0x0000000000000000000000000000000000000000000000000000000000000000", | ||
| "datasetrestrict": "0x0000000000000000000000000000000000000000", | ||
| "workerpoolrestrict": "0x0000000000000000000000000000000000000000", | ||
| "requesterrestrict": "0x0000000000000000000000000000000000000000" | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "42": { | ||
| "apporder": { | ||
| "app": "0x71bA4A5aDE91b7e05577bFC17C71cad1c71ecbe3", | ||
| "appprice": "0", | ||
| "volume": "1000000", | ||
| "tag": "0x0000000000000000000000000000000000000000000000000000000000000000", | ||
| "datasetrestrict": "0x0000000000000000000000000000000000000000", | ||
| "workerpoolrestrict": "0x0000000000000000000000000000000000000000", | ||
| "requesterrestrict": "0x0000000000000000000000000000000000000000", | ||
| "salt": "0xd564967de9260bbd045ae63ddd262d5390c937956a85d7304ae646079a361caa", | ||
| "sign": "0xca66d542c704d9faec383877ca3f71e6d260c22ec8a58f01e3a2aaea59c478205efb41b7f12c79787593b039373ca0db2d0b6f199fa05f4f782f7aff0cd0606b1c" | ||
| } | ||
| } | ||
| } |
Submodule smart-contract
added at
b7cd4e
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| node_modules | ||
| .env |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| FROM node:11-alpine | ||
| COPY tls-notary.js /src/tls-notary.js | ||
| COPY entrypoint.sh /entrypoint.sh | ||
| RUN npm i https ethers fs node-forge | ||
| RUN chmod +x /entrypoint.sh | ||
| ENTRYPOINT ["/entrypoint.sh"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| node src/tls-notary.js $@ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is dwolla-v2 available? I don't see it being installed in the dockerfile.