diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..442375e --- /dev/null +++ b/.eslintrc @@ -0,0 +1,20 @@ +{ + "extends": [ + "airbnb-base" + ], + "rules": { + "indent": ["error", 4], + "no-console": "off", + "no-underscore-dangle": "off" + }, + "env": { + "mocha": true, + "node": true, + "es6": true + }, + "globals": { + "artifacts": false, + "contract": false, + "assert": false + } +} \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 425aba8..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,280 +0,0 @@ -module.exports = { - "env": { - "es6": true, - "node": true - }, - "extends": "eslint:recommended", - "parserOptions": { - "sourceType": "module", - "ecmaVersion": 2017 - }, - "rules": { - "accessor-pairs": "error", - "array-bracket-newline": "error", - "array-bracket-spacing": "error", - "array-callback-return": "error", - "array-element-newline": "off", - "arrow-body-style": "off", - "arrow-parens": [ - "error", - "as-needed" - ], - "arrow-spacing": [ - "error", - { - "after": true, - "before": true - } - ], - "block-scoped-var": "error", - "block-spacing": [ - "error", - "always" - ], - "callback-return": "error", - "camelcase": "error", - "capitalized-comments": "off", - "class-methods-use-this": "error", - "comma-dangle": "error", - "comma-spacing": [ - "error", - { - "after": true, - "before": false - } - ], - "comma-style": "warn", - "complexity": "error", - "computed-property-spacing": [ - "error", - "never" - ], - "consistent-return": "error", - "consistent-this": "warn", - "curly": "error", - "default-case": "error", - "dot-location": "off", - "dot-notation": [ - "error", - { - "allowKeywords": true - } - ], - "eol-last": "error", - "eqeqeq": "error", - "for-direction": "error", - "func-call-spacing": "error", - "func-name-matching": "error", - "func-names": [ - "error", - "never" - ], - "func-style": [ - "error", - "declaration" - ], - "function-paren-newline": "off", - "generator-star-spacing": "error", - "getter-return": "error", - "global-require": "error", - "guard-for-in": "off", - "handle-callback-err": "error", - "id-blacklist": "error", - "id-length": "off", - "id-match": "error", - "indent": [2,2], - "indent-legacy": "off", - "init-declarations": "error", - "jsx-quotes": "error", - "key-spacing": "error", - "keyword-spacing": "error", - "line-comment-position": "error", - "linebreak-style": [ - "error", - "unix" - ], - "lines-around-comment": "error", - "lines-around-directive": "error", - "max-depth": "error", - "max-len": "off", - "max-lines": "warn", - "max-nested-callbacks": "error", - "max-params": "off", - "max-statements": "off", - "max-statements-per-line": "off", - "new-parens": "off", - "newline-after-var": "off", - "newline-before-return": "off", - "newline-per-chained-call": "error", - "no-alert": "error", - "no-array-constructor": "error", - "no-await-in-loop": "error", - "no-bitwise": [ - "error", - { - "int32Hint": true - } - ], - "no-buffer-constructor": "error", - "no-caller": "error", - "no-catch-shadow": "error", - "no-confusing-arrow": "off", - "no-console": "warn", - "no-continue": "error", - "no-div-regex": "error", - "no-duplicate-imports": "error", - "no-else-return": "off", - "no-empty-function": "error", - "no-eq-null": "error", - "no-eval": "error", - "no-extend-native": "error", - "no-extra-bind": "error", - "no-extra-label": "error", - "no-extra-parens": "error", - "no-floating-decimal": "error", - "no-implicit-coercion": "error", - "no-implicit-globals": "error", - "no-implied-eval": "error", - "no-inline-comments": "error", - "no-invalid-this": "error", - "no-iterator": "error", - "no-label-var": "error", - "no-labels": "error", - "no-lone-blocks": "error", - "no-lonely-if": "error", - "no-loop-func": "error", - "no-magic-numbers": "off", - "no-mixed-operators": "error", - "no-mixed-requires": "error", - "no-multi-assign": "off", - "no-multi-spaces": "error", - "no-multi-str": "error", - "no-multiple-empty-lines": "error", - "no-native-reassign": "error", - "no-negated-condition": "error", - "no-negated-in-lhs": "error", - "no-nested-ternary": "error", - "no-new": "error", - "no-new-func": "error", - "no-new-object": "error", - "no-new-require": "error", - "no-new-wrappers": "error", - "no-octal-escape": "error", - "no-param-reassign": "error", - "no-path-concat": "error", - "no-plusplus": "error", - "no-process-env": "off", - "no-process-exit": "warn", - "no-proto": "error", - "no-prototype-builtins": "error", - "no-restricted-globals": "error", - "no-restricted-imports": "error", - "no-restricted-modules": "error", - "no-restricted-properties": "error", - "no-restricted-syntax": "error", - "no-return-assign": "off", - "no-return-await": "error", - "no-script-url": "error", - "no-self-compare": "error", - "no-sequences": "error", - "no-shadow": "error", - "no-shadow-restricted-names": "error", - "no-spaced-func": "error", - "no-sync": "warn", - "no-tabs": "error", - "no-template-curly-in-string": "error", - "no-ternary": "off", - "no-throw-literal": "error", - "no-trailing-spaces": "error", - "no-undef-init": "error", - "no-undef":"error", - "no-undefined": "off", - "no-underscore-dangle": "off", - "no-unmodified-loop-condition": "error", - "no-unneeded-ternary": "error", - "no-unreachable": "warn", - "no-unused-expressions": "error", - "no-unused-vars": [ - "error", - { "vars": "all", "args": "none"} - ], - "no-use-before-define": "error", - "no-useless-call": "error", - "no-useless-computed-key": "error", - "no-useless-concat": "error", - "no-useless-constructor": "error", - "no-useless-rename": "error", - "no-useless-return": "error", - "no-var": "off", - "no-void": "error", - "no-warning-comments": "warn", - "no-whitespace-before-property": "error", - "no-with": "error", - "nonblock-statement-body-position": "error", - "object-curly-newline": "error", - "object-curly-spacing": "off", - "object-property-newline": [ - "error", - { - "allowMultiplePropertiesPerLine": true - } - ], - "object-shorthand": "off", - "one-var": "off", - "one-var-declaration-per-line": "error", - "operator-assignment": "error", - "operator-linebreak": "error", - "padded-blocks": "off", - "padding-line-between-statements": "error", - "prefer-arrow-callback": "off", - "prefer-const": "error", - "prefer-destructuring": "off", - "prefer-numeric-literals": "error", - "prefer-promise-reject-errors": "error", - "prefer-reflect": "off", - "prefer-rest-params": "error", - "prefer-spread": "error", - "prefer-template": "off", - "quote-props": "off", - "quotes": "off", - "radix": "error", - "require-await": "error", - "require-jsdoc": "off", - "rest-spread-spacing": "error", - "semi": ["error", "always"], - "semi-spacing": "error", - "semi-style": [ - "error", - "last" - ], - "sort-imports": "error", - "sort-keys": "off", - "sort-vars": "off", - "space-before-blocks": "error", - "space-before-function-paren": "off", - "space-in-parens": "off", - "space-infix-ops": "off", - "space-unary-ops": "error", - "spaced-comment": "off", - "strict": "warn", - "switch-colon-spacing": "error", - "symbol-description": "error", - "template-curly-spacing": [ - "error", - "never" - ], - "template-tag-spacing": "error", - "unicode-bom": [ - "error", - "never" - ], - "valid-jsdoc": "off", - "wrap-iife": "error", - "wrap-regex": "error", - "yield-star-spacing": "error", - "yoda": [ - "error", - "never" - ] - } -}; diff --git a/.gitignore b/.gitignore index 9feaec5..abcc1f7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,10 @@ # OSX .DS_Store - .idea/ +# VS Code +.vscode + # Vagrant .vagrant/ ubuntu-xenial-16.04-cloudimg-console.log @@ -10,11 +12,8 @@ ubuntu-xenial-16.04-cloudimg-console.log # don't commit node_modules node_modules -mocha_test/scripts/env_vars.sh -mocha_test/scripts/ost-price-oracle/ -mocha_test/scripts/poa-genesis.json -mocha_test/scripts/pw -mocha_test/scripts/st-poa/ - package-lock.json build/ + +contracts/abi/ +contracts/bin/ \ No newline at end of file diff --git a/.jsdoc.json b/.jsdoc.json deleted file mode 100644 index d428f6b..0000000 --- a/.jsdoc.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "tags": { - "allowUnknownTags": true - }, - "source": { - "include": ["config/", "helpers/", "lib/", "tools"], - "exclude": [], - "includePattern": ".+\\.js(doc|x)?$", - "excludePattern": "(^|\\/|\\\\)_" - }, - "plugins": [ - "jsdoc-route-plugin" - ], - "recurseDepth": 5, - "templates": { - "systemName" : "OpenST Payments", - "footer" : "", - "copyright" : "OpenST Foundation Ltd.", - "includeDate" : false, - "theme" : "lumen", - "navType" : "vertical", - "linenums" : true, - "cleverLinks" : true, - "monospaceLinks" : true, - "default": { - "outputSourceFiles": true - } - }, - "opts": { - "destination": "./docs/", - "encoding": "utf8", - "private": true, - "recurse": true, - "template": "./node_modules/ink-docstrap/template", - "readme": "./README.md" - } -} \ No newline at end of file diff --git a/.solcover.js b/.solcover.js new file mode 100644 index 0000000..1767ccb --- /dev/null +++ b/.solcover.js @@ -0,0 +1,6 @@ +module.exports = { + port: 8555, + compileCommand: '../node_modules/.bin/truffle compile', + testCommand: '../node_modules/.bin/truffle test --network coverage', + skipFiles: ['truffle/Migrations.sol'] +}; \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 103eff6..4d64a72 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,6 @@ branches: only: - master - develop - - release-1.0 - - pre-release-v1.0.8 notifications: email: recipients: @@ -15,80 +13,20 @@ notifications: on_failure: always node_js: - "8" -env: - - GETH_VERSION=1.7.2 -matrix: - include: - - if: branch =~ ^master - env: GETH_VERSION=1.7.2 - node_js: "8" - - if: branch =~ ^master - env: GETH_VERSION=1.8.3 - node_js: "8" - - if: branch =~ ^master - env: GETH_VERSION=1.8.8 - node_js: "8" - - if: branch =~ ^develop - env: GETH_VERSION=1.7.2 - node_js: "8" - - if: branch =~ ^develop - env: GETH_VERSION=1.8.3 - node_js: "8" - - if: branch =~ ^develop - env: GETH_VERSION=1.8.8 - node_js: "8" - - if: branch =~ ^master - env: GETH_VERSION=1.7.2 - node_js: "9" - - if: branch =~ ^master - env: GETH_VERSION=1.8.3 - node_js: "9" - - if: branch =~ ^master - env: GETH_VERSION=1.8.8 - node_js: "9" - - if: branch =~ ^develop - env: GETH_VERSION=1.7.2 - node_js: "9" - - if: branch =~ ^develop - env: GETH_VERSION=1.8.3 - node_js: "9" - - if: branch =~ ^develop - env: GETH_VERSION=1.8.8 - node_js: "9" - -services: - - mysql before_install: - - mysql -e 'CREATE DATABASE payment_development;' - - sudo apt-get update - - sudo apt-get install nodejs - - sudo apt-get install npm + - sudo apt-get update + - sudo apt-get install nodejs + - sudo apt-get install npm - sudo apt-get install software-properties-common - sudo add-apt-repository -y ppa:ethereum/ethereum - sudo apt-get update - - sudo bash mocha_test/scripts/install_geth_$GETH_VERSION.sh - - geth version - - sudo apt-get install solc -install: - - npm install + - sudo apt-get --allow-unauthenticated install solc +install: + - npm install before_script: - - mkdir -p ~/.ethash - - geth makedag 0 ~/.ethash - - nohup sh tools/runTestRpc.sh /dev/null 2>&1 & - - bash contracts/compile.sh - - mkdir -p dynamodb - - wget https://s3.ap-south-1.amazonaws.com/dynamodb-local-mumbai/dynamodb_local_latest.zip -O ./dynamodb/dynamodb_local_latest.zip - - unzip ./dynamodb/dynamodb_local_latest.zip - - nohup java -Djava.library.path=./dynamodb/DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb & - - sleep 30 - - . ./mocha_test/scripts/set_env_vars.sh - - node tools/dynamo_db_init.js + - nohup sh tools/runGanacheCli.sh /dev/null 2>&1 & + - bash tools/compile.sh script: - - truffle test - - cd mocha_test/scripts/ - - bash travis_test.sh + - truffle test after_script: - kill $(ps aux | grep 'testrpc' | awk '{print $2}') - - kill $(ps aux | grep 'geth' | awk '{print $2}') - - kill $(ps aux | grep 'DynamoDBLocal.jar' | awk '{print $2}') - - rm -rf dynamodb diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bfbdf6..e69de29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,68 +0,0 @@ -## OpenST-Payments v1.0.8 -#####OpenST-storage and dynamoDB integration for token balances ([openst-payments#124](https://github.com/OpenSTFoundation/openst-payments/issues/124)) -DynamoDB integration for token balance - Now the balances (settled and unsettled debits) are being stored in DynamoDB. -Openst-Storage takes care of implementing the model class for DynamoDB tables and is integrated in OpenST-Payments in this release. -Cache for token balances is now responsibility of the OpenST-Storage module and is removed from OpenST-Payments module. - -## OpenST-Payments v1.0.7 (23 May 2018) - -Changelog: - -- Airdrop contract gas limit is increased because of contract changes. -- Reason is added in logs when transaction fails. - -## OpenST-Payments v1.0.6 (17 May 2018) - -Changelog: - -- Fix for double credit issue is done. On few cases of payment transactions beneficiary was credited two times. -- Solidity/solc is upgraded to 0.4.23. All contracts compile warnings are handled and contracts are upgraded with latest syntax. -- Truffle package is upgraded to 4.1.8. -- Fixes for travis broken tests is added. -- New response helper integration. Standardized error codes are now being used in OST Price Oracle. -- OpenST base web3 integration. Web socket connection to geth is now being used and preferred over RPC connection. -- OpenST base integration with logger is done. -- New services for payment success and failure were added. This was part of payment transactions optimization fixes. -- Loggers updated from into to debug wherever necessary. Log level support was introduced and non-important logs were moved to debug log level. -- Gas limit optimization on transactions is done. Predefined calculated gas limit with buffer is defined for each type of transactions. -- Support for web socket is added. -- Geth version updated to 1.0.0-beta.33. - -## OpenST-Payments v1.0.5.beta.1 - -Changelog: -- Added new services and services refactoring -- Readme update as per updated services -- Comments updated for services - -## OpenST-Payments v1.0.4.beta.2 - -Changelog: -- Upgrade Geth and Web3 version -- while transferring from reserve to airdrop budget holder validate if reserve has sufficient balance. - -## OpenST-Payments v1.0.4 - -Changelog: -- Changed error message when insufficient balance -- Changed error message when insufficient gas - -## OpenST-Payments v1.0.3 - -Changelog: -- Added error code for insufficient gas fund -- Added error code for transaction receipt with status 0 - -## OpenST-Payments v1.0.2 - -Changelog: -- Airdrop table caching and integration - -## OpenST-Payments v1.0.1 - -Changelog: -- Fixed - Exception coming when converting Number to BigNumber with high precision - -## OpenST-Payments v1.0.0 (14 March 2018) - -OpenST-Payments 1.0.0 is the first release of OpenST-Payments. It provides `Airdrop` and `Pricer` contracts for token transfers, defines a `PriceOracle` interface, and introduces the concept of `Workers`. diff --git a/OpenSTv0.9.4Components.jpg b/OpenSTv0.9.4Components.jpg new file mode 100644 index 0000000..22eb42b Binary files /dev/null and b/OpenSTv0.9.4Components.jpg differ diff --git a/README.md b/README.md index 0dced26..274cfcc 100644 --- a/README.md +++ b/README.md @@ -1,261 +1,33 @@ -# OpenST Payments - Advance Payment infrastructure on top of the [OpenST network](https://simpletoken.org) +

OpenST - Empowering Decentralized Economies

-[![Latest version](https://img.shields.io/npm/v/@openstfoundation/openst-payments.svg?maxAge=3600)](https://www.npmjs.com/package/@openstfoundation/openst-payments) -[![Travis](https://img.shields.io/travis/OpenSTFoundation/openst-payments.svg?maxAge=600)](https://travis-ci.org/OpenSTFoundation/openst-payments) -[![Downloads per month](https://img.shields.io/npm/dm/@openstfoundation/openst-payments.svg?maxAge=3600)](https://www.npmjs.com/package/@openstfoundation/openst-payments) [![Gitter: JOIN CHAT](https://img.shields.io/badge/gitter-JOIN%20CHAT-brightgreen.svg)](https://gitter.im/OpenSTFoundation/SimpleToken) -While OpenST 0.9 is available as-is for anyone to use, we caution that this is early stage software and under heavy ongoing development and improvement. Please report bugs and suggested improvements. +OpenST blockchain infrastructure empowers new economies for mainstream businesses and emerging (D)Apps. The central component of this infrastructure is the OpenST Protocol, a framework for tokenizing businesses. -# Install OpenST Payments +_While OpenST is available as-is for anyone to use, we caution that this is early stage software and under heavy ongoing development and improvement. Please report bugs and suggested improvements._ -```bash -npm install @openstfoundation/openst-payments --save -``` +#### Purpose -# Init DynamoDB -Following commands need to be run once, only for the first time. DynamoDB initial migrations for shard management are -run in it and one shard is created and registered for storing token balance. +This repository houses the work that focuses on improving the usability of decentralized applications. -```bash -. ./mocha_test/scripts/set_env_vars.sh -node tools/dynamo_db_init.js -``` +OpenST-contracts is a collection of smart contracts that enable developers to program Token Economies. +
-# Run Test Chain +The major components of this repository are the TokenHolder contracts, TokenRules contract, and the custom Rule contracts that can be registered with the TokenRules contracts to establish the economy specific payments and rewards. +
-```bash -cd mocha_test/scripts/ -sh start_test_chain.sh -``` +TokenHolder Contracts are multi-sig contracts with multiple ownership keys that are housed in different wallets that are controlled by a single human owner (say, a participant in the token economy). The multi-sig logic supports both custodial and fully decentralized key management, thus supporting a wide range of user profiles. +
-# Set EVN Variables +TokenRules Contract and custom Rule Contracts represent the administration functionality that enables economy managers to design intra-economy transactions that map to their business logic. -### Setup Initial Setup Variables: +#### Diagram -```bash -export OST_UTILITY_GETH_RPC_PROVIDER='' -export OST_UTILITY_GETH_WS_PROVIDER='' -export OST_UTILITY_DEPLOYER_ADDR='' -export OST_UTILITY_DEPLOYER_PASSPHRASE='' -export OST_UTILITY_OPS_ADDR='' -export OST_UTILITY_OPS_PASSPHRASE='' -``` +![Image for readme](OpenSTv0.9.4Components.jpg) -### Deploy Branded Token Contract: +#### Related Repositories -```bash -node tools/deploy/EIP20TokenMock.js conversionRate symbol name decimals gasPrice -``` +[openst.js](https://github.com/OpenSTFoundation/openst.js): OpenST.js is a library that enables interaction with openst-contracts to easily create token economies in (D)Apps. The library supports deploying and/or interacting with token, token holder, token rules, and token rule contracts. -### Deploy Workers Contract: - -```bash -node tools/deploy/workers.js gasPrice chainId -``` - -### Deploy Airdrop Contract: - -```bash -node tools/deploy/airdrop.js brandedTokenContractAddress baseCurrency workerContractAddress airdropBudgetHolder gasPrice chainId -``` - -### Set Caching Engine: - -```bash -export OST_CACHING_ENGINE='none' -For using redis/memcache as cache engine refer - [OpenSTFoundation/ost-price-oracle](https://github.com/OpenSTFoundation/ost-price-oracle) -``` - -### Set DB Details For Payments/Airdrop: - -```bash -export OP_MYSQL_HOST='' -export OP_MYSQL_USER='' -export OP_MYSQL_PASSWORD='' -export OP_MYSQL_DATABASE='' -export OP_MYSQL_CONNECTION_POOL_SIZE='5' -``` - -### Create Airdrop Tables: - -```bash -node migrations/create_tables.js -``` - -# Deploy Service Examples: -```js -const OpenSTPayment = require('@openstfoundation/openst-payments') - , Deploy = OpenSTPayment.services.deploy -; - // Deploy Workers - const deployWorkerObject = new Deploy.workers({ - gas_price: gasPrice, - options: {returnType: 'txHash'} - }); - deployWorkerObject.perform(); - - // Deploy Airdrop - const deployAirdropObject = new Deploy.airdrop({ - branded_token_contract_address: brandedTokenAddress, - base_currency: baseCurrency, - worker_contract_address: workerContractAddress, - airdrop_budget_holder: airdropBudgetHolder, - gas_price: gasPrice, - options: {returnType: 'txHash'} - }); - deployAirdropObject.perform(); - -``` - -# OpsManaged Service Examples -```js -const OpenSTPayment = require('@openstfoundation/openst-payments') - , OpsManaged = OpenSTPayment.services.opsManaged -; - // Set Ops Address - const setOpsObject = new OpsManaged.setOps({ - contract_address: contractAddress, - gas_price: gasPrice, - chain_id: chainId, - deployer_address: deployerAddress, - deployer_passphrase: deployerPassphrase, - ops_address: opsAddress, - options: {returnType: 'txHash'} - }); - setOpsObject.perform(); - - // Get Ops Address - const getOpsObject = new OpsManaged.getOps({ - contract_address: contractAddress, - gas_price: gasPrice, - chain_id: chainId - }); - getOpsObject.perform(); -``` - -# Workers Service Examples -```js -const OpenSTPayment = require('@openstfoundation/openst-payments') - , Workers = OpenSTPayment.services.workers -; - // Set Worker - const setWorkerObject = new Workers.setWorker({ - workers_contract_address: constants.workersContractAddress, - sender_address: constants.ops, - sender_passphrase: constants.opsPassphrase, - worker_address: workerAddress, - deactivation_height: deactivationHeight.toString(10), - gas_price: gasPrice, - chain_id: chainId, - options: {returnType: 'txHash'} - }); - setWorkerObject.perform(); - - // Is Worker - const isWorkerObject = new Workers.isWorker({ - workers_contract_address: workersContractAddress, - worker_address: workerAddress, - chain_id: chainId - }); - isWorkerObject.perform(); -``` - -# Airdrop Management Service Examples: -```js -const OpenSTPayment = require('@openstfoundation/openst-payments') - , AirdropManager = OpenSTPayment.services.airdropManager -; - // Register Airdrop - const registerObject = new AirdropManager.register({ - airdrop_contract_address: airdropContractAddress, - chain_id: chainId - }); - registerObject.perform(); - - // Set Price Oracle - const setPriceOracleObject = new AirdropManager.setPriceOracle({ - airdrop_contract_address: airdropContractAddress, - chain_id: chainId, - sender_address: senderAddress, - sender_passphrase: senderPassphrase, - currency: currency, - price_oracle_contract_address: priceOracleContractAddress, - gas_price: gasPrice, - options: {tag: 'airdrop.setPriceOracle', returnType: 'txHash'} - }); - setPriceOracleObject.perform(); - - // Set Accepted Margin - const setAcceptedMarginObject = new AirdropManager.setAcceptedMargin({ - airdrop_contract_address: airdropContractAddress, - chain_id: chainId, - sender_address: senderAddress, - sender_passphrase: senderPassphrase, - currency: currency, - accepted_margin: acceptedMargin, - gas_price: gasPrice, - options: {tag: 'airdrop.setAcceptedMargin', returnType: 'txHash'} - }); - setAcceptedMarginObject.perform(); - - // Transfer Amount to airdrop budget holder - const transferObject = new AirdropManager.transfer({ - sender_address: senderAddress, - sender_passphrase: senderPassphrase, - airdrop_contract_address: airdropContractAddress, - amount: airdropBudgetAmountInWei, - gas_price: gasPrice, - chain_id: chainId, - options: {tag: 'airdrop.transfer', returnType: 'txHash'} - }); - transferObject.perform(); - - // Approve airdrop budget holder - const approveObject = new AirdropManager.approve({ - airdrop_contract_address: airdropContractAddress, - airdrop_budget_holder_passphrase: airdropBudgetHolderPassphrase, - gas_price: gasPrice, - chain_id: chainId, - options: {tag: 'airdrop.approve', returnType: 'txHash'} - }); - approveObject.perform(); - - // Allocate airdrop amount to users in batch - const batchAllocatorObject = new AirdropManager.batchAllocator({ - airdrop_contract_address: airdropContractAddress, - transaction_hash: transactionHash, - airdrop_users: {userAddress1: {airdropAmount: amountInWei, expiryTimestamp: 0}, userAddress2: {airdropAmount: amountInWei, expiryTimestamp: 0}}, - chain_id: chainId - }); - batchAllocatorObject.perform(); - - // Get Users Airdrop Balance - const userBalanceObject = new AirdropManager.userBalance({ - airdrop_contract_address: airdropContractAddress, - chain_id: chainId, - user_addresses: [user1, user2] - }); - userBalanceObject.perform(); - - // Call Pay method - const payObject = new AirdropManager.pay({ - airdrop_contract_address: airdropContractAddress, - chain_id: chainId, - sender_worker_address: workerAddress, - sender_worker_passphrase: workerPassphrase, - beneficiary_address: beneficiary, - transfer_amount: transferAmount.toString(10), - commission_beneficiary_address: commissionBeneficiary, - commission_amount: commissionAmount.toString(10), - currency: currency, - intended_price_point: intendedPricePoint, - spender: spenderAddress, - gas_price: gasPrice, - options: {tag:'airdrop.pay', returnType: 'txHash'} - }); - payObject.perform() - -``` - -For further implementation details, please refer to the [API documentation](https://openstfoundation.github.io/openst-payments/). \ No newline at end of file +[openst-js-examples](https://github.com/OpenSTFoundation/openst-js-examples): This repository contains an example usage of +OpenST.js where we walk you through registering rules, adding users, adding wallets to users, revoking ephemeral keys and other functionality in the context of a token economy. In order to make the best use of openst.js, we recommend working through the example to familiarize yourself with the functionality and usage of the library. diff --git a/SOLIDITY_STYLE_GUIDE.md b/SOLIDITY_STYLE_GUIDE.md new file mode 100644 index 0000000..076a788 --- /dev/null +++ b/SOLIDITY_STYLE_GUIDE.md @@ -0,0 +1,1855 @@ +# Style Guide + +## Table of Contents + + 1. [Code Layout](#code-layout) + 1. [Indentation](#indentation) + 2. [Tabs or Spaces](#tabs-or-spaces) + 3. [Blank Lines](#blank-lines) + 4. [Maximum Line Length](#maximum-line-length) + 5. [Imports](#imports) + 6. [Order of Declarations](#order-of-declarations) + 7. [Whitespace in Expressions](#whitespace-in-expressions) + 8. [Control Structures](#control-structures) + 9. [Function Declarations](#function-declarations) + 10. [Variable Declarations](#variable-declarations) + 11. [Other Recommendations](#other-recommendations) + 2. [Naming Conventions](#naming-conventions) + 1. [Naming Styles](#naming-styles) + 2. [Names to Avoid](#names-to-avoid) + 3. [Contract and Library Names](#contract-and-library-names) + 4. [Struct Names](#struct-names) + 5. [Event Names](#event-names) + 6. [Function Names](#function-names) + 7. [Function Argument Names](#function-argument-names) + 8. [Function Return Parameter Names](#function-return-parameter-names) + 9. [Local and State Variable Names](#local-and-state-variable-names) + 10. [Constants](#constants) + 11. [Modifier Names](#modifier-names) + 12. [Enums](#enums) + 13. [Avoiding Naming Collisions](#avoiding-naming-collisions) + 3. [Best Practices](#best-practices) + 1. [Variable Initialization](#variable-initialization) + 2. [Casting](#casting) + 3. [Require and Assert](#require-and-assert) + 4. [Function Returns](#function-returns) + 4. [Documentation](#documentation) + 1. [Single Line](#single-line) + 2. [Multi Line](#multi-line) + 3. [Structs and Mappings](#structs-and-mappings) + 4. [Spaces](#spaces) + 5. [English Sentence](#english-sentence) + 6. [Grouping](#grouping) + 7. [Alignment](#alignment) + 8. [Sections](#sections) + 5. [Comments](#comments) + +*The current style guide is mostly based on [Ethereum Solidity Style Guide](http://solidity.readthedocs.io/en/v0.4.24/style-guide.html) +with some changes and additions.* + +## Code Layout + +### Indentation + +Use 4 spaces per indentation level. + +### Tabs or Spaces + +Only spaces are are allowed as indentation method. + +### Blank Lines + +Surround top level declarations in solidity source with two blank lines. + +`Good` + +```solidity +import "Foo.sol" + + +contract A { + ... +} + + +contract B { + ... +} + + +contract C { + ... +} +``` + +`Bad` + +```solidity +contract A { + ... +} +contract B { + ... +} + +contract C { + ... +} +``` + +Within a contract surround function and event declarations with a single blank line. + +Blank lines may be omitted between groups of related one-liners (such as stub functions for an abstract contract) + +`Good` + +```solidity +contract A { + function spam() public; + function ham() public; +} + +contract B is A { + + function spam() public { + ... + } + + function ham() public { + ... + } +} +``` + +`Bad` + +```solidity +contract A { + + function spam() public { + ... + } + function ham() public { + ... + } +} +``` + +Within a contract surround event, enum, struct and modifier declarations +with a *single* blank line. + +`Example` + +```solidity +contract A { + + /* Events */ + + event StakeRequested(address _staker, uint256 _amount, address _beneficiary); + + event StakeRequestReverted(address _staker, uint256 _amount); + + + /* Structs */ + + struct Mint { + ... + } + + struct Redemption { + ... + } + + + /* Modifiers */ + + modifier onlyRegistrar() { + ... + } + + modifier onlyOwner() { + ... + } +} +``` + +Within a struct, surround documented field declarations with a *single* blank +line. + +`Example` + +```solidity +/** + * Message stores the message content as well as additional data about the + * sender and the receiver. This way, it can be verified that the message has + * not been manipulated. + */ +struct Message { + /** + * The message content bytes encoded. + * The string encoding must be UTF-8. + */ + bytes32 message; + + /** Address where the message should be sent to. */ + address receiver; + + /** Address of the account that created this message. */ + address sender; + + /** + * The signature is created by the sender and is the signed hash of the + * message: sha3(message, receiver, sender). + */ + bytes32 signature; +} +``` + +Section declarations should follow with a single blank line: + +`Good` + +```solidity +contract A { + + /* Usings */ + + using SafeMath for uint256; + + + /* Events */ + + event StakeRequested(address _staker, uint256 _amount, address _beneficiary); + + event StakeRequestReverted(address _staker, uint256 _amount); + + + /* Public Functions */ + + function spam() public { + ... + } + + function ham() public { + ... + } +} +``` + +`Bad` + +```solidity +contract A { + + /* Events */ + event StakeRequested(address _staker, uint256 _amount, address _beneficiary); + + event StakeRequestReverted(address _staker, uint256 _amount); +} + +contract A { + + /* Events */ + + + event StakeRequested(address _staker, uint256 _amount, address _beneficiary); + + event StakeRequestReverted(address _staker, uint256 _amount); +} +``` + +Surround declaration groups (using sections, event sections, function sections, etc) +in solidity contract with *two* blank lines. + +`Good` + +```solidity +contract A { + + /* Usings */ + + using SafeMath for uint256; + + + /* Events */ + + event StakeRequested(address _staker, uint256 _amount, address _beneficiary); + + event StakeRequestReverted(address _staker, uint256 _amount); + + event StakeRequestRejected(address _staker, uint256 _amount, uint8 _reason); + + + /* Public Functions */ + + function spam() public { + ... + } + + function ham() public { + ... + } + + + /* Private Functions */ + + function foo() { + ... + } +} +``` + +`Bad` + +```solidity +contract A { + + /* Usings */ + + using SafeMath for uint256; + /* Events */ + + event StakeRequested(address _staker, uint256 _amount, address _beneficiary); + + event StakeRequestReverted(address _staker, uint256 _amount); + + event StakeRequestRejected(address _staker, uint256 _amount, uint8 _reason); +} + +contract A { + + /* Usings */ + + using SafeMath for uint256; + + /* Events */ + + event StakeRequested(address _staker, uint256 _amount, address _beneficiary); + + event StakeRequestReverted(address _staker, uint256 _amount); + + event StakeRequestRejected(address _staker, uint256 _amount, uint8 _reason); +} +``` + +### Maximum Line Length + +Keeping lines to a maximum of 79 characters helps readers easily parse the code. + +Wrapped lines should conform to the following guidelines. + +- The first argument should not be attached to the opening parenthesis. +- One, and only one, indent should be used. +- Each argument should fall on its own line. +- The terminating element `);` , should be placed on the final line by itself. + +Function Calls + +`Good` + +```solidity +thisFunctionCallIsReallyLong( + longArgument1, + longArgument2, + longArgument3 +); +``` + +`Bad` + +```solidity +thisFunctionCallIsReallyLong(longArgument1, + longArgument2, + longArgument3 +); + +thisFunctionCallIsReallyLong( + longArgument1, + longArgument2, + longArgument3 +); + +thisFunctionCallIsReallyLong(longArgument1, + longArgument2, + longArgument3 +); + +thisFunctionCallIsReallyLong( + longArgument1, longArgument2, + longArgument3 +); + +thisFunctionCallIsReallyLong( +longArgument1, +longArgument2, +longArgument3 +); + +thisFunctionCallIsReallyLong( + longArgument1, + longArgument2, + longArgument3); +``` + +Assignment Statements + +`Good` + +```solidity +thisIsALongNestedMapping[being][set][to_some_value] = someFunction( + argument1, + argument2, + argument3, + argument4 +); +``` + +`Bad` + +```solidity +thisIsALongNestedMapping[being][set][to_some_value] = someFunction(argument1, + argument2, + argument3, + argument4); +``` + +Event Definitions and Event Emitters + +`Good` + +```solidity +event LongAndLotsOfArgs( + address sender, + address recipient, + uint256 publicKey, + uint256 amount, + bytes32[] options +); + +emit LongAndLotsOfArgs( + sender, + recipient, + publicKey, + amount, + options +); +``` + +`Bad` + +```solidity +event LongAndLotsOfArgs(address sender, + address recipient, + uint256 publicKey, + uint256 amount, + bytes32[] options); + +LongAndLotsOfArgs(sender, + recipient, + publicKey, + amount, + options); +``` + +### Imports + +Import statements should always be placed at the top of the file. + +`Good` + +```solidity +import "owned"; + + +contract A { + ... +} + + +contract B is owned { + ... +} +``` + +`Bad` + +```solidity +contract A { + ... +} + + +import "owned"; + + +contract B is owned { + ... +} +``` + +### Order of Declarations + +Ordering helps readers identify which functions they can call +and to find the constructor and fallback definitions easier. + +Hence, functions should be grouped according to their visibility and ordered: + +- constructor +- fallback function (if exists) +- external functions +- public functions +- internal functions +- private functions + +The suggested order for variables' declarations is: + +- public variables +- internal variables +- private variables + +Within a grouping, place the `view` and `pure` functions last. + +To read contract top down the following order is suggested: + +- usings +- events +- constants +- enums +- structs +- public variables +- internal variables +- private variables +- modifiers +- functions + - constructor + - fallback function (if exists) + - external functions + - public functions + - internal functions + - private functions + +### Whitespace in Expressions + +Avoid extraneous whitespace in the following situations: + +Immediately inside parenthesis, brackets or braces, with the exception of +single line function declarations. + +`Good` + +```solidity +spam(ham[1], Coin({name: "ham"})); +``` + +`Bad` + +```solidity +spam( ham[ 1 ], Coin( { name: "ham" } ) ); +``` + +`Exception` + +```solidity +function singleLine() public { spam(); } +``` + +Immediately before a comma, semicolon: + +`Good` + +```solidity +function spam(uint i, Coin coin) public; +``` + +`Bad` + +```solidity +function spam(uint i , Coin coin) public ; +``` + +More than one space around an assignment or other operator to align with another: + +`Good` + +```solidity +x = 1; +y = 2; +long_variable = 3; +``` + +`Bad` + +```solidity +x = 1; +y = 2; +long_variable = 3; +``` + +Don't include a whitespace in the fallback function: + +`Good` + +```solidity +function() external { + ... +} +``` + +`Bad` + +```solidity +function () external { + ... +} +``` + +### Control Structures + +The braces denoting the body of a contract, library, functions and structs should: + +- open on the same line as the declaration +- close on their own line at the same indentation level as the beginning of the + declaration. +- opening brace should be proceeded by a single space. + +`Good` + +```solidity +contract Coin { + struct Bank { + address owner; + uint balance; + } +} +``` + +`Bad` + +```solidity +contract Coin +{ + struct Bank { + address owner; + uint balance; + } +} +``` + +The same recommendations apply to the control structures `if`, `else`, `while`, +and `for`. + +Additionally there should be a single space between the control structures +`if`, `while`, and `for` and the parenthetic block representing the +conditional, as well as a single space between the conditional parenthetic +block and the opening brace. + +`Good` + +```solidity +if (...) { + ... +} + +for (...) { + ... +} +``` + +`Bad` + +```solidity +if (...) +{ + ... +} + +while(...){ +} + +for (...) { + ...;} +``` + +Above rules apply for control structures whose body contains a single statement + +`Good` + +```solidity +if (x < 10) { + x += 1; +} +``` + +`Bad` + +```solidity +if (x < 10) + x += 1; +``` + +For `if` blocks which have an `else` or `else if` clause, the `else` should be +placed on the same line as the `if`'s closing brace. This is an exception compared +to the rules of other block-like structures. + +`Good` + +```solidity +if (x < 3) { + x += 1; +} else if (x > 7) { + x -= 1; +} else { + x = 5; +} + + +if (x < 3) + x += 1; +else + x -= 1; +``` + +`Bad` + +```solidity +if (x < 3) { + x += 1; +} +else { + x -= 1; +} +``` + +### Function Declarations + +For short function declarations, it is recommended to keep arguments on the same line +with opening brace of the function body ([Maximum Line Length](#maximum-line-length) +rule should be kept). + +The closing brace should be at the same indentation level as the function +declaration. + +The opening brace should be preceded by a single space. + +`Good` + +```solidity +function increment(uint x) public pure returns (uint) { + return x + 1; +} + +function increment(uint x) public pure onlyowner returns (uint) { + return x + 1; +} +``` + +`Bad` + +```solidity +function increment(uint x) public pure returns (uint) +{ + return x + 1; +} + +function increment(uint x) public pure returns (uint){ + return x + 1; +} + +function increment(uint x) public pure returns (uint) { + return x + 1; + } + +function increment(uint x) public pure returns (uint) { + return x + 1;} +``` + +For long function declarations, it is recommended to drop each argument onto +it's own line at the same indentation level as the function body. The closing +parenthesis and opening bracket should be placed on their own line as well at +the same indentation level as the function declaration. + +`Good` + +```solidity +function thisFunctionHasLotsOfArguments( + address a, + address b, + address c, + address d, + address e, + address f +) + public +{ + doSomething(); +} +``` + +`Bad` + +```solidity +function thisFunctionHasLotsOfArguments(address a, address b, address c, + address d, address e, address f) public { + doSomething(); +} + +function thisFunctionHasLotsOfArguments(address a, + address b, + address c, + address d, + address e, + address f) public { + doSomething(); +} + +function thisFunctionHasLotsOfArguments( + address a, + address b, + address c, + address d, + address e, + address f) public { + doSomething(); +} +``` + +If a long function declaration has modifiers, then each modifier should be +dropped to its own line. + +`Good` + +```solidity +function thisFunctionNameIsReallyLong(address x, address y, address z) + public + onlyowner + priced + returns (address) +{ + doSomething(); +} + +function thisFunctionNameIsReallyLong( + address x, + address y, + address z, +) + public + onlyowner + priced + returns (address) +{ + doSomething(); +} +``` + +`Bad` + +```solidity +function thisFunctionNameIsReallyLong(address x, address y, address z) + public + onlyowner + priced + returns (address) { + doSomething(); +} + +function thisFunctionNameIsReallyLong(address x, address y, address z) + public onlyowner priced returns (address) +{ + doSomething(); +} + +function thisFunctionNameIsReallyLong(address x, address y, address z) + public + onlyowner + priced + returns (address) { + doSomething(); +} +``` + +Multi-line output parameters and return statements should follow the same style +recommended for wrapping long lines found in the [Maximum Line Length](#maximum_line_length) section. + +`Good` + +```solidity +function thisFunctionNameIsReallyLong( + address a, + address b, + address c +) + public + returns ( + address someAddressName, + uint256 LongArgument, + uint256 Argument + ) +{ + doSomething() + + return ( + veryLongReturnArg1, + veryLongReturnArg2, + veryLongReturnArg3 + ); +} +``` + +`Bad` + +```solidity +function thisFunctionNameIsReallyLong( + address a, + address b, + address c +) + public + returns (address someAddressName, + uint256 LongArgument, + uint256 Argument) +{ + doSomething() + + return (veryLongReturnArg1, + veryLongReturnArg1, + veryLongReturnArg1); +} +``` + +For constructor functions on inherited contracts whose bases require arguments, +it is recommended to drop the base constructors onto new lines in the same +manner as modifiers if the function declaration is long or hard to read. + +`Good` + +```solidity +contract A is B, C, D { + constructor(uint param1, uint param2, uint param3, uint param4, uint param5) + B(param1) + C(param2, param3) + D(param4) + public + { + // do something with param5 + } +} +``` + +`Bad` + +```solidity +contract A is B, C, D { + constructor(uint param1, uint param2, uint param3, uint param4, uint param5) + B(param1) + C(param2, param3) + D(param4) + public + { + // do something with param5 + } +} + +contract A is B, C, D { + constructor(uint param1, uint param2, uint param3, uint param4, uint param5) + B(param1) + C(param2, param3) + D(param4) + public { + // do something with param5 + } +} +``` + +When declaring short functions with a single statement, it is permissible to do it on a single line. + +`Permissible` + +```solidity +function shortFunction() public { doSomething(); } +``` + +You should explicitly label the visibility of all functions, including constructors. + +`Good` + +```solidity +function explicitlyPublic(uint val) public { + doSomething(); +} +``` + +`Bad` + +```solidity +function implicitlyPublic(uint val) { + doSomething(); +} +``` + +The visibility modifier for a function should come before any custom +modifiers. + +`Good` + +```solidity +function kill() public onlyowner { + selfdestruct(owner); +} +``` + +`Bad` + +```solidity +function kill() onlyowner public { + selfdestruct(owner); +} +``` + +### Variable Declarations + +Declarations of array variables should not have a space between the type and +the brackets. + +`Good` + +```solidity +uint[] x; +``` + +`Bad` + +```solidity +uint [] x; +``` + +### Other Recommendations + +Strings should be quoted with double-quotes instead of single-quotes. + +`Good` + +```solidity +str = "foo"; +str = "Hamlet says, 'To be or not to be...'"; +``` + +`Bad` + +```solidity +str = 'bar'; +str = '"Be yourself; everyone else is already taken." -Oscar Wilde'; +``` + +Surround operators with a single space on either side. + +`Good` + +```solidity +x = 3; +x = 100 / 10; +x += 3 + 4; +x |= y && z; +``` + +`Bad` + +```solidity +x=3; +x = 100/10; +x += 3+4; +x |= y&&z; +``` + +## Naming Conventions + +Naming conventions are powerful when adopted and used broadly. The use of +different conventions can convey significant *meta* information that would +otherwise not be immediately available. + +The naming recommendations given here are intended to improve the readability, +and thus they are not strict rules, but rather guidelines to try and help convey the +most information through the names of things. + +Lastly, consistency within a codebase should always supersede any conventions +outlined in this document. + +### Naming Styles + +To avoid confusion, the following names will be used to refer to different +naming styles. + +- `b` (single lowercase letter) +- `B` (single uppercase letter) +- `lowercase` +- `lower_case_with_underscores` +- `UPPERCASE` +- `UPPER_CASE_WITH_UNDERSCORES` +- `CapitalizedWords` (or CapWords) +- `mixedCase` (differs from CapitalizedWords by initial lowercase character!) +- `Capitalized_Words_With_Underscores` + + `NOTE:` When using initialism in CapWords, capitalize all the letters of the + initialism. Thus HTTPServerError is better than HttpServerError. + When using initialism is mixedCase, capitalize all the letters of the + initialism, except keep the first one lower case if it is the + beginning of the name. Thus xmlHTTPRequest is better than XMLHTTPRequest. + +### Names to Avoid + +- `l` - Lowercase letter el +- `O` - Uppercase letter oh +- `I` - Uppercase letter eye + +Never use any of these for single letter variable names. They are often +indistinguishable from the numerals one and zero. + +### Contract and Library Names + +Contracts and libraries should be named using the CapWords style. + +`Example` + + SimpleToken, MerklePatriciaProof, OpenSTValueInterface + +Libraries' names should not include `Lib` prefix/postfix. + +`Good` + + SafeMath, UpradableProxy + +`Bad` + + SafeMathLib, LibUpgradableProxy + +### Struct Names + +Structs should be named using the CapWords style. + +`Example` + + MyCoin, Position + +### Event Names + +Events should be named using the CapWords style. + +`Example` + + Deposit, Transfer, Approval, BeforeTransfer, AfterTransfer + +### Function Names + +Functions should use mixedCase. + +`Example` + + getBalance, transfer, verifyOwner, addMember, changeOwner + +### Function Argument Names + +Function arguments should use mixedCase and start with underscore. + +`Example` + + _initialSupply, _account, _recipientAddress + +```solidity +function requestStake( + uint256 _amount, + address _beneficiary +) + external + returns (bool) +{ + ... +} +``` + +When writing library functions that operate on a custom struct, the struct +should be the first argument and should always be named `self`. + +### Function Return Parameter Names + +Function named return parameters should use mixedCase and end with underscore. + +`Example` + + winningProposal_, winnerName_ + +```solidity +function winningProposal() + public + view + returns (uint winningProposal_) +{ + uint winningVoteCount = 0; + for (uint p = 0; p < proposals.length; p++) { + if (proposals[p].voteCount > winningVoteCount) { + winningVoteCount = proposals[p].voteCount; + winningProposal_ = p; + } + } +} +``` + +### Local and State Variable Names + +Both variable types follow mixedCase naming style. + +`Example` + + totalSupply, remainingSupply, balancesOf, creatorAddress, isPreSale, tokenExchangeRate + +### Constants + +Constants should be named with all capital letters with underscores separating +words. + +`Example` + + MAX_BLOCKS, TOKEN_NAME, TOKEN_TICKER, CONTRACT_VERSION + +### Modifier Names + +Use mixedCase. + +`Example` + + onlyBy, onlyAfter, onlyDuringThePreSale + +### Enums + +Enums, in the style of simple type declarations, should be named using the +CapWords style. + +`Example` + + TokenGroup, Frame, HashStyle, CharacterLocation + +### Avoiding Naming Collisions + +`single_trailing_underscore_` + +This convention is suggested when the desired name collides with that of a +built-in or otherwise reserved name. + +## Best Practices + +### Variable Initialization + +Variables should be always initialized. + +`Example` + +```solidity +function spam() internal { + ... + uint256 index = 0; + bool isEmpty = false; + ... +} +``` + +### Casting + +For non primitive types we do not rely on implicit casting and specify +constructor call explicitly. + +`Good` + +```solidity +function spam(address a, bytes32 b, uint i) internal { + ... + require(a != address(0)); + require(b != bytes32(0)); + require(i != 0); + ... +} +``` + +`Bad` + +```solidity +function spam(address a, bytes32 b) internal { + ... + require(a != 0); + require(b != 0); + ... +} +``` + +### Require and Assert + +Use `assert(condition, message)` if you never ever want the condition to be `false`, not in any circumstance +(apart from a bug in your code). It checks for invariants in code. + +Use `require(condition, message)` if condition can be `false`, due to e.g. invalid input, +contract state variables are not met, a failing external component. + +Specifying *message* parameter for `require` is mandatory. +For `assert` use your best judgement. + +### Function Returns + +Solidity allows named return parameters. + +`Example` + +```solidity +function winningProposal() + public + view + returns (uint winningProposal_) +{ + uint winningVoteCount = 0; + for (uint p = 0; p < proposals.length; p++) { + if (proposals[p].voteCount > winningVoteCount) { + winningVoteCount = proposals[p].voteCount; + winningProposal_ = p; + } + } +} +``` + +We encourage to use named return parameters in all cases except the obvious ones, like: + +`Example` + +```solidity +function winnerName() + public + view + returns (bytes32 winnerName_) +{ + winnerName_ = proposals[winningProposal()].name; +} +``` + +In above example, one could use unnamed return parameter: + +```solidity +function winnerName() + public + view + returns (bytes32) +{ + return proposals[winningProposal()].name; +} +``` + +`NOTE` Multiple return parameters should be always named one. + +Only **empty** `return` statements are allowed from functions with named return parameters. +This should be only used for early returns. Otherwise, no `return` statement. + +## Documentation + +Solidity contracts, functions, enums, etc documentation follows +[Ethereum Natural Specification](https://github.com/ethereum/wiki/wiki/Ethereum-Natural-Specification-Format) format. + +Documentation is inserted above the object following the doxygen notation of a +multi-line comment starting with `/**` and ending with `*/`. + +Documentation starting with `///` style should be avoided. + +Avoid using `@author` documentation tag. + +### Single Line + +Single line documentation format is: + +`Good` + +```solidity +/** @notice Returns storage root at the specified block height. */ +function getStorageRoot(uint256 _blockHeight) + public + view + returns (bytes32 /* storage root */) +{ + ... +} + +/** Bounty amount to take from facilitator on accepting stake. */ +uint256 public bounty; +``` + +`Bad` + +```solidity +/** + * @notice Returns storage root at the specified block height. + */ +function getStorageRoot(uint256 _blockHeight) + public + view + returns (bytes32 /* storage root */) +{ + ... +} + +/** + * Bounty amount to take from facilitator on accepting stake. + */ +uint256 public bounty; +``` + +### Multi Line + +Multi line documentation format is: + +`Example` + +```solidity +/** + * @notice Returns storage root at the specified block height. + * + * @param _blockHeight Block height to return storage root. + * + * @return bytes32(0) if a storage root for specified block height was not + * verified otherwise saved storage root. + */ +function getStorageRoot(uint256 _blockHeight) + public + view + returns (bytes32) +{ + ... +} +``` + +### Structs and Mappings + +Document structs above the struct declaration. +Document struct fields above the respective field. + +`Good` + +```solidity +/** A Bank has a single owner. You need to create one bank per person. */ +struct Bank { + /** The owner of the bank functions simultaniously as the owner of the funds in balance. */ + address owner; + + /** The balance of the owner in Ethereum Wei. */ + uint256 balance; +} + +/** + * Message stores the message content as well as additional data about the + * sender and the receiver. This way, it can be verified that the message has + * not been manipulated. + */ +struct Message { + /** + * The message content bytes encoded. + * The string encoding must be UTF-8. + */ + bytes32 message; + + /** Address where the message should be sent to. */ + address receiver; + + /** Address of the account that created this message. */ + address sender; + + /** + * The signature is created by the sender and is the signed hash of the + * message: sha3(message, receiver, sender). + */ + bytes32 signature; +} +``` + +`Bad` + +```solidity +/** A Bank has a single owner. You need to create one bank per person. */ +struct Bank { + address owner; /** The owner of the bank functions simultaniously as the owner of the funds in balance. */ + uint256 balance; // The balance of the owner in Ethereum Wei. +} +``` + +Document mappings above the mappings' respective declaration. + +`Good` + +```solidity +/** balances stores per address the total balance in SimpleToken Wei. */ +mapping (address => uint) public balances; +``` + +`Bad` + +```solidity +mapping (address => uint) public balances; /** balances stores per address the total balance in SimpleToken Wei. */ +mapping (address => uint) public balances; // balances stores per address the total balance in SimpleToken Wei. +``` + +### Spaces + +Put a single space after and before documentation tag. + +`Good` + +```solidity +/** + * @notice Get the token balance for account _tokenOwner. + * + * @param _tokenOwner Token owner address to retrieve the balance. + */ +function balanceOf(address _tokenOwner) public constant returns (uint) { + return balances[_tokenOwner]; +} +``` + +`Bad` + +```solidity +/** + * @notice Get the token balance for account _tokenOwner. + * + * @param tokenOwner Token owner address to retrieve the balance. + */ +function balanceOf(address _tokenOwner) public constant returns (uint balance) { + return balances[_tokenOwner]; +} +``` + +### English Sentence + +All documentations starts with capital letter and end with `'.'` (dot). + +`Good` + +```solidity +/** + * @notice Returns storage root at the specified block height. + * + * @param _blockHeight Block height to return storage root. + * + * @return bytes32(0) if a storage root for specified block height was not + * verified otherwise saved storage root. + */ +function getStorageRoot(uint256 _blockHeight) + public + view + returns (bytes32) +{ + ... +} +``` + +`Bad` + +```solidity +/** + * @notice returns storage root at the specified block height. + * + * @param _blockHeight Block height to return storage root + * + * @return bytes32(0) If a storage root for specified block height was not + * verified otherwise saved storage root. + */ +function getStorageRoot(uint256 _blockHeight) + public + view + returns (bytes32) +{ + ... +} +``` + +### Grouping + +No new line between the same documentation tags: + +`Good` + +```solidity +/** + * @notice Commit new state root for a specified block height. + * + * @param _blockHeight Block height for which stateRoots mapping needs to update. + * @param _stateRoot State root of input block height. + * + * @return bool true in case of success, otherwise throws an exception. + */ +function commitStateRoot(uint256 _blockHeight, bytes32 _stateRoot) + external + onlyWorker + returns(bool); +``` + +`Bad` + +```solidity +/** + * @notice Commit new state root for a specified block height. + * + * @param _blockHeight Block height for which stateRoots mapping needs to update. + * + * @param _stateRoot State root of input block height. + * + * @return bool true in case of success, otherwise throws an exception. + */ +function commitStateRoot(uint256 _blockHeight, bytes32 _stateRoot) + external + onlyWorker + returns(bool); +``` + +Put a single blank line between documentation tags (tag groups). + +`Good` + +```solidity +/** + * @notice Commit new state root for a specified block height. + * + * @param _blockHeight Block height for which stateRoots mapping needs to update. + * @param _stateRoot State root of input block height. + * + * @return bool true in case of success, otherwise throws an exception. + */ +function commitStateRoot(uint256 _blockHeight, bytes32 _stateRoot) + external + onlyWorker + returns(bool); +``` + +`Bad` + +```solidity +/** + * @notice Commit new state root for a specified block height. + * @param _blockHeight Block height for which stateRoots mapping needs to update. + * @param _stateRoot State root of input block height. + * + * @return bool true in case of success, otherwise throws an exception. + */ +function commitStateRoot(uint256 _blockHeight, bytes32 _stateRoot) + external + onlyWorker + returns(bool); +``` + +### Alignment + +Align `@param` and `@return` tags' documentations including parameter name and +named return param name. + +`Good` + +```solidity +/** + * @dev Allow _spender to withdraw from your account, multiple times, up to the + * _value amount. If this function is called again it overwrites the current + * allowance with _value. + * + * @param _spender Address to approve + * to withdraw. + * @param _value Amount to approve for + * withdrawal. + * + * @return success_ True in case of success, otherwise + * throws an exception. + */ +function approve(address _spender, uint256 _value) returns (bool success_); +``` + +`Bad` + +```solidity +/** + * @dev Allow _spender to withdraw from your account, multiple times, up to the + * _value amount. If this function is called again it overwrites the current + * allowance with _value. + * + * @param _spender Address to approve + * to withdraw. + * @param _value Amount to approve for + * withdrawal. + * + * @return success_ True in case of success, otherwise + * throws an exception. + */ +function approve(address _spender, uint256 _value) returns (bool success_); +``` + +Align documentation within same tag (not group). + +`Good` + +```solidity +/** + * @dev Allow _spender to withdraw from your account, multiple times, up to the + * _value amount. If this function is called again it overwrites the current + * allowance with _value. + * + * @param _spender Address to approve to withdraw. + * @param _value Amount to approve for withdrawal. + * + * @return success_ True in case of success, otherwise throws an exception. + */ +function approve(address _spender, uint256 _value) returns (bool success_); +``` + +`Bad` + +```solidity +/** + * @dev Allow _spender to withdraw from your account, multiple times, up to the + * _value amount. If this function is called again it overwrites the current + * allowance with _value. + * + * @param _spender Address to approve to withdraw. + * @param _value Amount to approve for withdrawal. + * + * @return True in case of success, otherwise throws an exception. + */ +function approve(address _spender, uint256 _value) returns (bool success); + +/** + * @dev Allow _spender to withdraw from your account, multiple times, up to the + * _value amount. If this function is called again it overwrites the current + * allowance with _value. + * + * @param _spender Address to approve to withdraw. + * @param _value Amount to approve for withdrawal. + * + * @return bool true in case of success, otherwise throws an exception. + */ +function approve(address _spender, uint256 _value) returns (bool success); +``` + +### Multiple Return Parameters + +Use the following format for multiple return parameter documentation. + +`Example` + +```solidity +/** + * Calculates sum and production. + * + * @param _a First input to calculate sum and production. + * @param _b Second input to calculate sum and production. + * + * @return sum_ Sum of the input arguments. + * @return product_ Product of the input arguments. + * It's really product of the input arguments. + */ +function arithmetics(uint _a, uint _b) + public + pure + returns (uint sum_, uint product_) +{ + sum_ = _a + _b; + product_ = _a * _b; +} +``` + +`NOTE` The order of documenting the return parameters should be the same as a return order. + +`NOTE` No blank line between documentation of individual input parameters. + +`NOTE` Return parameter alignment should be the same as for function arguments. + +### Sections + +Please, separate documentation into the following sections: + +```solidity +/* Usings */ +/* Events */ +/* Constants */ +/* Enums */ +/* Structs */ +/* Storage */ +/* Modifiers */ +/* Special Functions */ +/* External Functions */ +/* Public Functions */ +/* Internal Functions */ +/* Private Functions */ +``` + +Order in each section is going to be kept according to +[Order of Declarations](#order-of-declarations). + +## Comments + +It's recommended to use for code commenting the `//`. + +Comments should start with capital letter and end with `'.'` (dot) as an +ordinary English sentence. + +Put a single space after `//` in comments. + +`NOTE:` + + Commenting happens only inside functions. + +`Good` + +```solidity +/** + * @dev Bounty amount is transferred to msg.sender if msg.sender is + * not a whitelisted worker. Otherwise it is transferred to workers contract. + * + * @return bool true in case of success, otherwise throws an exception. + */ +function processStaking( + bytes32 _stakingIntentHash, + bytes32 _unlockSecret +) + external + returns (bool) +{ + ... + + // Checks if the stake request exists. + require(stakeRequest.beneficiary != address(0)); + + // Checks if the stake request was accepted. + require(stakeRequest.hashLock != bytes32(0)); + + ... +} +``` + +`Bad` + +```solidity +/** + * @dev Bounty amount is transferred to msg.sender if msg.sender is + * not a whitelisted worker. Otherwise it is transferred to workers contract. + * + * @return bool true in case of success, otherwise throws an exception. + */ +function processStaking( + bytes32 _stakingIntentHash, + bytes32 _unlockSecret +) + external + returns (bool) +{ + ... + + // checks if the stake request exists + require(stakeRequest.beneficiary != address(0)); + + /* Require _stakingIntentHash to be non-zero. */ + require(_stakingIntentHash != bytes32(0)); + + /* + * Checks if the stake request was accepted. + */ + require(stakeRequest.hashLock != bytes32(0)); + + ... +} +``` diff --git a/VERSION b/VERSION index 337a6a8..afaf360 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.8 \ No newline at end of file +1.0.0 \ No newline at end of file diff --git a/app/models/airdrop.js b/app/models/airdrop.js deleted file mode 100644 index e645186..0000000 --- a/app/models/airdrop.js +++ /dev/null @@ -1,83 +0,0 @@ -"use strict"; -/** - * - * This is a model file which would be used for executing all methods related to airdrop model.

- * - * @module app/models/airdrop - * - */ -const rootPrefix = '../..' - , coreConstants = require(rootPrefix + '/config/core_constants') - , QueryDBKlass = require(rootPrefix + '/app/models/queryDb') - , ModelBaseKlass = require(rootPrefix + '/app/models/base') -; - -const dbName = coreConstants.MYSQL_DATABASE - , QueryDBObj = new QueryDBKlass(dbName) -; - -/** - * Constructor for class airdrop - * - * @constructor - * @augments ModelBaseKlass - * - */ -const AirdropKlass = function () { - ModelBaseKlass.call(this, {dbName: dbName}); -}; - -AirdropKlass.prototype = Object.create(ModelBaseKlass.prototype); - -const AirdropKlassPrototype = { - - /** - * Query DB Object - * - * @return {object} - * - */ - QueryDB: QueryDBObj, - - /** - * Table name - * - * @constant {string} - * - */ - tableName: 'airdrops', - - /** - * Select all airdrop contracts - * - * @return {Promise} - * - */ - getAll: function() { - const oThis = this - ; - - return oThis.select().fire(); - }, - - /** - * get airdrop AR by contract Address - * - * @param {Hex} airdropContractAddress - airdrop contract address - * - * @return {Promise} - * - */ - getByContractAddress: function (airdropContractAddress) { - const oThis = this - ; - - return oThis.select().where(["contract_address=?", airdropContractAddress]). - limit(1).fire(); - } - -}; - -Object.assign(AirdropKlass.prototype, AirdropKlassPrototype); - -module.exports = AirdropKlass; \ No newline at end of file diff --git a/app/models/airdrop_allocation_proof_detail.js b/app/models/airdrop_allocation_proof_detail.js deleted file mode 100644 index 5bd4f2a..0000000 --- a/app/models/airdrop_allocation_proof_detail.js +++ /dev/null @@ -1,115 +0,0 @@ -"use strict"; -/** - * - * This is a model file which would be used querying airdrop_allocation_proof_details model.

- * - * @module app/models/airdrop_allocation_proof_detail - * - */ -const rootPrefix = '../..' - , coreConstants = require(rootPrefix + '/config/core_constants') - , QueryDBKlass = require(rootPrefix + '/app/models/queryDb') - , ModelBaseKlass = require(rootPrefix + '/app/models/base') - , responseHelper = require(rootPrefix + '/lib/formatter/response') - , logger = require(rootPrefix + '/helpers/custom_console_logger') - , paramErrorConfig = require(rootPrefix + '/config/param_error_config') - , apiErrorConfig = require(rootPrefix + '/config/api_error_config') -; - -const errorConfig = { - param_error_config: paramErrorConfig, - api_error_config: apiErrorConfig -}; - -const dbName = coreConstants.MYSQL_DATABASE - , QueryDBObj = new QueryDBKlass(dbName) -; - -const AirdropAllocationProofDetailKlass = function () { - ModelBaseKlass.call(this, {dbName: dbName}); -}; - -AirdropAllocationProofDetailKlass.prototype = Object.create(ModelBaseKlass.prototype); - -const AirdropAllocationProofDetailKlassPrototype = { - - QueryDB: QueryDBObj, - - tableName: 'airdrop_allocation_proof_details', - - /** - * get data by transaction hash - * - * @param {Hex} transactionHash - airdrop transfer transaction hash - * - * @return {Promise} - * - */ - getByTransactionHash: function (transactionHash) { - var oThis = this; - return oThis.select().where(["transaction_hash=?", transactionHash]).fire(); - }, - - /** - * Create Table record during transfer airdrop amount to airdropBudgetHolder - * - * @param {Hex} transactionHash - airdrop transfer transaction hash - * @param {string} airdropAmount - airdropAmount in Wei - * @param {String} airdropAllocatedAmount - airdropAllocatedAmount in Wei - * - * @return {Promise} - * - */ - createRecord: async function(transactionHash, airdropAmount, airdropAllocatedAmount=0) { - var oThis = this; - try { - const insertedRecord = await oThis.create({ - transaction_hash: transactionHash, - airdrop_amount: airdropAmount, - airdrop_allocated_amount: airdropAllocatedAmount - }); - return responseHelper.successWithData({response: insertedRecord}); - } catch(err){ - let errorParams = { - internal_error_identifier: 'l_aapd_cr_1', - api_error_identifier: 'entry_creation_failed', - error_config: errorConfig, - debug_options: { err: err } - }; - return responseHelper.error(errorParams); - } - - }, - - /** - * Update Allocated Amount - * - * @param {Integer} id - table id - * @param {string} allocatedAmount - allocatedAmount in Wei - * - * @return {Promise} - * - */ - updateAllocatedAmount: async function(id, allocatedAmount){ - const oThis = this - ; - - try { - await oThis.update({airdrop_allocated_amount: allocatedAmount}).where(["id=?", id]).fire(); - return responseHelper.successWithData({}); - } catch(err){ - let errorParams = { - internal_error_identifier: 'l_a_m_aapd_1', - api_error_identifier: 'entry_updation_failed', - error_config: errorConfig, - debug_options: { err: err } - }; - return responseHelper.error(errorParams); - } - }, - -}; - -Object.assign(AirdropAllocationProofDetailKlass.prototype, AirdropAllocationProofDetailKlassPrototype); - -module.exports = AirdropAllocationProofDetailKlass; \ No newline at end of file diff --git a/app/models/base.js b/app/models/base.js deleted file mode 100644 index da54f06..0000000 --- a/app/models/base.js +++ /dev/null @@ -1,162 +0,0 @@ -"use strict"; - -const rootPrefix = '../..' - , utils = require(rootPrefix + '/lib/utils') - , MysqlQueryKlass = require(rootPrefix + '/lib/query_builders/mysql') - , mysqlWrapper = require(rootPrefix + "/lib/mysql_wrapper") - , logger = require(rootPrefix + '/helpers/custom_console_logger') -; - -const ModelBaseKlass = function (params) { - var oThis = this; - - oThis.dbName = params.dbName; - MysqlQueryKlass.call(this, params); -}; - -ModelBaseKlass.prototype = Object.create(MysqlQueryKlass.prototype); - -const ModelBaseKlassPrototype = { - - // get read connection - onReadConnection: function() { - return mysqlWrapper.getPoolFor(this.dbName, 'master'); - }, - - // get read connection - onWriteConnection: function() { - return mysqlWrapper.getPoolFor(this.dbName, 'master'); - }, - - enums: {}, - - convertEnumForDB: function (params, readable) { - var oThis = this - , enumKeys = Object.keys(oThis.enums); - - for (var i = 0; i < enumKeys.length; i++) { - var enum_k = enumKeys[i]; - - if (params[enum_k]) { - params[enum_k] = readable ? oThis.enums[enum_k]['val'][params[enum_k]] : oThis.enums[enum_k]['inverted'][params[enum_k]]; - } - } - return params; - }, - - convertEnumForResult: function (params) { - return this.convertEnumForDB(params, true); - }, - - fire: function () { - var oThis = this; - - return new Promise( - function (onResolve, onReject) { - - const queryGenerator = oThis.generate(); - if(queryGenerator.isSuccess()){ - //logger.debug(queryGenerator.data.query, queryGenerator.data.queryData); - } - - var pre_query = Date.now(); - var qry = oThis.onWriteConnection().query(queryGenerator.data.query, queryGenerator.data.queryData, function (err, result, fields) { - logger.debug("(", (Date.now() - pre_query), "ms)", qry.sql); - if (err) { - onReject(err); - } else { - onResolve(result); - } - }); - } - ); - - }, - - create: function (params) { - - var oThis = this - , createFields = [] - , setFieldsValues = [] - ; - - params = oThis.convertEnumForDB(params); - - for (var key in params) { - if(key=='id' || key=='updated_at' || key=='created_at') continue; - createFields.push(key); - setFieldsValues.push(params[key]) - } - - return oThis.QueryDB.insert( - oThis.tableName, - createFields, - setFieldsValues - ); - - }, - - bulkInsert: function (createFields, setFieldsValues) { - - var oThis = this - , addingCreatedAt = false - , addingUpdatedAt = false - , currentDateTime = utils.formatDbDate(new Date()) - ; - - if(createFields.indexOf('created_at') < 0){ - createFields.push('created_at'); - addingCreatedAt = true; - } - if(createFields.indexOf('updated_at') < 0){ - createFields.push('updated_at'); - addingUpdatedAt = true; - } - - for (var i in setFieldsValues) { - if(addingCreatedAt) setFieldsValues[i].push(currentDateTime); - if(addingUpdatedAt) setFieldsValues[i].push(currentDateTime) - } - - return oThis.QueryDB.bulkInsert( - oThis.tableName, - createFields, - setFieldsValues - ); - - }, - - edit: function (params) { - var oThis = this - , editFields = [] - , setFieldsValues = [] - , whereCondFields = [] - , whereCondFieldsValues = [] - ; - - params['qParams'] = oThis.convertEnumForDB(params['qParams']); - for (var key in params['qParams']) { - if(key=='id' || key=='updated_at' || key=='created_at') continue; - editFields.push(key + '=?'); - setFieldsValues.push(params['qParams'][key]) - } - - for (var key in params['whereCondition']) { - whereCondFields.push(key + '=?'); - whereCondFieldsValues.push(params['whereCondition'][key]); - } - - return oThis.QueryDB.edit( - oThis.tableName, - editFields, - setFieldsValues, - whereCondFields, - whereCondFieldsValues - ); - } - -}; - -Object.assign(ModelBaseKlass.prototype, ModelBaseKlassPrototype); - -module.exports = ModelBaseKlass; \ No newline at end of file diff --git a/app/models/queryDb.js b/app/models/queryDb.js deleted file mode 100644 index 151a5c0..0000000 --- a/app/models/queryDb.js +++ /dev/null @@ -1,209 +0,0 @@ -"use strict"; - -var rootPrefix = '../..' - , mysqlWrapper = require(rootPrefix + "/lib/mysql_wrapper") - , utils = require(rootPrefix + '/lib/utils') - , logger = require(rootPrefix + '/helpers/custom_console_logger') -; - -const QueryDB = function(dbName){ - - this.dbName = dbName - -}; - -QueryDB.prototype = { - - constructor: QueryDB, - - // get read connection - onReadConnection: function() { - return mysqlWrapper.getPoolFor(this.dbName, 'master'); - }, - - // get read connection - onWriteConnection: function() { - return mysqlWrapper.getPoolFor(this.dbName, 'master'); - }, - - read: function(tableName, fields, whereClause, whereClauseValues, orderByClause, paginationClause) { - var oThis = this - , selectFields = ((!fields || fields.length==0) ? '*' : fields.join(',')) - , selectWhereClause = ((!whereClause || whereClause.length==0) ? '' : ' where '+whereClause) - , whereClauseValues = (!whereClauseValues) ? [] : whereClauseValues - , q = 'SELECT '+selectFields+' FROM '+tableName+' '+selectWhereClause; - - if(options && options.order){ - q = q + ' ORDER BY ' + options.order + ' '; - } - - if(options && options.limit){ - q = q + ' LIMIT ? '; - whereClauseValues.push(options.limit); - } - - if(options && options.offset){ - q = q + ' OFFSET ? '; - whereClauseValues.push(options.offset); - } - - return new Promise( - function (onResolve, onReject) { - // get a timestamp before running the query - var pre_query = Date.now(); - var qry = oThis.onReadConnection().query(q, whereClauseValues, function (err, result, fields) { - logger.debug("(%s ms) %s", (Date.now() - pre_query), qry.sql); - if (err) { - onReject(err); - } else { - onResolve(result); - } - }); - - } - ); - }, - - readByInQuery: function(tableName, fields, ids, columnName) { - var oThis = this - , selectFields = ((!fields || fields.length==0) ? '*' : fields.join(',')) - , q = "SELECT "+selectFields+" FROM "+tableName+" WHERE "+columnName+" IN ('"+ ids.join("','")+"')"; - - return new Promise( - function (onResolve, onReject) { - // get a timestamp before running the query - var pre_query = Date.now(); - var qry = oThis.onReadConnection().query(q, function (err, result, fields) { - logger.debug("(%s ms) %s", (Date.now() - pre_query), qry.sql); - if (err) { - onReject(err); - } else { - onResolve(result); - } - }); - - } - ); - }, - - insert: function(tableName, fields, queryArgs) { - - var oThis = this - , currentDateTime = utils.formatDbDate(new Date()) - , fields = fields.concat(['created_at', 'updated_at']) - , queryArgs = queryArgs.concat([currentDateTime, currentDateTime]) - , q = 'INSERT INTO '+tableName+' ('+fields+') VALUES (?)' - ; - - return new Promise( - function (onResolve, onReject) { - // get a timestamp before running the query - var pre_query = Date.now(); - var qry = oThis.onWriteConnection().query(q, [queryArgs], function (err, result, fields) { - logger.debug("(%s ms) %s", (Date.now() - pre_query), qry.sql); - if (err) { - onReject(err); - } else { - onResolve({ - fieldCount: result.fieldCount, - affectedRows: result.affectedRows, - insertId: result.insertId - }); - } - }); - - } - ); - }, - - bulkInsert: function(tableName, fields, queryArgs, options) { - - var oThis = this - , q = 'INSERT INTO '+tableName+' ('+fields+') VALUES ?' - ; - - return new Promise( - function (onResolve, onReject) { - // get a timestamp before running the query - var pre_query = Date.now(); - var qry = oThis.onWriteConnection().query(q, [queryArgs], function (err, result, fields) { - logger.debug("=======Insert Query======="); - logger.debug("(%s ms) %s", (Date.now() - pre_query), qry.sql); - if (err) { - onReject(err); - } else { - onResolve({ - fieldCount: result.fieldCount, - affectedRows: result.affectedRows, - insertId: result.insertId - }); - } - }); - - } - ); - }, - - edit: function (tableName, fields, fieldValues, whereClause, whereClauseValues) { - var oThis = this - , currentDateTime = utils.formatDbDate(new Date()) - , fieldValues = (!fieldValues) ? [] : fieldValues - , whereClauseValues = (!whereClauseValues) ? [] : whereClauseValues - , queryArgs = fieldValues.concat(whereClauseValues) - ; - - return new Promise( - function (onResolve, onReject) { - if((!fields || fields.length==0) || (!whereClause || whereClause.length==0)){ - return onReject('Both update fields and where condition is mendatory.'); - } - - fields = fields + ', updated_at="'+currentDateTime+'"'; - - // get a timestamp before running the query - var pre_query = Date.now() - , q = 'UPDATE '+tableName+' set '+fields+' where '+whereClause; - - var qry = oThis.onWriteConnection().query(q, queryArgs, function (err, result, fields) { - logger.debug("(%s ms) %s", (Date.now() - pre_query), qry.sql); - if (err) { - onReject(err); - } else { - onResolve(result); - } - }); - - } - ); - }, - - migrate: function(query){ - var oThis = this; - return new Promise( - function (onResolve, onReject) { - if(!query){ - return onReject('Invalid query'); - } - // Only Whitelisted Migration Queries Allowed - var allowed_queries = ['CREATE', 'ALTER', 'create', 'alter']; - var querySubstring = query.substring(0, 6); - if (allowed_queries.indexOf(querySubstring) < 0){ - return onReject('Wrong Migration. Allowed Queries: '+allowed_queries); - } - - var pre_query = Date.now(); - var qry = oThis.onWriteConnection().query(query, [], function (err, result, fields) { - logger.debug("(%s ms) %s", (Date.now() - pre_query), qry.sql); - if (err) { - onReject(err); - } else { - onResolve(result); - } - }); - } - ); - } - -}; - -module.exports = QueryDB; \ No newline at end of file diff --git a/app/models/user_airdrop_detail.js b/app/models/user_airdrop_detail.js deleted file mode 100644 index 912250e..0000000 --- a/app/models/user_airdrop_detail.js +++ /dev/null @@ -1,105 +0,0 @@ -"use strict"; - -const rootPrefix = '../..' - , coreConstants = require(rootPrefix + '/config/core_constants') - , QueryDBKlass = require(rootPrefix + '/app/models/queryDb') - , ModelBaseKlass = require(rootPrefix + '/app/models/base') - , responseHelper = require(rootPrefix + '/lib/formatter/response') - , logger = require(rootPrefix + '/helpers/custom_console_logger') - , BigNumber = require('bignumber.js') - , paramErrorConfig = require(rootPrefix + '/config/param_error_config') - , apiErrorConfig = require(rootPrefix + '/config/api_error_config') -; - -const errorConfig = { - param_error_config: paramErrorConfig, - api_error_config: apiErrorConfig -}; - -const dbName = coreConstants.MYSQL_DATABASE - , QueryDBObj = new QueryDBKlass(dbName) -; - -const UserAirdropDetailKlass = function () { - ModelBaseKlass.call(this, {dbName: dbName}); -}; - -UserAirdropDetailKlass.prototype = Object.create(ModelBaseKlass.prototype); - -const UserAirdropDetailKlassPrototype = { - - QueryDB: QueryDBObj, - - tableName: 'user_airdrop_details', - - /** - * get airdrop total amount and used amount for multiple addresses - * - * @param {Hex} airdropId - airdrop table Id - * @param {Array} userAddresses - user addresses - * - * @return {Promise} - { - * '0x934ebd34b2a4f16d4de16256df36a6013785557d': {totalAirdropAmount: '10000000000000000', totalAirdropUsedAmount: '10000000000000000', balanceAirdropAmount: '10000000000000000'}, - * '0x934ebd34b2a4f16d4de16256df36a6013785557e': {totalAirdropAmount: '20000000000000000', totalAirdropUsedAmount: '20000000000000000', balanceAirdropAmount: '10000000000000000'} - * } - * - */ - getByUserAddresses: async function (airdropId, userAddresses) { - var oThis = this; - logger.debug("========user_airdrop_detail.getByUserAddresses().userAddresses========="); - logger.debug(userAddresses); - return new Promise(async function (onResolve, onReject) { - var result = {} - , userAirdropDetail = {} - ; - - try { - const userAirdropDetailResultArray = await oThis.select( - "user_address, CONVERT(sum(airdrop_amount), char) " + - "as total_airdrop_amount, CONVERT(sum(airdrop_used_amount), char) as total_airdrop_used_amount").where({ - airdrop_id: airdropId, - user_address: userAddresses - }).group_by("user_address").fire(); - - const userAddressesMap = {}; - for (var i in userAddresses) { - userAddressesMap[userAddresses[i].toLowerCase()] = userAddresses[i]; - } - logger.debug("userAddressesMap ", userAddressesMap); - - for (var uadIndex in userAirdropDetailResultArray) { - userAirdropDetail = userAirdropDetailResultArray[uadIndex]; - var totalAirdropAmount = new BigNumber(userAirdropDetail.total_airdrop_amount) - , totalAirdropUsedAmount = new BigNumber(userAirdropDetail.total_airdrop_used_amount) - , balanceAirdropAmount = totalAirdropAmount.minus(totalAirdropUsedAmount) - , userAddressInProperCase = userAddressesMap[userAirdropDetail.user_address.toLowerCase()] - ; - result[userAddressInProperCase] = { - totalAirdropAmount: totalAirdropAmount.toString(10), - totalAirdropUsedAmount: totalAirdropUsedAmount.toString(10), - balanceAirdropAmount: balanceAirdropAmount.toString(10) - }; - } - logger.debug("========user_airdrop_detail.getByUserAddresses().result========="); - logger.debug(result); - return onResolve(responseHelper.successWithData(result)); - } catch (error) { - let errorParams = { - internal_error_identifier: 'a_m_uad_1', - api_error_identifier: 'select_airdrop_users_failed', - error_config: errorConfig, - debug_options: {} - }; - logger.error(error); - return onResolve(responseHelper.error(errorParams)); - } - }); - - }, - - -}; - -Object.assign(UserAirdropDetailKlass.prototype, UserAirdropDetailKlassPrototype); - -module.exports = UserAirdropDetailKlass; \ No newline at end of file diff --git a/config/api_error_config.json b/config/api_error_config.json deleted file mode 100644 index 8e1b5fe..0000000 --- a/config/api_error_config.json +++ /dev/null @@ -1,127 +0,0 @@ -{ - "invalid_api_params": { - "http_code": "400", - "code": "invalid_request", - "message": "At least one parameter is invalid or missing. See err.error_data for more details." - }, - "entry_creation_failed": { - "http_code": "200", - "code": "entry_creation_failed", - "message": "There seems to be an error with entry creation" - }, - "entry_updation_failed": { - "http_code": "200", - "code": "entry_updation_failed", - "message": "There seems to be an error with entry updation" - }, - "select_airdrop_users_failed": { - "http_code": "200", - "code": "select_airdrop_users_failed", - "message": "Technical error in getting airdrop users" - }, - "unhandled_api_error": { - "http_code": "500", - "code": "unhandled_api_error", - "message": "Can't proceed due to unhandled error" - }, - "no_events_in_receipt": { - "http_code": "200", - "code": "no_events_in_receipt", - "message": "No events found in the transaction receipt" - }, - "amount_invalid": { - "http_code": "422", - "code": "amount_invalid", - "message": "One or more of the amounts used are invalid" - }, - "user_address_invalid": { - "http_code": "422", - "code": "user_address_invalid", - "message": "One or more of the amounts used are invalid" - }, - "record_not_found": { - "http_code": "422", - "code": "record_not_found", - "message": "There is no record for processing" - }, - "amount_update_failed": { - "http_code": "500", - "code": "amount_update_failed", - "message": "Could not adjust the amount due to technical failure" - }, - "data_not_found": { - "http_code": "204", - "code": "data_not_found", - "message": "Could not find the data in DB" - }, - "db_get_failed": { - "http_code": "422", - "code": "db_get_failed", - "message": "Technical error in getting the data" - }, - "insufficient_funds": { - "http_code": "422", - "code": "insufficient_funds", - "message": "Can't proceed due to insufficient funds" - }, - "something_went_wrong": { - "http_code": "500", - "code": "something_went_wrong", - "message": "" - }, - "could_not_process": { - "http_code": "422", - "code": "unprocessable_entity", - "message": "Cannot process due to error" - }, - "get_receipt_failed": { - "http_code": "422", - "code": "get_receipt_failed", - "message": "Get receipt failed due to timeout or other error" - }, - "invalid_receipt": { - "http_code": "422", - "code": "invalid_receipt", - "message": "Obtained receipt is invalid" - }, - "contract_address_invalid": { - "http_code": "422", - "code": "invalid_contract_address", - "message": "Contract address is invalid" - }, - "get_balance_failed": { - "http_code": "422", - "code": "get_balance_failed", - "message": "Get balance failed due to timeout or error" - }, - "invalid_amount": { - "http_code": "422", - "code": "invalid_amount", - "message": "Amount is not appropriate for the action" - }, - "invalid_object": { - "http_code": "422", - "code": "invalid_object", - "message": "Object is invalid" - }, - "batch_size_exceeded": { - "http_code": "422", - "code": "airdrop_batch_size_exceeded", - "message": "Airdrop batch size exceeded" - }, - "timestamp_invalid": { - "http_code": "422", - "code": "timestamp_invalid", - "message": "Timestamp is not valid" - }, - "invalid_deployer_passphrase": { - "http_code": "422", - "code": "invalid_deployer_passphrase", - "message": "Deployer passphrase is invalid" - }, - "contract_deploy_failed": { - "http_code": "422", - "code": "contract_deploy_failed", - "message": "Contract deployment failed" - } -} diff --git a/config/autoscaling.js b/config/autoscaling.js deleted file mode 100644 index 141be12..0000000 --- a/config/autoscaling.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; - -const rootPrefix = '..' -; - -// Dynamo DB connection config details -var autoScalingConfig = { - 'apiVersion': process.env.OS_AUTOSCALING_API_VERSION, - 'accessKeyId': process.env.OS_AUTOSCALING_ACCESS_KEY_ID, - 'secretAccessKey': process.env.OS_AUTOSCALING_SECRET_ACCESS_KEY, - 'region': process.env.OS_AUTOSCALING_REGION, - 'endpoint': process.env.OS_AUTOSCALING_ENDPOINT -} - -if (process.env.OS_AUTOSCALING_SSL_ENABLED == 1) { - autoScalingConfig['sslEnabled'] = true; -} else { - autoScalingConfig['sslEnabled'] = false; -} - -if (process.env.OS_AUTOSCALING_LOGGING_ENABLED == 1) { - autoScalingConfig['logger'] = console; -} - -module.exports = autoScalingConfig; diff --git a/config/core_abis.js b/config/core_abis.js deleted file mode 100644 index 75b3f3a..0000000 --- a/config/core_abis.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; - -/* - * Load all contract abi files - * - */ - -const fs = require('fs'), - path = require('path'); - -function parseFile(filePath, options) { - const absFilePath = path.join(__dirname, '/' + filePath); - const fileContent = fs.readFileSync(absFilePath, options || "utf8"); - return JSON.parse(fileContent); -} - -const rootPrefix = ".."; - -const coreAbis = { - pricer: parseFile(rootPrefix + '/contracts/abi/Pricer.abi', "utf8"), - eip20tokenmock: parseFile(rootPrefix + '/contracts/abi/EIP20TokenMock.abi', "utf8"), - opsManaged: parseFile(rootPrefix + '/contracts/abi/OpsManaged.abi', "utf8"), - workers: parseFile(rootPrefix + '/contracts/abi/Workers.abi', "utf8"), - brandedToken: parseFile(rootPrefix + '/contracts/abi/EIP20Token.abi', "utf8"), - airdrop: parseFile(rootPrefix + '/contracts/abi/Airdrop.abi', "utf8") -}; - -module.exports = coreAbis; diff --git a/config/core_addresses.js b/config/core_addresses.js deleted file mode 100644 index 356128a..0000000 --- a/config/core_addresses.js +++ /dev/null @@ -1,112 +0,0 @@ -"use strict"; - -/** - * List of all addresses and there respective abi, bin, passphrase - * required for platform. - * - * And helper methods to access this information using human readable - * names. - * - */ - -const rootPrefix = ".." - , coreAbis = require(rootPrefix + '/config/core_abis') - , coreBins = require(rootPrefix + '/config/core_bins') -; - -const allAddresses = { - users: { - deployer: { - address: process.env.OST_UTILITY_DEPLOYER_ADDR, - passphrase: process.env.OST_UTILITY_DEPLOYER_PASSPHRASE - }, - ops: { - address: process.env.OST_UTILITY_OPS_ADDR, - passphrase: process.env.OST_UTILITY_OPS_PASSPHRASE - } - }, - - contracts: { - pricer: { - abi: coreAbis.pricer, - bin: coreBins.pricer - }, - eip20tokenmock: { - abi: coreAbis.eip20tokenmock, - bin: coreBins.eip20tokenmock - }, - opsManaged: { - abi: coreAbis.opsManaged, - bin: coreBins.opsManaged - }, - workers: { - abi: coreAbis.workers, - bin: coreBins.workers - }, - brandedToken: { - abi: coreAbis.brandedToken, - bin: coreBins.brandedToken - }, - airdrop: { - abi: coreAbis.airdrop, - bin: coreBins.airdrop - } - } -}; - -// generate a contract address to name map for reverse lookup -const addrToContractNameMap = {}; -for (var contractName in allAddresses.contracts) { - var addr = allAddresses.contracts[contractName].address; - - if ( Array.isArray(addr) ) { - for (var i = 0; i < addr.length; i++) { - addrToContractNameMap[addr[i].toLowerCase()] = contractName; - } - } else if ( addr !== null && typeof addr !== "undefined") { - addrToContractNameMap[addr.toLowerCase()] = contractName; - } -} - -// helper methods to access difference addresses and their respective details -const coreAddresses = { - getAddressForUser: function(userName) { - return allAddresses.users[userName].address; - }, - - getPassphraseForUser: function(userName) { - return allAddresses.users[userName].passphrase; - }, - - getAddressForContract: function(contractName) { - var contractAddress = allAddresses.contracts[contractName].address; - if (Array.isArray(contractAddress)) { - throw "Please pass valid contractName to get contract address for: "+contractName; - } - return contractAddress; - }, - - // This must return array of addresses. - getAddressesForContract: function(contractName) { - var contractAddresses = allAddresses.contracts[contractName].address; - if (!contractAddresses || !Array.isArray(contractAddresses) || contractAddresses.length===0) { - throw "Please pass valid contractName to get contract address for: "+contractName; - } - return contractAddresses; - }, - - getContractNameFor: function(contractAddr) { - return addrToContractNameMap[(contractAddr || '').toLowerCase()]; - }, - - getAbiForContract: function(contractName) { - return allAddresses.contracts[contractName].abi; - }, - - getBinForContract: function(contractName) { - return allAddresses.contracts[contractName].bin; - } -}; - -module.exports = coreAddresses; - diff --git a/config/core_bins.js b/config/core_bins.js deleted file mode 100644 index 3ba4201..0000000 --- a/config/core_bins.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; - -/* - * Load all contract bin files - * - */ - -const fs = require('fs'), - path = require('path'); - -function readFile(filePath, options) { - const absFilePath = path.join(__dirname, '/' + filePath); - return fs.readFileSync(absFilePath, options || "utf8"); -} - -const rootPrefix = ".."; - -const coreBins = { - pricer: readFile(rootPrefix + '/contracts/bin/Pricer.bin', 'utf8'), - eip20tokenmock: readFile(rootPrefix + '/contracts/bin/EIP20TokenMock.bin', 'utf8'), - opsManaged: readFile(rootPrefix + '/contracts/bin/OpsManaged.bin', "utf8"), - workers: readFile(rootPrefix + '/contracts/bin/Workers.bin', "utf8"), - brandedToken: readFile(rootPrefix + '/contracts/bin/EIP20Token.bin', "utf8"), - airdrop: readFile(rootPrefix + '/contracts/bin/Airdrop.bin', "utf8") -}; - -module.exports = coreBins; diff --git a/config/core_constants.js b/config/core_constants.js deleted file mode 100644 index 2408c24..0000000 --- a/config/core_constants.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; - -const path = require('path') - , rootPrefix = ".." -; - -/* - * Constants file: Load constants from environment variables - * - */ - -function define(name, value) { - Object.defineProperty(exports, name, { - value: value, - enumerable: true - }); -} -//Cache engine -define('CACHING_ENGINE', process.env.OST_CACHING_ENGINE); - -// Geth -define('OST_UTILITY_GETH_RPC_PROVIDER', process.env.OST_UTILITY_GETH_RPC_PROVIDER); -define('OST_UTILITY_GETH_WS_PROVIDER', process.env.OST_UTILITY_GETH_WS_PROVIDER); - -// MySQL details -define("MYSQL_HOST", process.env.OP_MYSQL_HOST); -define("MYSQL_USER", process.env.OP_MYSQL_USER); -define("MYSQL_PASSWORD", process.env.OP_MYSQL_PASSWORD); -define("MYSQL_DATABASE", process.env.OP_MYSQL_DATABASE); -define("MYSQL_CONNECTION_POOL_SIZE", process.env.OP_MYSQL_CONNECTION_POOL_SIZE); -define("STANDALONE_MODE", process.env.OST_STANDALONE_MODE); - - -//Debug level -define('DEBUG_ENABLED', process.env.OST_DEBUG_ENABLED || false); - -//Environment -define("RUNNING_TESTS_IN", process.env.RUNNING_TESTS_IN); diff --git a/config/dynamoDB.js b/config/dynamoDB.js deleted file mode 100644 index 3a27c08..0000000 --- a/config/dynamoDB.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; - -// Dynamo DB connection config details -const ddbConnectionConfig = { - 'apiVersion': process.env.OS_DYNAMODB_API_VERSION, - 'accessKeyId': process.env.OS_DYNAMODB_ACCESS_KEY_ID, - 'secretAccessKey': process.env.OS_DYNAMODB_SECRET_ACCESS_KEY, - 'region': process.env.OS_DYNAMODB_REGION, - 'endpoint': process.env.OS_DYNAMODB_ENDPOINT -}; - -if (process.env.OS_DYNAMODB_SSL_ENABLED == 1) { - ddbConnectionConfig['sslEnabled'] = true; -} else { - ddbConnectionConfig['sslEnabled'] = false; -} - -if (process.env.OS_DYNAMODB_LOGGING_ENABLED == 1) { - ddbConnectionConfig['logger'] = console; -} - -module.exports = ddbConnectionConfig; diff --git a/config/mysql.js b/config/mysql.js deleted file mode 100644 index 2205b1a..0000000 --- a/config/mysql.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; - -const rootPrefix = '..' - , coreConstants = require(rootPrefix + '/config/core_constants'); - -const mysqlConfig = { - "commonNodeConfig": { - "connectionLimit": coreConstants.MYSQL_CONNECTION_POOL_SIZE, - "charset": "UTF8_UNICODE_CI", - "bigNumberStrings": true, - "supportBigNumbers": true, - "dateStrings": true, - "debug": false - }, - "commonClusterConfig": { - "canRetry": true, - "removeNodeErrorCount": 5, - "restoreNodeTimeout": 10000, - "defaultSelector": "RR" - }, - "clusters": { - "cluster1": { - "master": { - "host": coreConstants.MYSQL_HOST, - "user": coreConstants.MYSQL_USER, - "password": coreConstants.MYSQL_PASSWORD - } - } - }, - "databases":{ - - } -}; -mysqlConfig["databases"][coreConstants.MYSQL_DATABASE] = ["cluster1"]; -module.exports = mysqlConfig; \ No newline at end of file diff --git a/config/param_error_config.json b/config/param_error_config.json deleted file mode 100644 index 60527b5..0000000 --- a/config/param_error_config.json +++ /dev/null @@ -1,130 +0,0 @@ -{ - "gas_price_invalid": { - "name": "gasPrice", - "message": "Gas price is either undefined or invalid" - }, - "chain_id_invalid": { - "name": "chainId", - "message": "Chain id is either undefined or invalid" - }, - "negative_airdrop_amount": { - "name": "airdropAmountUsed", - "message": "Negative airdrop amount is invalid" - }, - "invalid_user_address": { - "name": "userAddress", - "message": "Invalid user address" - }, - "invalid_sender_address": { - "name": "senderAddress", - "message": "Invalid sender address" - }, - "invalid_spender_address": { - "name": "spenderAddress", - "message": "Invalid spender address" - }, - "negative_transfer_amount": { - "name": "transferAmount", - "message": "Negative transfer amount is invalid" - }, - "zero_transfer_amount": { - "name": "transferAmount", - "message": "Zero transfer amount is invalid" - }, - "invalid_commission_amount": { - "name": "commissionAmount", - "message": "Commission amount is negative or a float" - }, - "beneficiary_address_invalid": { - "name": "beneficiaryAddress", - "message": "Beneficiary address is not valid" - }, - "commission_beneficiary_address_invalid": { - "name": "commissionBeneficiaryAddress", - "message": "Commission beneficiary address is not valid" - }, - "invalid_currency": { - "name": "currency", - "message": "Currency is invalid" - }, - "price_point_invalid": { - "name": "intendedPricePoint", - "message": "Price point invalid for given currency" - }, - "branded_token_address_invalid": { - "name": "contractAddress", - "message": "Branded token address is invalid" - }, - "airdrop_budget_holder_invalid": { - "name": "airdropBudgetHolder", - "message": "Airdrop budget holder address invalid" - }, - "total_amount_invalid": { - "name": "totalAmount", - "message": "Total amount cannot be negative or floating" - }, - "airdrop_amount_invalid": { - "name": "airdropAmountToUse", - "message": "Airdrop amount cannot be negative or floating" - }, - "accepted_margin_invalid": { - "name": "acceptedMargin", - "message": "Accepted margin is negative or invalid" - }, - "invalid_transaction_hash": { - "name": "transactionHash", - "message": "Transaction hash is invalid" - }, - "invalid_worker_address": { - "name": "workerAddress", - "message": "Worker address is invalid" - }, - "airdrop_contract_address_invalid": { - "name": "airdrop_contract_address", - "message": "Airdrop contract address is invalid" - }, - "airdrop_contract_already_registered": { - "name": "airdrop_contract_address", - "message": "Airdrop contract is already registered" - }, - "invalid_amount": { - "name": "amount", - "message": "Amount is invalid" - }, - "invalid_decoded_events": { - "name": "decodedEvents", - "message": "decoded events are invalid" - }, - "price_oracle_address_invalid": { - "name": "priceOracleContractAddress", - "message": "Price oracle contract address is invalid" - }, - "invalid_options": { - "name": "options", - "message": "options for txHash/txReceipt are invalid" - }, - "base_currency_invalid": { - "name": "baseCurrency", - "message": "Base currency is invalid" - }, - "contract_name_invalid": { - "name": "contractName", - "message": "contract name is invalid" - }, - "gas_limit_invalid": { - "name": "gasLimit", - "message": "Gas limit is invalid" - }, - "deployer_invalid": { - "name": "deployerAddress", - "message": "Deployer address is invalid" - }, - "invalid_contract_address": { - "name": "contractAddress", - "message": "Invalid contract address" - }, - "deactivation_height_invalid": { - "name": "deactivationHeight", - "message": "Deactivation height is invalid" - } -} diff --git a/contracts/Airdrop.sol b/contracts/Airdrop.sol deleted file mode 100644 index 8a6bc03..0000000 --- a/contracts/Airdrop.sol +++ /dev/null @@ -1,168 +0,0 @@ -/* solhint-disable-next-line compiler-fixed */ -pragma solidity ^0.4.23; - -// Copyright 2018 OpenST Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ---------------------------------------------------------------------------- -// Utility chain: Airdrop -// -// http://www.simpletoken.org/ -// -// ---------------------------------------------------------------------------- - -import "./Workers.sol"; -import "./Pricer.sol"; - - -contract Airdrop is Pricer { - - /* - * Events - */ - /// Emit AirdropPayment Event - event AirdropPayment( - address indexed _beneficiary, - uint256 _tokenAmount, - address indexed _commissionBeneficiary, - uint256 _commissionTokenAmount, - bytes3 _currency, - uint256 _actualPricePoint, - address indexed _spender, - uint256 _airdropUsed - ); - - /* - * Storage - */ - Workers public workers; - address public airdropBudgetHolder; - - /* - * Constructor - */ - /// @dev Takes _brandedToken, _baseCurrency, _workers, _airdropBudgetHolder; - /// constructor; - /// public method; - /// @param _brandedToken Branded Token - /// @param _baseCurrency Base Currency - /// @param _workers Workers contract address - /// @param _airdropBudgetHolder Airdrop Budget Holder Address - constructor( - address _brandedToken, - bytes3 _baseCurrency, - Workers _workers, - address _airdropBudgetHolder) - public - Pricer(_brandedToken, _baseCurrency) - { - require(_workers != address(0)); - require(_airdropBudgetHolder != address(0)); - - workers = _workers; - airdropBudgetHolder = _airdropBudgetHolder; - } - - /* - * External functions - */ - /// payAirdrop matches the behaviour of Pricer:pay with extra functionality of airdrop evaluation - /// @param _beneficiary beneficiary - /// @param _transferAmount transferAmount - /// @param _commissionBeneficiary commissionBeneficiary - /// @param _commissionAmount commissionAmount - /// @param _currency currency - /// @param _intendedPricePoint intendedPricePoint - /// @param _spender spender - /// @param _airdropAmount airdropAmount - /// @return uint256 totalPaid, uint256 airdropUsed - function payAirdrop( - address _beneficiary, - uint256 _transferAmount, - address _commissionBeneficiary, - uint256 _commissionAmount, - bytes3 _currency, - uint256 _intendedPricePoint, - address _spender, - uint256 _airdropAmount) - public - returns ( - uint256, /* totalPaid */ - uint256 /* airdropUsed */) - { - require(workers.isWorker(msg.sender)); - require(_spender != address(0)); - - require(isValidBeneficiaryData(_beneficiary, _transferAmount, - _commissionBeneficiary, _commissionAmount)); - - uint256 tokenAmount = _transferAmount; - uint256 commissionTokenAmount = _commissionAmount; - uint256 pricePoint = _intendedPricePoint; - - // check Margin And Calculate BTAmount - if (_currency != "") { - (pricePoint, tokenAmount, commissionTokenAmount) = validateMarginAndCalculateBTAmount(_currency, - _intendedPricePoint, _transferAmount, _commissionAmount); - } - - uint256 airdropUsed = performAirdropTransferToSpender(_spender, _airdropAmount, - tokenAmount, commissionTokenAmount); - require(performTransfers(_spender, _beneficiary, tokenAmount, - _commissionBeneficiary, commissionTokenAmount)); - - /// Emit AirdropPayment Event - emit AirdropPayment(_beneficiary, tokenAmount, _commissionBeneficiary, - commissionTokenAmount, _currency, pricePoint, _spender, airdropUsed); - - return ((tokenAmount + commissionTokenAmount), airdropUsed); - } - - /* - * Private functions - */ - /// @dev Takes _spender, _airdropAmount, _tokenAmount, _commissionTokenAmount; - /// Calculate airdropUsed to transfer - /// Perform perform Airdrop Transfer To Spender - /// internal method; - /// @param _spender spenderUser - /// @param _airdropAmount airdropAmount - /// @param _tokenAmount tokenAmount - /// @param _commissionTokenAmount commissionTokenAmount - /// @return uint256 airdropUsed - function performAirdropTransferToSpender( - address _spender, - uint256 _airdropAmount, - uint256 _tokenAmount, - uint256 _commissionTokenAmount) - private - returns ( - uint256 airdropUsed /* airdrop used */) - { - uint256 totalPaid = (_tokenAmount + _commissionTokenAmount); - // Find out minimum of totalPaid and _airdropAmount - airdropUsed = _airdropAmount; - if (totalPaid < airdropUsed) { - airdropUsed = totalPaid; - } - - // Prefund the user from the airdrop budget holder - if (airdropUsed > 0) { - require(EIP20Interface(brandedToken()).transferFrom(airdropBudgetHolder, _spender, airdropUsed)); - } - - return airdropUsed; - } - -} \ No newline at end of file diff --git a/contracts/EIP20Token.sol b/contracts/EIP20Token.sol new file mode 100644 index 0000000..b23f199 --- /dev/null +++ b/contracts/EIP20Token.sol @@ -0,0 +1,218 @@ +pragma solidity ^0.4.23; + +// Copyright 2018 OpenST Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import "./EIP20TokenInterface.sol"; +import "./SafeMath.sol"; + +/** + * @title EIP20Token contract which implements EIP20Interface. + * + * @notice Implements EIP20 token. + */ +contract EIP20Token is EIP20TokenInterface { + using SafeMath for uint256; + + string private tokenName; + string private tokenSymbol; + uint8 private tokenDecimals; + + mapping(address => uint256) balances; + mapping(address => mapping (address => uint256)) allowed; + + /** + * @notice Contract constructor. + * + * @param _symbol Symbol of the token. + * @param _name Name of the token. + * @param _decimals Decimal places of the token. + */ + constructor(string _symbol, string _name, uint8 _decimals) public + { + tokenSymbol = _symbol; + tokenName = _name; + tokenDecimals = _decimals; + } + + /** + * @notice Public view function name. + * + * @return string Name of the token. + */ + function name() public view returns (string) { + return tokenName; + } + + /** + * @notice Public view function symbol. + * + * @return string Symbol of the token. + */ + function symbol() public view returns (string) { + return tokenSymbol; + } + + /** + * @notice Public view function decimals. + * + * @return uint8 Decimal places of the token. + */ + function decimals() public view returns (uint8) { + return tokenDecimals; + } + + /** + * @notice Public view function balanceOf. + * + * @param _owner Address of the owner account. + * + * @return uint256 Account balance of the owner account. + */ + function balanceOf(address _owner) public view returns (uint256) { + return balances[_owner]; + } + + /** + * @notice Public view function allowance. + * + * @param _owner Address of the owner account. + * @param _spender Address of the spender account. + * + * @return uint256 Remaining allowance for the spender to spend from owner's account. + */ + function allowance(address _owner, address _spender) public view returns (uint256 remaining) { + return allowed[_owner][_spender]; + } + + /** + * @notice Public function transfer. + * + * @dev Fires the transfer event, throws if, _from account does not have enough + * tokens to spend. + * + * @param _to Address to which tokens are transferred. + * @param _value Amount of tokens to be transferred. + * + * @return bool True for a successful transfer, false otherwise. + */ + function transfer(address _to, uint256 _value) public returns (bool success) { + // According to the EIP20 spec, "transfers of 0 values MUST be treated as normal + // transfers and fire the Transfer event". + // Also, should throw if not enough balance. This is taken care of by SafeMath. + balances[msg.sender] = balances[msg.sender].sub(_value); + balances[_to] = balances[_to].add(_value); + + emit Transfer(msg.sender, _to, _value); + + return true; + } + + /** + * @notice Public function transferFrom. + * + * @dev Allows a contract to transfer tokens on behalf of _from address to _to address, + * the function caller has to be pre-authorized for multiple transfers up to the + * total of _value amount by the _from address. + * + * @param _from Address from which tokens are transferred. + * @param _to Address to which tokens are transferred. + * @param _value Amount of tokens transferred. + * + * @return bool True for a successful transfer, false otherwise. + */ + function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { + balances[_from] = balances[_from].sub(_value); + allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); + balances[_to] = balances[_to].add(_value); + + emit Transfer(_from, _to, _value); + + return true; + } + + /** + * @notice Public function approve. + * + * @dev Allows _spender address to withdraw from function caller's account, multiple times up + * to the _value amount, if this function is called again + * it overwrites the current allowance with _value. + * + * @param _spender Address authorized to spend from the function caller's address. + * @param _value Amount up to which spender is authorized to spend. + * + * @return bool True for a successful approval, false otherwise. + */ + function approve(address _spender, uint256 _value) public returns (bool success) { + + allowed[msg.sender][_spender] = _value; + + emit Approval(msg.sender, _spender, _value); + + return true; + } + + /** + * @notice Internal function claimEIP20. + * + * @dev Subtracts _amount of tokens from EIP20Token contract balance, + * adds _amount to beneficiary's balance. + * + * @param _beneficiary Address of tokens beneificary. + * @param _amount Amount of tokens claimed for beneficiary. + * + * @return bool True if claim of tokens for beneficiary address is successful, + * false otherwise. + */ + function claimEIP20(address _beneficiary, uint256 _amount) internal returns (bool success) { + // claimable tokens are minted in the contract address to be pulled on claim + balances[address(this)] = balances[address(this)].sub(_amount); + balances[_beneficiary] = balances[_beneficiary].add(_amount); + + emit Transfer(address(this), _beneficiary, _amount); + + return true; + } + + /** + * @notice Internal function mintEIP20. + * + * @dev Adds _amount tokens to EIP20Token contract balance. + * + * @param _amount Amount of tokens to mint. + * + * @return bool True if mint is successful, false otherwise. + */ + function mintEIP20(uint256 _amount) internal returns (bool /* success */) { + // mint EIP20 tokens in contract address for them to be claimed + balances[address(this)] = balances[address(this)].add(_amount); + + return true; + } + + /** + * @notice Internal function burnEIP20. + * + * @dev Subtracts _amount tokens from the balance of function caller's address. + * + * @param _amount Amount of tokens to burn. + * + * @return bool True if burn is successful, false otherwise. + */ + function burnEIP20(uint256 _amount) internal returns (bool /* success */) { + balances[msg.sender] = balances[msg.sender].sub(_amount); + + return true; + } +} \ No newline at end of file diff --git a/contracts/openst-protocol/EIP20Interface.sol b/contracts/EIP20TokenInterface.sol similarity index 75% rename from contracts/openst-protocol/EIP20Interface.sol rename to contracts/EIP20TokenInterface.sol index d66ba74..75c5479 100644 --- a/contracts/openst-protocol/EIP20Interface.sol +++ b/contracts/EIP20TokenInterface.sol @@ -1,6 +1,6 @@ pragma solidity ^0.4.23; -// Copyright 2017 OpenST Ltd. +// Copyright 2018 OpenST Ltd. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -13,26 +13,24 @@ pragma solidity ^0.4.23; // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// -// ---------------------------------------------------------------------------- -// Common: Standard EIP20 Interface // -// http://www.simpletoken.org/ -// -// ---------------------------------------------------------------------------- -// ---------------------------------------------------------------------------- // Based on the 'final' EIP20 token standard as specified at: // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md -// ---------------------------------------------------------------------------- /** - @title EIP20Interface - @notice Provides EIP20 token interface -*/ -contract EIP20Interface { + * @title EIP20Interface + * + * @notice Provides EIP20 token interface + */ +contract EIP20TokenInterface { + + /** Events */ + event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); + /** Public functions */ + function name() public view returns (string); function symbol() public view returns (string); function decimals() public view returns (uint8); diff --git a/contracts/EIP20TokenMock.sol b/contracts/EIP20TokenMock.sol index 0213e4e..232ba48 100644 --- a/contracts/EIP20TokenMock.sol +++ b/contracts/EIP20TokenMock.sol @@ -14,16 +14,8 @@ pragma solidity ^0.4.23; // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// -// ---------------------------------------------------------------------------- -// Utility chain: EIP20TokenMock -// -// http://www.simpletoken.org/ -// -// ---------------------------------------------------------------------------- - -import "./openst-protocol/EIP20Token.sol"; +import "./EIP20Token.sol"; /// @title EIP20TokenMock - Provides EIP20Token with mock functionality to facilitate testing payments diff --git a/contracts/GlobalConstraintInterface.sol b/contracts/GlobalConstraintInterface.sol new file mode 100644 index 0000000..59c5f82 --- /dev/null +++ b/contracts/GlobalConstraintInterface.sol @@ -0,0 +1,24 @@ +pragma solidity ^0.4.23; + +// Copyright 2018 OpenST Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +interface GlobalConstraintInterface +{ + function check( + address _from, + address[] _transfersTo, + uint256[] _transfersAmount + ) external view returns (bool); +} diff --git a/contracts/MockRule.sol b/contracts/MockRule.sol new file mode 100644 index 0000000..3c41cef --- /dev/null +++ b/contracts/MockRule.sol @@ -0,0 +1,68 @@ +pragma solidity ^0.4.23; + + +// Copyright 2018 OpenST Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +contract MockRule { + + /* Constants */ + + bytes4 constant public FAIL_CALLPREFIX = bytes4( + keccak256("fail(address)") + ); + + bytes4 constant public PASS_CALLPREFIX = bytes4( + keccak256("pass(address)") + ); + + + /* Storage */ + + address public value; + uint256 public receivedPayableAmount; + + + /* Public Functions */ + + function fail( + address _value + ) + public + { + value = _value; + revert("The function should fail by throwing."); + } + + function pass( + address _value + ) + public + { + require(_value != address(0), "Value is null."); + value = _value; + } + + function passPayable( + address _value + ) + public + payable + { + require(_value != address(0), "Value is null."); + value = _value; + receivedPayableAmount = msg.value; + } +} diff --git a/contracts/MultiSigWallet.sol b/contracts/MultiSigWallet.sol new file mode 100644 index 0000000..687ed0f --- /dev/null +++ b/contracts/MultiSigWallet.sol @@ -0,0 +1,658 @@ +pragma solidity ^0.4.23; + +// Copyright 2018 OpenST Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import "./SafeMath.sol"; + + +/** + * @title Allows multiple parties to agree on transactions before execution. + * + * @dev The contract implementation is heavily inspired by Gnosis MultiSigWallet + * (https://github.com/gnosis/MultiSigWallet). + */ +contract MultiSigWallet { + + /* Usings */ + + using SafeMath for uint256; + + + /* Events */ + + event WalletAdditionSubmitted( + uint256 indexed _transactionID, + address _wallet + ); + + event WalletRemovalSubmitted( + uint256 indexed _transactionID, + address _wallet + ); + + event RequirementChangeSubmitted( + uint256 indexed _transactionID, + uint256 _required + ); + + event WalletReplacementSubmitted( + uint256 indexed _transactionID, + address _oldWallet, + address _newWallet + ); + + event TransactionConfirmed(uint256 indexed _transactionID, address _wallet); + + event TransactionConfirmationRevoked( + uint256 indexed _transactionID, + address _wallet + ); + + event TransactionExecutionSucceeded(uint256 indexed _transactionID); + + event TransactionExecutionFailed(uint256 indexed _transactionID); + + + /* Constants */ + + bytes4 constant public ADD_WALLET_CALLPREFIX = bytes4( + keccak256("addWallet(address)") + ); + + bytes4 constant public REMOVE_WALLET_CALLPREFIX = bytes4( + keccak256("removeWallet(address)") + ); + + bytes4 constant public REPLACE_WALLET_CALLPREFIX = bytes4( + keccak256("replaceWallet(address,address)") + ); + + bytes4 constant public CHANGE_REQUIREMENT_CALLPREFIX = bytes4( + keccak256("changeRequirement(uint256)") + ); + + + /* Structs */ + + struct Transaction { + address destination; + bytes data; + bool executed; + } + + + /* Storage */ + + /** + * Specifies the number of confirmations required for a proposed + * transaction to be executed. + */ + uint256 public required; + + /** Direct lookup to check existence of a wallet. */ + mapping (address => bool) public isWallet; + + address[] public wallets; + + /** Mapping from transaction ids to transaction confirmations status. */ + mapping (uint256 => mapping (address => bool)) public confirmations; + + /** Mapping from transaction ids to transactions. */ + mapping (uint256 => Transaction) public transactions; + + /** Submitted transaction count. */ + uint256 public transactionCount; + + + /* Modifiers */ + + /** + * Checks that: + * - Number of confirmations (requirement) is less than or + * equal to the wallet numbers. + * - Requirement is not 0. + * - Wallet count is not 0. + */ + modifier validRequirement(uint256 _walletCount, uint256 _required) + { + require( + _required <= _walletCount && + _required != uint256(0) && + _walletCount != uint256(0), + "Requirement validity not fulfilled." + ); + _; + } + + modifier onlyMultisig() + { + require( + msg.sender == address(this), + "Only multisig is allowed to call." + ); + _; + } + + modifier onlyWallet() + { + require( + isWallet[msg.sender], + "Only wallet is allowed to call." + ); + _; + } + + modifier walletExists(address _wallet) + { + require( + isWallet[_wallet], + "Wallet does not exist." + ); + _; + } + + modifier walletDoesNotExist(address _wallet) + { + require( + !isWallet[_wallet], + "Wallet exists." + ); + _; + } + + modifier transactionExists(uint256 _transactionID) + { + require( + transactions[_transactionID].data.length != 0, + "Transaction does not exist." + ); + _; + } + + modifier transactionIsConfirmedBy(uint256 _transactionID, address _wallet) + { + require( + confirmations[_transactionID][_wallet], + "Transaction is not confirmed by the wallet." + ); + _; + } + + modifier transactionIsNotConfirmedBy( + uint256 _transactionID, + address _wallet + ) + { + require( + !confirmations[_transactionID][_wallet], + "Transaction is confirmed by the wallet." + ); + _; + } + + modifier transactionIsNotExecuted(uint256 _transactionID) + { + require( + !transactions[_transactionID].executed, + "Transaction is executed." + ); + _; + } + + /** + * Modifier is used as a replacement to require call as this check + * should be done before calling other modifiers like validRequirement. + */ + modifier walletIsNotNull(address _address) + { + require( + _address != address(0), + "Wallet address is null." + ); + _; + } + + + /* Special Functions */ + + /** + * @dev Contract constructor sets initial wallets and required number of + * confirmations. + * Requires: + * - Requirement validity held. + * - No wallet address is null. + * - No duplicate wallet address in list. + * + * @param _wallets List of initial wallets. + * @param _required Number of required confirmations. + */ + constructor(address[] _wallets, uint256 _required) + public + validRequirement(_wallets.length, _required) + { + for (uint256 i = 0; i < _wallets.length; i++) { + require(_wallets[i] != address(0), "Wallet address is 0."); + require(!isWallet[_wallets[i]], "Duplicate wallet address."); + isWallet[_wallets[i]] = true; + } + + wallets = _wallets; + required = _required; + } + + + /* External Functions */ + + /** + * @notice Submits a transaction for wallet addition. + * + * @dev Function requires: + * - Only registered wallet can call. + * - Wallet to add is not null. + * - Wallet to add does not exist. + * - Requirement validity held. + * + * @return Newly created transaction id. + */ + function submitAddWallet(address _wallet) + external + onlyWallet + walletIsNotNull(_wallet) + walletDoesNotExist(_wallet) + validRequirement(wallets.length.add(1), required) + returns (uint256 transactionID_) + { + transactionID_ = addTransaction( + address(this), + abi.encodeWithSelector(ADD_WALLET_CALLPREFIX, _wallet) + ); + + emit WalletAdditionSubmitted(transactionID_, _wallet); + + confirmTransaction(transactionID_); + } + + /** + * @notice Submits a transaction for wallet removal. + * + * @dev Updates the requirement by setting equal to the registered wallets + * number if after wallet removal the requirement is bigger then + * the wallet number. + * Function requires: + * - Only registered wallet can call. + * - Wallet to remove exists. + * + * @return Newly created transaction id. + */ + function submitRemoveWallet(address _wallet) + external + onlyWallet + walletExists(_wallet) + returns (uint256 transactionID_) + { + require( + wallets.length > 1, + "Last wallet cannot be submitted for removal." + ); + + transactionID_ = addTransaction( + address(this), + abi.encodeWithSelector(REMOVE_WALLET_CALLPREFIX, _wallet) + ); + + emit WalletRemovalSubmitted(transactionID_, _wallet); + + confirmTransaction(transactionID_); + } + + /** + * @notice Submits a transaction for a wallet replacement. + * + * @dev Function requires: + * - Only registered wallet can call. + * - Old wallet exists. + * - New wallet address is not null. + * - New wallet does not exist. + * + * @param _oldWallet Wallet to remove. + * @param _newWallet Wallet to add. + * + * @return Newly created transaction id. + */ + function submitReplaceWallet(address _oldWallet, address _newWallet) + external + onlyWallet + walletExists(_oldWallet) + walletIsNotNull(_newWallet) + walletDoesNotExist(_newWallet) + returns (uint256 transactionID_) + { + transactionID_ = addTransaction( + address(this), + abi.encodeWithSelector( + REPLACE_WALLET_CALLPREFIX, + _oldWallet, + _newWallet + ) + ); + + emit WalletReplacementSubmitted(transactionID_, _oldWallet, _newWallet); + + confirmTransaction(transactionID_); + } + + /** + * @notice Submits a transaction for changing the requirement. + * + * @dev Function requires: + * - Only registered wallet can call. + * - Requirement validity held. + * + * @param _required The number of required confirmations. + * + * @return Newly created transaction id. + */ + function submitRequirementChange(uint256 _required) + external + onlyWallet + validRequirement(wallets.length, _required) + returns (uint256 transactionID_) + { + transactionID_ = addTransaction( + address(this), + abi.encodeWithSelector(CHANGE_REQUIREMENT_CALLPREFIX, _required) + ); + + emit RequirementChangeSubmitted(transactionID_, _required); + + confirmTransaction(transactionID_); + } + + + /* Public Functions */ + + /** + * @notice Confirms the transaction by the caller. + * + * @dev After confirmation by the caller, function asks to execute + * transaction. If required number of confirmations were done + * execution happens. + * Function requires: + * - Only registered wallet can call. + * - Transaction exists. + * - Transaction was not confirmed by the caller. + */ + function confirmTransaction(uint256 _transactionID) + public + onlyWallet + transactionExists(_transactionID) + transactionIsNotConfirmedBy(_transactionID, msg.sender) + { + confirmations[_transactionID][msg.sender] = true; + + emit TransactionConfirmed(_transactionID, msg.sender); + + executeTransaction(_transactionID); + } + + /** + * @notice Revokes confirmation made previously by the caller wallet. + * + * @dev Function requires: + * - Only registered wallet can call. + * - Transaction to revoke exists. + * - Transaction was confirmed previously be the caller. + * - Transaction was not executed. + * + * @param _transactionID Transaction id to revoke the previous confirmation. + */ + function revokeConfirmation(uint256 _transactionID) + public + onlyWallet + transactionExists(_transactionID) + transactionIsConfirmedBy(_transactionID, msg.sender) + transactionIsNotExecuted(_transactionID) + { + confirmations[_transactionID][msg.sender] = false; + + emit TransactionConfirmationRevoked(_transactionID, msg.sender); + } + + /** + * @dev Executes transaction if it is confirmed. + * + * Marks stored transaction object's 'executed' field false if + * transaction failed otherwise true. + * Registered wallet could execute failed transaction again. + * + * Function requires: + * - Only registered wallet can call. + * - Transaction exists. + * - Transaction is confirmed by the caller wallet. + * - Transaction is not executed. + * + * @param _transactionID Transaction ID to execute. + */ + function executeTransaction(uint256 _transactionID) + public + onlyWallet + transactionExists(_transactionID) + transactionIsConfirmedBy(_transactionID, msg.sender) + transactionIsNotExecuted(_transactionID) + { + if (isTransactionConfirmed(_transactionID)) { + Transaction storage t = transactions[_transactionID]; + // solium-disable-next-line security/no-low-level-calls + if (t.destination.call(t.data)) { + t.executed = true; + emit TransactionExecutionSucceeded(_transactionID); + } else { + t.executed = false; + emit TransactionExecutionFailed(_transactionID); + } + } + } + + /** @notice Returns the number of registered wallets. */ + function walletCount() + public + view + returns(uint256) + { + return wallets.length; + } + + /** + * @notice Adds a new wallet. + * + * @dev Validity of requirement is going to be called in all + * functions that alter either wallets count or required confirmations + * count. This needs to make sure that imporant invariant always + * holds. + * Function requires: + * - Wallet address to add is not null. + * - Wallet to add does not exist. + * - Transaction is sent by multisig. + * - Requirement validity held. + * + * @param _wallet Wallet address to add. + */ + function addWallet(address _wallet) + public + onlyMultisig + walletIsNotNull(_wallet) + walletDoesNotExist(_wallet) + validRequirement(wallets.length.add(1), required) + { + isWallet[_wallet] = true; + wallets.push(_wallet); + } + + /** + * @notice Remove the specified wallet. + * + * @dev Function requires: + * - Transaction is sent by multisig. + * - Wallet address to remove exists. + * + * @param _wallet Wallet address to remove. + */ + function removeWallet(address _wallet) + public + onlyMultisig + walletExists(_wallet) + { + delete isWallet[_wallet]; + + for (uint256 i = 0; i < wallets.length - 1; i++) { + if (wallets[i] == _wallet) { + wallets[i] = wallets[wallets.length - 1]; + break; + } + } + wallets.length = wallets.length.sub(1); + if (required > wallets.length) { + changeRequirement(wallets.length); + } + } + + /** + * @notice Replace the wallet with a new one. + * + * @dev Function requires: + * - Only multisig can call. + * - Wallet to remove exists. + * - Wallet to add is not null. + * - Wallet to add does not exist. + * + * @param _oldWallet Wallet to remove. + * @param _newWallet Wallet to add. + */ + function replaceWallet(address _oldWallet, address _newWallet) + public + onlyMultisig + walletExists(_oldWallet) + walletIsNotNull(_newWallet) + walletDoesNotExist(_newWallet) + { + for (uint256 i = 0; i < wallets.length; i++) { + if (wallets[i] == _oldWallet) { + wallets[i] = _newWallet; + break; + } + } + isWallet[_oldWallet] = false; + isWallet[_newWallet] = true; + } + + /** + * @notice Changes requirement. + * + * @dev Function requires: + * - Transaction is sent by multisig. + * - Requirement validity held. + * + * @param _required The number of required confirmations. + */ + function changeRequirement( + uint256 _required + ) + public + onlyMultisig + validRequirement(wallets.length, _required) + { + required = _required; + } + + + /* Internal Functions */ + + /** + * @notice Returns the confirmation status of a transaction. + * + * @dev Transaction is confirmed if wallets' count that confirmed + * the transaction is bigger or equal to required. + * Function checks confirmation condition based on current set of + * registered wallets. + * Function returns true if transaction was executed despite if + * with current set of registered wallets it might not. + * Function requires: + * - Transaction with the specified id exists. + * + * @param _transactionID Transaction id to check. + * + * @return Returns true if the transaction is executed or confirmation is + * achieved with current set of registered wallets, otherwise false. + */ + function isTransactionConfirmed(uint256 _transactionID) + public + view + transactionExists(_transactionID) + returns (bool) + { + if (transactions[_transactionID].executed) { + return true; + } + + uint256 count = 0; + for (uint256 i = 0; i < wallets.length; i++) { + if (confirmations[_transactionID][wallets[i]]) { + count += 1; + } + if (count == required) { + return true; + } + } + + return false; + } + + /** + * @dev Adds a new transaction into transactions mapping. + * Function requires: + * - Destination address is not null. + * - Data payload is not empty. + * + * + * @param _destination Transaction destination address to execute against. + * @param _data Transaction data payload. + * + * @return transactionID_ Returns newly created transaction id. + */ + function addTransaction(address _destination, bytes _data) + internal + returns (uint256 transactionID_) + { + require( + _destination != address(0), + "Destination address is null." + ); + require( + _data.length != 0, + "Payload data length is 0." + ); + + transactionID_ = transactionCount; + + transactions[transactionID_] = Transaction({ + destination: _destination, + data: _data, + executed: false + }); + + transactionCount = transactionCount.add(1); + } + +} \ No newline at end of file diff --git a/contracts/OpsManaged.sol b/contracts/OpsManaged.sol deleted file mode 100644 index 46c9d5b..0000000 --- a/contracts/OpsManaged.sol +++ /dev/null @@ -1,112 +0,0 @@ -pragma solidity ^0.4.23; - -// Copyright 2017 OpenST Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ---------------------------------------------------------------------------- -// Common: Admin / Ops Permission Model -// -// http://www.simpletoken.org/ -// -// ---------------------------------------------------------------------------- - -import "./Owned.sol"; - -/** - @title OpsManaged - @notice Implements OpenST ownership and permission model -*/ -contract OpsManaged is Owned { - - address public opsAddress; - address public adminAddress; - - event AdminAddressChanged(address indexed _newAddress); - event OpsAddressChanged(address indexed _newAddress); - - - constructor() public - Owned() - { - } - - - modifier onlyAdmin() { - require(isAdmin(msg.sender)); - _; - } - - - modifier onlyAdminOrOps() { - require(isAdmin(msg.sender) || isOps(msg.sender)); - _; - } - - - modifier onlyOwnerOrAdmin() { - require(isOwner(msg.sender) || isAdmin(msg.sender)); - _; - } - - - modifier onlyOps() { - require(isOps(msg.sender)); - _; - } - - - function isAdmin(address _address) internal view returns (bool) { - return (adminAddress != address(0) && _address == adminAddress); - } - - - function isOps(address _address) internal view returns (bool) { - return (opsAddress != address(0) && _address == opsAddress); - } - - - function isOwnerOrOps(address _address) internal view returns (bool) { - return (isOwner(_address) || isOps(_address)); - } - - - // Owner and Admin can change the admin address. Address can also be set to 0 to 'disable' it. - function setAdminAddress(address _adminAddress) external onlyOwnerOrAdmin returns (bool) { - require(_adminAddress != owner); - require(_adminAddress != address(this)); - require(!isOps(_adminAddress)); - - adminAddress = _adminAddress; - - emit AdminAddressChanged(_adminAddress); - - return true; - } - - - // Owner and Admin can change the operations address. Address can also be set to 0 to 'disable' it. - function setOpsAddress(address _opsAddress) external onlyOwnerOrAdmin returns (bool) { - require(_opsAddress != owner); - require(_opsAddress != address(this)); - require(!isAdmin(_opsAddress)); - - opsAddress = _opsAddress; - - emit OpsAddressChanged(_opsAddress); - - return true; - } -} - - diff --git a/contracts/Owned.sol b/contracts/Owned.sol deleted file mode 100644 index 9d2899d..0000000 --- a/contracts/Owned.sol +++ /dev/null @@ -1,74 +0,0 @@ -pragma solidity ^0.4.23; - -// Copyright 2017 OpenST Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ---------------------------------------------------------------------------- -// Common: Basic Ownership Implementation -// -// http://www.simpletoken.org/ -// -// ---------------------------------------------------------------------------- - -/** - @title Owned - @notice Implements basic ownership with 2-step transfers -*/ -contract Owned { - - address public owner; - address public proposedOwner; - - event OwnershipTransferInitiated(address indexed _proposedOwner); - event OwnershipTransferCompleted(address indexed _newOwner); - - - constructor() public { - owner = msg.sender; - } - - - modifier onlyOwner() { - require(isOwner(msg.sender)); - _; - } - - - function isOwner(address _address) internal view returns (bool) { - return (_address == owner); - } - - - function initiateOwnershipTransfer(address _proposedOwner) public onlyOwner returns (bool) { - proposedOwner = _proposedOwner; - - emit OwnershipTransferInitiated(_proposedOwner); - - return true; - } - - - function completeOwnershipTransfer() public returns (bool) { - require(msg.sender == proposedOwner); - - owner = proposedOwner; - proposedOwner = address(0); - - emit OwnershipTransferCompleted(owner); - - return true; - } -} - - diff --git a/contracts/PriceOracleInterface.sol b/contracts/PriceOracleInterface.sol deleted file mode 100644 index c6f640a..0000000 --- a/contracts/PriceOracleInterface.sol +++ /dev/null @@ -1,89 +0,0 @@ -/* solhint-disable-next-line compiler-fixed */ -pragma solidity ^0.4.23; - -// Copyright 2018 OpenST Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ---------------------------------------------------------------------------- -// Utility Chain: PriceOracleInterface -// -// http://www.simpletoken.org/ -// -// -------------------------- - -/// @title PriceOracleInterface - Interface of PriceOracle contract -contract PriceOracleInterface { - - /* - * Events - */ - /// @dev event emitted whenever price is updated - /// @return _price - /// @return _expirationHeight - event PriceUpdated(uint256 indexed _price, - uint256 indexed _expirationHeight); - - /* - * Functions - */ - /// @dev Price is stored as fixed point integer value similar as wei unit. - /// Use this variable in case decimal value need to be evaluated - /// @return token decimals - function decimals() - public - view - returns( - uint8); - - /// @dev use this function to get price validity duration - /// @return price validity duration - function priceValidityDuration() - public - view - returns( - uint256); - - /// @dev block height at which the price expires - /// @return expirationHeight - function expirationHeight() - public - view - returns( - uint256); - - /// @dev get baseCurrency bytes3 code - /// @return baseCurrency - function baseCurrency() - public - view - returns( - bytes3); - - /// @dev returns quoteCurrency bytes3 code - /// @return quoteCurrency - function quoteCurrency() - public - view - returns( - bytes3); - - /// @dev use this function to get price - /// @return quoteCurrency/baseCurrency value - function getPrice() - public - view - returns( - uint256); - -} \ No newline at end of file diff --git a/contracts/PriceOracleMock.sol b/contracts/PriceOracleMock.sol deleted file mode 100644 index cf91077..0000000 --- a/contracts/PriceOracleMock.sol +++ /dev/null @@ -1,128 +0,0 @@ -/* solhint-disable-next-line compiler-fixed */ -pragma solidity ^0.4.23; - -// Copyright 2018 OpenST Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ---------------------------------------------------------------------------- -// Utility Chain: PriceOracleMock -// -// http://www.simpletoken.org/ -// -// -------------------------- - -import "./PriceOracleInterface.sol"; - - -/// @title PriceOracleMock - Basic implementation of the PriceOracleInterface to aid testing Pricer -contract PriceOracleMock is PriceOracleInterface { - - /* - * Constants - */ - /// Use this variable in case decimal value need to be evaluated - uint8 private constant TOKEN_DECIMALS = 18; - - /* - * Storage - */ - /// Private variable price - uint256 private price; - bytes3 private oracleBaseCurrency; - bytes3 private oracleQuoteCurrency; - - /* - * Public functions - */ - /// @dev constructor function - /// @param _baseCurrency baseCurrency - /// @param _quoteCurrency quoteCurrency - constructor( - bytes3 _baseCurrency, - bytes3 _quoteCurrency, - uint256 _price - ) - public - { - // Initialize quote currency - oracleQuoteCurrency = _quoteCurrency; - // Initialize base currency - oracleBaseCurrency = _baseCurrency; - price = _price; - } - - /// @dev gets price - /// @return price - function getPrice() - public - view - returns ( - uint256 /* price */ ) - { - return price; - } - - /// @dev use this function to get token decimals value - /// @return TOKEN_DECIMALS - function decimals() - public - view - returns( - uint8 /* token decimals */) - { - return TOKEN_DECIMALS; - } - - /// @dev returns 0 - function priceValidityDuration() - public - view - returns( - uint256) - { - return 0; - } - - /// @dev returns 0 - function expirationHeight() - public - view - returns( - uint256) - { - return 0; - } - - /// @dev get baseCurrency bytes3 code - /// @return baseCurrency - function baseCurrency() - public - view - returns( - bytes3 /* oracleBaseCurrency */) - { - return oracleBaseCurrency; - } - - /// @dev returns quoteCurrency bytes3 code - /// @return quoteCurrency - function quoteCurrency() - public - view - returns( - bytes3 /* oracleQuoteCurrency */) - { - return oracleQuoteCurrency; - } -} diff --git a/contracts/Pricer.sol b/contracts/Pricer.sol deleted file mode 100644 index 4253a54..0000000 --- a/contracts/Pricer.sol +++ /dev/null @@ -1,463 +0,0 @@ -/* solhint-disable-next-line compiler-fixed */ -pragma solidity ^0.4.23; - -// Copyright 2018 OpenST Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ---------------------------------------------------------------------------- -// Utility chain: Pricer -// -// http://www.simpletoken.org/ -// -// ---------------------------------------------------------------------------- - - -import "./openst-protocol/EIP20Interface.sol"; -import "./openst-protocol/UtilityTokenInterface.sol"; -import "./PriceOracleInterface.sol"; -import "./OpsManaged.sol"; -import "./SafeMath.sol"; -import "./PricerInterface.sol"; - - -contract Pricer is OpsManaged, PricerInterface { - using SafeMath for uint256; - - /* - * Storage - */ - ///BrandedToken address - address private pricerBrandedToken; - - ///currency to accepted margin mapping, absolute +/- range in currency in which the price point will be accepted - mapping(bytes3 /* currency */ => uint256 /* margin */) private pricerAcceptedMargins; - - ///currency to price oracles address mapping - mapping(bytes3 /* currency */ => PriceOracleInterface /* price oracle address */) private pricerPriceOracles; - - /// specifies the base currency value e.g. "OST" - bytes3 private pricerBaseCurrency; - - /// Pricer decimal - uint8 private pricerDecimals; - - /// conversionRate - uint256 private pricerConversionRate; - - /// conversionRateDecimals - uint8 private pricerConversionRateDecimals; - - /* - * Public functions - */ - /// @dev Takes _brandedToken, _baseCurrency; - /// constructor; - /// public method; - /// @param _brandedToken Branded Token - /// @param _baseCurrency Base Currency - constructor( - address _brandedToken, - bytes3 _baseCurrency) - public - OpsManaged() - { - require(_brandedToken != address(0)); - require(_baseCurrency != ""); - pricerBrandedToken = _brandedToken; - pricerBaseCurrency = _baseCurrency; - pricerDecimals = EIP20Interface(pricerBrandedToken).decimals(); - pricerConversionRate = UtilityTokenInterface(_brandedToken).conversionRate(); - pricerConversionRateDecimals = UtilityTokenInterface(_brandedToken).conversionRateDecimals(); - } - - /* - * External functions - */ - /// clean up or revoke airdrop contract - function remove() - external - onlyAdminOrOps - { - emit Removed(msg.sender); - selfdestruct(msg.sender); - } - - /// @dev Returns address of the branded token; - /// public method; - /// @return address - function brandedToken() - public - returns (address) - { - return pricerBrandedToken; - } - - /// @dev Takes _currency; - /// returns acceptable margin for the given currency; - /// public method; - /// @param _currency currency - /// @return uint256 margin - function acceptedMargins( - bytes3 _currency) - public - returns (uint256) - { - return pricerAcceptedMargins[_currency]; - } - - /// @dev Takes _currency; - /// returns address of price oracle for the given currency; - /// public method; - /// @param _currency currency - /// @return address - function priceOracles( - bytes3 _currency) - public - returns (address) - { - return pricerPriceOracles[_currency]; - } - - /// @dev Returns address of the base currency; - /// public method; - /// @return bytes3 - function baseCurrency() - public - returns (bytes3) - { - return pricerBaseCurrency; - } - - /// @dev Returns pricer decimal for branded token; - /// public method; - /// @return uint8 - function decimals() - public - returns (uint8) - { - return pricerDecimals; - } - - /// @dev Returns conversion rate for branded token; - /// public method; - /// @return uint256 - function conversionRate() - public - returns (uint256) - { - return pricerConversionRate; - } - - /// @dev Returns conversion rate decimals for branded token; - /// public method; - /// @return uint8 - function conversionRateDecimals() - public - returns (uint8) - { - return pricerConversionRateDecimals; - } - - /// @dev Takes _currency, _oracleAddress; - /// updates the price oracle address for a given currency; - /// emits PriceOracleSet event; - /// only called by ops; - /// public method; - /// @param _currency currency - /// @param _oracleAddress oracleAddress - /// @return bool isSuccess - function setPriceOracle( - bytes3 _currency, - address _oracleAddress) - public - onlyOps - returns (bool /* success */) - { - require(_oracleAddress != address(0)); - require(_currency != ""); - require(PriceOracleInterface(_oracleAddress).baseCurrency() == pricerBaseCurrency); - require(PriceOracleInterface(_oracleAddress).quoteCurrency() == _currency); - require(PriceOracleInterface(_oracleAddress).decimals() == pricerDecimals); - pricerPriceOracles[_currency] = PriceOracleInterface(_oracleAddress); - - //Trigger PriceOracleSet event - emit PriceOracleSet(_currency, _oracleAddress); - return true; - } - - /// @dev Takes _currency; - /// removes the price oracle address for a given currency; - /// emits PriceOracleUnSet event; - /// only called by ops; - /// public method; - /// @param _currency currency - /// @return bool isSuccess - function unsetPriceOracle( - bytes3 _currency) - public - onlyOps - returns (bool /* success */) - { - require(pricerPriceOracles[_currency] != address(0)); - delete pricerPriceOracles[_currency]; - - //Trigger PriceOracleUnset event - emit PriceOracleUnset(_currency); - return true; - } - - /// @dev Takes _currency, _acceptedMargin; - /// updates the acceptable margin range for a given currency; - /// emits AcceptedMargin event; - /// only called by ops; - /// public method; - /// @param _currency currency - /// @param _acceptedMargin acceptedMargin - /// @return bool isSuccess - function setAcceptedMargin( - bytes3 _currency, - uint256 _acceptedMargin) - public - onlyOps - returns (bool /* success */) - { - pricerAcceptedMargins[_currency] = _acceptedMargin; - // Trigger AcceptedMarginSet event - emit AcceptedMarginSet(_currency, _acceptedMargin); - return true; - } - - /// @dev Takes _transferAmount, _commissionAmount, _currency; - /// public view method - /// @param _transferAmount transferAmount - /// @param _commissionAmount commissionAmount - /// @param _currency currency - /// @return (pricePoint, calculatedTransferAmount, calculatedCommissionAmount) - function getPricePointAndCalculatedAmounts( - uint256 _transferAmount, - uint256 _commissionAmount, - bytes3 _currency) - public - view - returns ( - uint256 pricePoint, - uint256 tokenAmount, - uint256 commissionTokenAmount) - { - require(_currency != 0); - pricePoint = getPricePoint(_currency); - require(pricePoint > 0); - (tokenAmount, commissionTokenAmount) = getBTAmountFromCurrencyValue(pricePoint, - _transferAmount, _commissionAmount); - return (pricePoint, tokenAmount, commissionTokenAmount); - } - - /// @dev Takes _beneficiary, _transferAmount, _commissionBeneficiary, _commissionAmount, - /// _currency, _intendedPricePoint;Validates if the currentPrice from price oracle is - /// in accepatble margin of _intendedPricePoint (if _ currency is not 0) - /// if _currency is 0 then it transfer the branded tokens equal to _transferAmount - /// to _beneficiary and branded tokens equal to _commissionAmount to _commissionBeneficiary - /// (floating value transaction); if _currency is not 0 then it transfer the branded tokens - /// equivalant to _transferAmount in currency value to _beneficiary and branded tokens - /// equivalant to _commissionAmount in currency value to _commissionBeneficiary - /// (fixed value transaction); emits payment event; - /// public method - /// @param _beneficiary beneficiary - /// @param _transferAmount transferAmount - /// @param _commissionBeneficiary commissionBeneficiary - /// @param _commissionAmount commissionAmount - /// @param _currency currency - /// @param _intendedPricePoint _intendedPricePoint - /// @return uint256 total paid - function pay( - address _beneficiary, - uint256 _transferAmount, - address _commissionBeneficiary, - uint256 _commissionAmount, - bytes3 _currency, - uint256 _intendedPricePoint) - public - returns (uint256 /* total paid */) - { - require(isValidBeneficiaryData(_beneficiary, _transferAmount, - _commissionBeneficiary, _commissionAmount)); - - uint256 tokenAmount = _transferAmount; - uint256 commissionTokenAmount = _commissionAmount; - uint256 pricePoint = _intendedPricePoint; - - // check Margin And Calculate BTAmount - if (_currency != "") { - (pricePoint, tokenAmount, commissionTokenAmount) = validateMarginAndCalculateBTAmount(_currency, - _intendedPricePoint, _transferAmount, _commissionAmount); - } - - require(performTransfers(msg.sender, _beneficiary, tokenAmount, - _commissionBeneficiary, commissionTokenAmount)); - - //Trigger Event for PaymentComplete - emit Payment(_beneficiary, tokenAmount, _commissionBeneficiary, - commissionTokenAmount, _currency, _intendedPricePoint, pricePoint); - return (tokenAmount + commissionTokenAmount); - } - - /// @dev Takes _currency; - /// gets current price point for the price oracle for the given currency; - /// public method; - /// @param _currency currency - /// @return (pricePoint) - function getPricePoint( - bytes3 _currency) - public - view - returns (uint256) /* pricePoint */ - { - PriceOracleInterface currentPriceOracle = pricerPriceOracles[_currency]; - require(currentPriceOracle != address(0)); - return (currentPriceOracle.getPrice()); - } - - /* - * Internal functions - */ - /// @dev Takes _intendedPricePoint, _currentPricePoint, _acceptedMargin; - /// checks if the current price point is in the acceptable range of intendedPricePoint; - /// internal method; - /// @param _intendedPricePoint intendedPricePoint - /// @param _currentPricePoint currentPricePoint - /// @param _acceptedMargin acceptedMargin - /// @return bool isValid - function isPricePointInRange( - uint256 _intendedPricePoint, - uint256 _currentPricePoint, - uint256 _acceptedMargin) - internal - pure - returns (bool /*isValid*/) - { - bool isValid = true; - if (_intendedPricePoint >= _acceptedMargin) { - isValid = _intendedPricePoint.sub(_acceptedMargin) <= _currentPricePoint; - } - if (isValid) { - isValid = _currentPricePoint <= _intendedPricePoint.add(_acceptedMargin); - } - return isValid; - } - - /// @dev Takes _pricePoint, _transferAmount, _commissionAmount; - /// calculates the number of branded token equivalant to the currency amount; - /// internal method; - /// @param _pricePoint pricePoint - /// @param _transferAmount transferAmount - /// @param _commissionAmount commissionAmount - /// @return (amountBT,commissionAmountBT) - function getBTAmountFromCurrencyValue( - uint256 _pricePoint, - uint256 _transferAmount, - uint256 _commissionAmount) - internal - view - returns (uint256, uint256) /* number of BT ,number of commission BT */ - { - uint256 conversionRatetoBTWei = pricerConversionRate.mul(10**uint256(pricerDecimals)).div(10**uint256(pricerConversionRateDecimals)); - uint256 amountBT = _transferAmount.mul(conversionRatetoBTWei).div(_pricePoint); - uint256 commissionAmountBT = _commissionAmount.mul(conversionRatetoBTWei).div(_pricePoint); - return (amountBT, commissionAmountBT); - } - - /// @dev Takes _beneficiary, _transferAmount, _commissionBeneficiary, _commissionAmount; - /// checks if the current price point is in the acceptable range of intendedPricePoint; - /// internal method; - /// @param _beneficiary beneficiary - /// @param _transferAmount transferAmount - /// @param _commissionBeneficiary commissionBeneficiary - /// @param _commissionAmount commissionAmount - /// @return bool isValid - function isValidBeneficiaryData( - address _beneficiary, - uint256 _transferAmount, - address _commissionBeneficiary, - uint256 _commissionAmount) - internal - returns (bool /*isValid*/) - { - require(_beneficiary != address(0)); - require(_transferAmount != 0); - - if (_commissionAmount > 0) { - require(_commissionBeneficiary != address(0)); - } - return true; - } - - /// @dev Takes _spender, _beneficiary, _tokenAmount, _commissionBeneficiary, _commissionTokenAmount; - /// Perform tokenAmount transfer - /// Perform commissionTokenAmount transfer - /// internal method; - /// @param _spender spender - /// @param _beneficiary beneficiary - /// @param _tokenAmount tokenAmount - /// @param _commissionBeneficiary commissionBeneficiary - /// @param _commissionTokenAmount commissionTokenAmount - /// @return (bool) - function performTransfers( - address _spender, - address _beneficiary, - uint256 _tokenAmount, - address _commissionBeneficiary, - uint256 _commissionTokenAmount) - internal - returns ( - bool /* boolean value */) - { - require(EIP20Interface(pricerBrandedToken).transferFrom(_spender, _beneficiary, _tokenAmount)); - - if (_commissionBeneficiary != address(0)) { - require(EIP20Interface(pricerBrandedToken).transferFrom(_spender, - _commissionBeneficiary, _commissionTokenAmount)); - } - return true; - } - - /// @dev Takes _currency, _intendedPricePoint, _transferAmount, _commissionAmount; - /// Validate accepted margin - /// Calculates tokenAmount and commissionTokenAmount - /// internal method - /// @param _currency currency - /// @param _intendedPricePoint intendedPricePoint - /// @param _transferAmount transferAmount - /// @param _commissionAmount commissionAmount - /// @return (pricePoint, tokenAmount, commissionTokenAmount) - function validateMarginAndCalculateBTAmount( - bytes3 _currency, - uint256 _intendedPricePoint, - uint256 _transferAmount, - uint256 _commissionAmount) - internal - returns (uint256, uint256, uint256) /* pricePoint, tokenAmount, commissionTokenAmount */ - { - uint256 pricePoint = getPricePoint(_currency); - require(pricePoint > 0); - require(isPricePointInRange(_intendedPricePoint, pricePoint, acceptedMargins(_currency))); - - uint256 tokenAmount; - uint256 commissionTokenAmount; - (tokenAmount, commissionTokenAmount) = getBTAmountFromCurrencyValue(pricePoint, _transferAmount, - _commissionAmount); - - return (pricePoint, tokenAmount, commissionTokenAmount); - } - -} diff --git a/contracts/PricerInterface.sol b/contracts/PricerInterface.sol deleted file mode 100644 index 608bd82..0000000 --- a/contracts/PricerInterface.sol +++ /dev/null @@ -1,257 +0,0 @@ -/* solhint-disable-next-line compiler-fixed */ -pragma solidity ^0.4.23; - -// Copyright 2018 OpenST Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ---------------------------------------------------------------------------- -// Utility chain: PricerInterface -// -// http://www.simpletoken.org/ -// -// ---------------------------------------------------------------------------- - -contract PricerInterface { - - /* - * Events - */ - ///Event for payment complete - event Payment( - address _beneficiary, - uint256 _tokenAmount, - address _commissionBeneficiary, - uint256 _commissionTokenAmount, - bytes3 _currency, - uint256 _intendedPricePoint, - uint256 _actualPricePoint); - - ///Event for price oracles updates for currency - event PriceOracleSet( - bytes3 indexed _currency, - address indexed _address); - - ///Event for price oracles delete - event PriceOracleUnset( - bytes3 indexed _currency); - - ///Event for accepted margin update for currency - event AcceptedMarginSet( - bytes3 indexed _currency, - uint256 _acceptedMargin); - - ///Event for Removing Contract - event Removed( - address indexed _sender); - - /// @dev Returns address of the branded token; - /// public method; - /// @return address - function brandedToken() - public - returns (address); - - /// @dev Takes _currency; - /// returns acceptable margin for the given currency; - /// public method; - /// @param _currency currency - /// @return uint256 margin - function acceptedMargins( - bytes3 _currency) - public - returns (uint256); - - /// @dev Takes _currency; - /// returns address of price oracle for the given currency; - /// public method; - /// @param _currency currency - /// @return address - function priceOracles( - bytes3 _currency) - public - returns (address); - - /// @dev Returns address of the base currency; - /// public method; - /// @return bytes3 - function baseCurrency() - public - returns (bytes3); - - /// @dev Returns pricer decimal for branded token; - /// public method; - /// @return uint8 - function decimals() - public - returns (uint8); - - /// @dev Returns conversion rate for branded token; - /// public method; - /// @return uint256 - function conversionRate() - public - returns (uint256); - - /// @dev Returns conversion rate decimals for branded token; - /// public method; - /// @return uint8 - function conversionRateDecimals() - public - returns (uint8); - - /// @dev Takes _currency, _oracleAddress; - /// updates the price oracle address for a given currency; - /// emits PriceOracleSet event; - /// only called by ops; - /// public method; - /// @param _currency currency - /// @param _oracleAddress oracleAddress - /// @return bool isSuccess - function setPriceOracle( - bytes3 _currency, - address _oracleAddress) - public - returns (bool); - - /// @dev Takes _currency; - /// removes the price oracle address for a given currency; - /// emits PriceOracleUnSet event; - /// only called by ops; - /// public method; - /// @param _currency currency - /// @return bool isSuccess - function unsetPriceOracle( - bytes3 _currency) - public - returns (bool); - - /// @dev Takes _currency, _acceptedMargin; - /// updates the acceptable margin range for a given currency; - /// emits AcceptedMargin event; - /// only called by ops; - /// public method; - /// @param _currency currency - /// @param _acceptedMargin acceptedMargin - /// @return bool isSuccess - function setAcceptedMargin( - bytes3 _currency, - uint256 _acceptedMargin) - public - returns (bool); - - /// @dev Takes _transferAmount, _commissionAmount, _currency; - /// public method - /// @param _transferAmount transferAmount - /// @param _commissionAmount commissionAmount - /// @param _currency currency - /// @return (pricePoint, tokenAmount, commissionTokenAmount) - function getPricePointAndCalculatedAmounts( - uint256 _transferAmount, - uint256 _commissionAmount, - bytes3 _currency) - public - view - returns (uint256, uint256, uint256); - - /// @dev Takes _beneficiary, _transferAmount, _commissionBeneficiary, _commissionAmount, - /// _currency, _intendedPricePoint;Validates if the currentPrice from price oracle is - /// in accepatble margin of _intendedPricePoint (if _ currency is not 0) - /// if _currency is 0 then it transfer the branded tokens equal to _transferAmount - /// to _beneficiary and branded tokens equal to _commissionAmount to _commissionBeneficiary - /// (floating value transaction); if _currency is not 0 then it transfer the branded tokens - /// equivalant to _transferAmount in currency value to _beneficiary and branded tokens - /// equivalant to _commissionAmount in currency value to _commissionBeneficiary - /// (fixed value transaction); emits payment event; - /// public method - /// @param _beneficiary beneficiary - /// @param _transferAmount transferAmount - /// @param _commissionBeneficiary commissionBeneficiary - /// @param _commissionAmount commissionAmount - /// @param _currency currency - /// @param _intendedPricePoint _intendedPricePoint - /// @return uint256 totalPaid - function pay( - address _beneficiary, - uint256 _transferAmount, - address _commissionBeneficiary, - uint256 _commissionAmount, - bytes3 _currency, - uint256 _intendedPricePoint) - public - returns (uint256); - - /// @dev Takes _currency; - /// gets current price point for the price oracle for the given currency; - /// public method; - /// @param _currency currency - /// @return (pricePoint) - function getPricePoint( - bytes3 _currency) - public - view - returns (uint256); - - /// @dev Takes _intendedPricePoint, _currentPricePoint, _acceptedMargin; - /// checks if the current price point is in the acceptable range of intendedPricePoint; - /// internal method; - /// @param _beneficiary beneficiary - /// @param _transferAmount transferAmount - /// @param _commissionBeneficiary commissionBeneficiary - /// @param _commissionAmount commissionAmount - /// @return bool isValid - function isValidBeneficiaryData( - address _beneficiary, - uint256 _transferAmount, - address _commissionBeneficiary, - uint256 _commissionAmount) - internal - returns (bool); - - /// @dev Takes _spender, _beneficiary, _tokenAmount, _commissionBeneficiary, _commissionTokenAmount; - /// Perform tokenAmount transfer - /// Perform commissionTokenAmount transfer - /// internal method; - /// @param _spender spender - /// @param _beneficiary beneficiary - /// @param _tokenAmount tokenAmount - /// @param _commissionBeneficiary commissionBeneficiary - /// @param _commissionTokenAmount commissionTokenAmount - /// @return (bool) - function performTransfers( - address _spender, - address _beneficiary, - uint256 _tokenAmount, - address _commissionBeneficiary, - uint256 _commissionTokenAmount) - internal - returns (bool); - - /// @dev Takes _currency, _intendedPricePoint, _transferAmount, _commissionAmount; - /// Validate accepted margin - /// Calculates tokenAmount and commissionTokenAmount - /// internal method - /// @param _currency currency - /// @param _intendedPricePoint intendedPricePoint - /// @param _transferAmount transferAmount - /// @param _commissionAmount commissionAmount - /// @return (pricePoint, tokenAmount, commissionTokenAmount) - function validateMarginAndCalculateBTAmount( - bytes3 _currency, - uint256 _intendedPricePoint, - uint256 _transferAmount, - uint256 _commissionAmount) - internal - returns (uint256, uint256, uint256); - -} \ No newline at end of file diff --git a/contracts/SafeMath.sol b/contracts/SafeMath.sol index 47dd86b..92a8e94 100644 --- a/contracts/SafeMath.sol +++ b/contracts/SafeMath.sol @@ -1,6 +1,6 @@ pragma solidity ^0.4.23; -// Copyright 2017 OpenST Ltd. +// Copyright 2018 OpenST Ltd. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/contracts/TokenHolder.sol b/contracts/TokenHolder.sol new file mode 100644 index 0000000..6eade7b --- /dev/null +++ b/contracts/TokenHolder.sol @@ -0,0 +1,451 @@ +pragma solidity ^0.4.23; + +// Copyright 2018 OpenST Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import "./SafeMath.sol"; +import "./EIP20TokenInterface.sol"; +import "./MultiSigWallet.sol"; +import "./TokenRules.sol"; + + +/** + * @title TokenHolder contract. + * + * @notice Implements executable transactions (EIP-1077) for users to interact + * with token rules. It enables users to authorise sessions for + * ephemeral keys that dapps and mainstream applications can use to + * generate token events on-chain. + */ +contract TokenHolder is MultiSigWallet { + + /* Usings */ + + using SafeMath for uint256; + + + /* Events */ + + event SessionAuthorizationSubmitted( + uint256 indexed _transactionID, + address _ephemeralKey, + uint256 _spendingLimit, + uint256 _expirationHeight + ); + + event SessionRevoked( + address _ephemeralKey + ); + + event RuleExecuted( + address indexed _to, + bytes4 _functionSelector, + address _ephemeralKey, + uint256 _nonce, + bytes32 _messageHash, + bool _status + ); + + + /* Enums */ + + enum AuthorizationStatus { + NOT_AUTHORIZED, + AUTHORIZED, + REVOKED + } + + + /* Structs */ + + /** expirationHeight is the block number at which ephemeralKey expires. */ + struct EphemeralKeyData { + uint256 spendingLimit; + uint256 nonce; + uint256 expirationHeight; + AuthorizationStatus status; + } + + + /* Constants */ + + bytes4 constant public AUTHORIZE_SESSION_CALLPREFIX = bytes4( + keccak256("authorizeSession(address,uint256,uint256)") + ); + + bytes4 public constant EXECUTE_RULE_CALLPREFIX = bytes4( + keccak256( + "executeRule(address,bytes,uint256,uint8,bytes32,bytes32)" + ) + ); + + + /* Storage */ + + EIP20TokenInterface public token; + + mapping(address /* key */ => EphemeralKeyData) public ephemeralKeys; + + address public tokenRules; + + + /* Modifiers */ + + modifier keyIsNotNull(address _key) + { + require(_key != address(0), "Key address is null."); + _; + } + + /** Requires that key is in authorized state. */ + modifier keyIsAuthorized(address _key) + { + AuthorizationStatus status = ephemeralKeys[_key].status; + require( + status == AuthorizationStatus.AUTHORIZED, + "Key is not authorized." + ); + _; + } + + /** Requires that key was not authorized. */ + modifier keyDoesNotExist(address _key) + { + AuthorizationStatus status = ephemeralKeys[_key].status; + require( + status == AuthorizationStatus.NOT_AUTHORIZED, + "Key exists." + ); + _; + } + + + /* Special Functions */ + + /** + * @dev Constructor requires: + * - EIP20 token address is not null. + * - Token rules address is not null. + * + * @param _token eip20 contract address deployed for an economy. + * @param _tokenRules Token rules contract address. + * @param _wallets array of wallet addresses. + * @param _required No of requirements for multi sig wallet. + */ + constructor( + EIP20TokenInterface _token, + address _tokenRules, + address[] _wallets, + uint256 _required + ) + public + MultiSigWallet(_wallets, _required) + { + require( + _token != address(0), + "Token contract address is null." + ); + require( + _tokenRules != address(0), + "TokenRules contract address is null." + ); + + token = _token; + tokenRules = _tokenRules; + } + + + /* External Functions */ + + /** + * @notice Submits a transaction for a session authorization with + * the specified ephemeral key. + * + * @dev Function requires: + * - Only registered wallet can call. + * - The key is not null. + * - The key does not exist. + * - Expiration height is bigger than the current block height. + * + * @param _ephemeralKey Ephemeral key to authorize. + * @param _spendingLimit Spending limit of the key. + * @param _expirationHeight Expiration height of the ephemeral key. + * + * @return transactionID_ Newly created transaction id. + */ + function submitAuthorizeSession( + address _ephemeralKey, + uint256 _spendingLimit, + uint256 _expirationHeight + ) + public + onlyWallet + keyIsNotNull(_ephemeralKey) + keyDoesNotExist(_ephemeralKey) + returns (uint256 transactionID_) + { + require( + _expirationHeight > block.number, + "Expiration height is lte to the current block height." + ); + + transactionID_ = addTransaction( + address(this), + abi.encodeWithSelector( + AUTHORIZE_SESSION_CALLPREFIX, + _ephemeralKey, + _spendingLimit, + _expirationHeight + ) + ); + + emit SessionAuthorizationSubmitted( + transactionID_, + _ephemeralKey, + _spendingLimit, + _expirationHeight + ); + + confirmTransaction(transactionID_); + } + + /** + * @notice Revokes session for the specified ephemeral key. + * + * @dev Function revokes the key even if it has expired. + * Function requires: + * - Only registered wallet can call. + * - The key is authorized. + * + * @param _ephemeralKey Ephemeral key to revoke. + */ + function revokeSession(address _ephemeralKey) + external + onlyWallet + keyIsAuthorized(_ephemeralKey) + { + ephemeralKeys[_ephemeralKey].status = AuthorizationStatus.REVOKED; + + emit SessionRevoked(_ephemeralKey); + } + + /* Public Functions */ + + /** + * @notice Evaluates executable transaction signed by an ephemeral key. + * + * @dev As a first step, function validates executable transaction by + * checking that the specified signature matches one of the + * authorized (non-expired) ephemeral keys. + * + * On success, function executes transaction by calling: + * _to.call(_data); + * + * Before execution, it approves the tokenRules as a spender + * for ephemeralKey.spendingLimit amount. This allowance is cleared + * after execution. + * + * Function requires: + * - The key used to sign data is authorized and have not expired. + * - nonce matches the next available one (+1 of the last + * used one). + * + * @param _to The target contract address the transaction will be executed + * upon. + * @param _data The payload of a function to be executed in the target + * contract. + * @param _nonce The nonce of an ephemeral key that was used to sign + * the transaction. + * + * @return executeStatus_ True in case of successfull execution of the + * executable transaction, otherwise, false. + */ + function executeRule( + address _to, + bytes _data, + uint256 _nonce, + uint8 _v, + bytes32 _r, + bytes32 _s + ) + public + payable + returns (bool executionStatus_) + { + bytes32 messageHash = bytes32(0); + address ephemeralKey = address(0); + (messageHash, ephemeralKey) = verifyExecutableTransaction( + EXECUTE_RULE_CALLPREFIX, + _to, + _data, + _nonce, + _v, + _r, + _s + ); + + EphemeralKeyData storage ephemeralKeyData = ephemeralKeys[ephemeralKey]; + + TokenRules(tokenRules).allowTransfers(); + + token.approve( + tokenRules, + ephemeralKeyData.spendingLimit + ); + + // solium-disable-next-line security/no-call-value + executionStatus_ = _to.call.value(msg.value)(_data); + + token.approve(tokenRules, 0); + + TokenRules(tokenRules).disallowTransfers(); + + bytes4 functionSelector = bytesToBytes4(_data); + + emit RuleExecuted( + _to, + functionSelector, + ephemeralKey, + _nonce, + messageHash, + executionStatus_ + ); + } + + function authorizeSession( + address _ephemeralKey, + uint256 _spendingLimit, + uint256 _expirationHeight + ) + public + onlyMultisig + keyIsNotNull(_ephemeralKey) + keyDoesNotExist(_ephemeralKey) + { + require( + _expirationHeight > block.number, + "Expiration height is lte to the current block height." + ); + + EphemeralKeyData storage keyData = ephemeralKeys[_ephemeralKey]; + + keyData.spendingLimit = _spendingLimit; + keyData.expirationHeight = _expirationHeight; + keyData.nonce = 0; + keyData.status = AuthorizationStatus.AUTHORIZED; + } + + + /* Private Functions */ + + function verifyExecutableTransaction( + bytes4 _callPrefix, + address _to, + bytes _data, + uint256 _nonce, + uint8 _v, + bytes32 _r, + bytes32 _s + ) + private + returns (bytes32 messageHash_, address key_) + { + messageHash_ = getMessageHash( + _callPrefix, + _to, + keccak256(_data), + _nonce + ); + + key_ = ecrecover(messageHash_, _v, _r, _s); + + EphemeralKeyData storage keyData = ephemeralKeys[key_]; + + require( + keyData.status == AuthorizationStatus.AUTHORIZED && + keyData.expirationHeight > block.number, + "Ephemeral key is not active." + ); + + uint256 expectedNonce = keyData.nonce.add(1); + + require( + _nonce == expectedNonce, + "The next nonce is not provided." + ); + + keyData.nonce = expectedNonce; + } + + /** + * @notice The hashed message format is compliant with EIP-1077. + * + * @dev EIP-1077 enables user to sign messages to show intent of execution, + * but allows a third party relayer to execute them. + * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1077.md + */ + function getMessageHash( + bytes4 _callPrefix, + address _to, + bytes32 _dataHash, + uint256 _nonce + ) + private + view + returns (bytes32 messageHash_) + { + messageHash_ = keccak256( + abi.encodePacked( + byte(0x19), // Starting a transaction with byte(0x19) ensure + // the signed data from being a valid ethereum + // transaction. + byte(0), // The version control byte. + address(this), // The from field will always be the contract + // executing the code. + _to, + uint8(0), // The amount in ether to be sent. + _dataHash, + _nonce, + uint8(0), // gasPrice + uint8(0), // gasLimit + uint8(0), // gasToken + _callPrefix, // 4 byte standard call prefix of the + // function to be called in the 'from' contract. + // This guarantees that signed message can + // be only executed in a single instance. + uint8(0), // 0 for a standard call, 1 for a DelegateCall and 2 + // for a create opcode + bytes32(0) // extraHash is always hashed at the end. This is + // done to increase future compatibility of the + // standard. + ) + ); + } + + /** + * @dev Retrieves the first 4 bytes of input byte array into byte4. + * Function requires: + * - Input byte array's length is greater than or equal to 4. + */ + function bytesToBytes4(bytes _input) public pure returns (bytes4 out_) { + require( + _input.length >= 4, + "Input bytes length is less than 4." + ); + + for (uint8 i = 0; i < 4; i++) { + out_ |= bytes4(_input[i] & 0xFF) >> (i * 8); + } + } +} \ No newline at end of file diff --git a/contracts/TokenRules.sol b/contracts/TokenRules.sol new file mode 100644 index 0000000..fe26021 --- /dev/null +++ b/contracts/TokenRules.sol @@ -0,0 +1,400 @@ +pragma solidity ^0.4.23; + +// Copyright 2018 OpenST Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import "./GlobalConstraintInterface.sol"; +import "./SafeMath.sol"; +import "./EIP20TokenInterface.sol"; + + +/** + * @notice Register of whitelisted rules that are allowed to initiate transfers + * from a token holder accounts. + * + * @dev TokenHolder.executeRule() function will execute any rule that are + * signed by an authorized and non-expired ephemeral key. + * However, only the rules, that are registered in TokenRules + * can initiate transfers of token from TokenHolder to other beneficiaries. + * TokenHolder is going to allow TokenRules as a spender before + * execution of the rule (amount is limited by spendingLimit registered + * during an authorizaiton of an ephemeral key.). TokenHolder will + * clear this allowance after execution. + * Before execution of transfers from TokenHolder, TokenRules will + * check that all global constraints are satisified. + * During a execution, rule can call TokenRules.executeTransfers() + * function only once. This allows global constraints to be checked + * on complete list of transfers. + */ +contract TokenRules { + + /* Usings */ + + using SafeMath for uint256; + + + /* Events */ + + event RuleRegistered( + string _ruleName, + address _ruleAddress + ); + + event GlobalConstraintAdded(address _globalConstraintAddress); + + event GlobalConstraintRemoved(address _globalConstraintAddress); + + + /* Structs */ + + struct TokenRule { + string ruleName; + address ruleAddress; + string ruleAbi; + } + + /** + * RuleIndex struct is going to be used in 'rulesByAddress' and + * 'rulesByNameHash' mappings for pointing to the index with 'rules' array. + * Simple usage of uint256 in those mappings does not work, because + * for non existing rule name and address it defaults to 0 index, + * which is obviously wrong. Before accessing 'rules' array by index + * one should check 'exists' field of the struct. + */ + struct RuleIndex { + uint256 index; + bool exists; + } + + /* Storage */ + + /** Contains all registered rule in the order of registration. */ + TokenRule[] public rules; + + /** Mapping from a rule address to the index in the `rules` array. */ + mapping (address => RuleIndex) public rulesByAddress; + + /** Mapping from a rule name hash to the index in the `rules` array. */ + mapping (bytes32 => RuleIndex) public rulesByNameHash; + + /** Contains a list of all registered global constraints. */ + address[] public globalConstraints; + + address public organization; + EIP20TokenInterface public token; + + /** + * TokenHolder contract before a rule execution will set the flag + * on (true) for itself. TokenRules.executeTransfers will set the flag to + * off (false) for _from (TokenHolder) after execution. This will restrict + * a rule to make a call to TokenRules.executeTransfers only *once*. + */ + mapping (address => bool) public allowedTransfers; + + + /* Modifiers */ + + modifier onlyOrganization { + require( + organization == msg.sender, + "Only organization is allowed to call." + ); + _; + } + + modifier onlyRule { + require( + rulesByAddress[msg.sender].exists, + "Only registered rule is allowed to call." + ); + _; + } + + + /* Special Functions */ + + /** + * @dev Function requires: + * - Organization address is not null. + * - Token address is not null. + */ + constructor( + address _organization, + EIP20TokenInterface _token + ) + public + { + require(_organization != address(0), "Organization address is null."); + require(_token != address(0), "Token address is null."); + + organization = _organization; + token = _token; + } + + + /* External Functions */ + + /** + * @dev Function requires: + * - Only organization can call. + * - Rule name is not empty. + * - Rule with the specified name does not exist. + * - Rule address is not null. + * - Rule with the specified address does not exist. + * - Rule abi is not empty. + * + * @param _ruleName The name of a rule to register. + * @param _ruleAddress The address of a rule to register. + * @param _ruleAbi The abi of the rule to register. + */ + function registerRule( + string _ruleName, + address _ruleAddress, + string _ruleAbi + ) + external + onlyOrganization + { + require(bytes(_ruleName).length != 0, "Rule name is empty."); + require(_ruleAddress != address(0), "Rule address is null."); + require(bytes(_ruleAbi).length != 0, "Rule ABI is empty."); + + bytes32 ruleNameHash = keccak256(abi.encodePacked(_ruleName)); + + require( + !rulesByNameHash[ruleNameHash].exists, + "Rule with the specified name already exists." + ); + require( + !rulesByAddress[_ruleAddress].exists, + "Rule with the specified address already exists." + ); + + TokenRule memory rule = TokenRule({ + ruleName: _ruleName, + ruleAddress: _ruleAddress, + ruleAbi: _ruleAbi + }); + + RuleIndex memory ruleIndex = RuleIndex({ + index: rules.length, + exists: true + }); + + rulesByAddress[_ruleAddress] = ruleIndex; + rulesByNameHash[ruleNameHash] = ruleIndex; + rules.push(rule); + + emit RuleRegistered(_ruleName, _ruleAddress); + } + + /** @dev See documentation for allowedTransfers storage variable. */ + function allowTransfers() + external + { + allowedTransfers[msg.sender] = true; + } + + /** @dev See documentation for allowedTransfers storage variable. */ + function disallowTransfers() + external + { + allowedTransfers[msg.sender] = false; + } + + /** + * @dev Transfers from the specified account to all beneficiary + * accounts corresponding amounts. + * Function requires: + * - Only registered rule can call. + * - An account from which (_from) transfer will be done should + * allow this transfer by calling to TokenRules.allowTransfers(). + * TokenRules will set this allowance back, hence, only + * one call is allowed per execution session. + * - _transfersTo and _transfersAmount arrays length should match. + * - All globally registered constraints should satisfy before + * execution. + * + * @param _from An address from which transfer is done. + * @param _transfersTo List of addresses to transfer. + * @param _transfersAmount List of amounts to transfer. + */ + function executeTransfers( + address _from, + address[] _transfersTo, + uint256[] _transfersAmount + ) + external + onlyRule + { + require( + allowedTransfers[_from], + "Transfers from the address are not allowed." + ); + + require( + _transfersTo.length == _transfersAmount.length, + "'to' and 'amount' transfer arrays' lengths are not equal." + ); + + require( + checkGlobalConstraints(_from, _transfersTo, _transfersAmount), + "Constraints not fullfilled." + ); + + for(uint256 i = 0; i < _transfersTo.length; ++i) { + token.transferFrom( + _from, + _transfersTo[i], + _transfersAmount[i] + ); + } + + allowedTransfers[_from] = false; + } + + /** + * @notice Registers a constraint to check globally before + * executing transfers. + * + * @dev Function requires: + * - Only organization can call. + * - Constraint address is not null. + * - Constraint is not registered. + */ + function addGlobalConstraint( + address _globalConstraintAddress + ) + external + onlyOrganization + { + require( + _globalConstraintAddress != address(0), + "Constraint to add is null." + ); + + uint256 index = findGlobalConstraintIndex(_globalConstraintAddress); + + require( + index == globalConstraints.length, + "Constraint to add already exists." + ); + + globalConstraints.push(_globalConstraintAddress); + + emit GlobalConstraintAdded(_globalConstraintAddress); + } + + /** + * @dev Function requires: + * - Only organization can call. + * - Constraint exists. + */ + function removeGlobalConstraint( + address _globalConstraintAddress + ) + external + onlyOrganization + { + uint256 index = findGlobalConstraintIndex(_globalConstraintAddress); + + require( + index != globalConstraints.length, + "Constraint to remove does not exist." + ); + + removeGlobalConstraintByIndex(index); + + emit GlobalConstraintRemoved(_globalConstraintAddress); + } + + + /* Public Functions */ + + function globalConstraintCount() + public + view + returns (uint256) + { + return globalConstraints.length; + } + + /** + * @dev Function requires: + * - _transfersTo and _transfersAmount arrays length should match. + * + * @return Returns true, if all registered global constraints + * are satisfied, otherwise false. + */ + function checkGlobalConstraints( + address _from, + address[] _transfersTo, + uint256[] _transfersAmount + ) + public + view + returns (bool _passed) + { + require( + _transfersTo.length == _transfersAmount.length, + "'to' and 'amount' transfer arrays' lengths are not equal." + ); + + _passed = true; + + for(uint256 i = 0; i < globalConstraints.length && _passed; ++i) { + _passed = GlobalConstraintInterface(globalConstraints[i]).check( + _from, + _transfersTo, + _transfersAmount + ); + } + } + + + /* Private Functions */ + + /** + * @dev Finds index of constraint. + * + * @param _constraint Constraint to find in constraints array. + * + * @return index_ Returns index of the constraint if exists, + * otherwise returns constraints.length. + */ + function findGlobalConstraintIndex(address _constraint) + private + view + returns (uint256 index_) + { + index_ = 0; + while( + index_ < globalConstraints.length && + globalConstraints[index_] != _constraint + ) + { + ++index_; + } + } + + function removeGlobalConstraintByIndex(uint256 _index) + private + { + require(_index < globalConstraints.length, "Index is out of range."); + + uint256 lastElementIndex = globalConstraints.length - 1; + globalConstraints[_index] = globalConstraints[lastElementIndex]; + --globalConstraints.length; + } +} diff --git a/contracts/TokenRulesMock.sol b/contracts/TokenRulesMock.sol new file mode 100644 index 0000000..1e167ac --- /dev/null +++ b/contracts/TokenRulesMock.sol @@ -0,0 +1,41 @@ +pragma solidity ^0.4.23; + +contract TokenRulesMock { + + /* Storage */ + + mapping (address => bool) public allowedTransfers; + address public from; + address[] public transferTo; + uint256[] public transferAmount; + + + /* External Functions */ + + function allowTransfers() + external + { + allowedTransfers[msg.sender] = true; + } + + function disallowTransfers() + external + { + allowedTransfers[msg.sender] = false; + } + + function executeTransfers( + address _from, + address[] _transfersTo, + uint256[] _transfersAmount + ) + external + { + + from = _from; + transferTo = _transfersTo; + transferAmount = _transfersAmount; + + } + +} diff --git a/contracts/TransferRule.sol b/contracts/TransferRule.sol new file mode 100644 index 0000000..60cf283 --- /dev/null +++ b/contracts/TransferRule.sol @@ -0,0 +1,60 @@ +pragma solidity ^0.4.23; + + +// Copyright 2018 OpenST Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import "./TokenRules.sol"; + +contract TransferRule { + + /* Variables */ + + TokenRules tokenRules; + + + /* Functions */ + + constructor ( + address _tokenRules + ) + public + { + require (_tokenRules != address(0), "Token rules address is null."); + tokenRules = TokenRules(_tokenRules); + } + + function transferFrom ( + address _from, + address _to, + uint256 _amount + ) + public + returns (bool) + { + address[] memory transfersTo = new address[](1); + transfersTo[0] = _to; + + uint256[] memory transfersAmount = new uint256[](1); + transfersAmount[0] = _amount; + + TokenRules(tokenRules).executeTransfers( + _from, + transfersTo, + transfersAmount + ); + + return true; + } +} diff --git a/contracts/Workers.sol b/contracts/Workers.sol deleted file mode 100644 index 27fd7c6..0000000 --- a/contracts/Workers.sol +++ /dev/null @@ -1,128 +0,0 @@ -pragma solidity ^0.4.23; - -// Copyright 2018 OpenST Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ---------------------------------------------------------------------------- -// Utility chain: Workers -// -// http://www.simpletoken.org/ -// -// ---------------------------------------------------------------------------- - -import "./OpsManaged.sol"; -import "./SafeMath.sol"; - - -/// A set of authorised workers -contract Workers is OpsManaged { - using SafeMath for uint256; - - /* - * Storage - */ - /// workers are active up unto the deactivation height - mapping(address => uint256 /* deactivation height */) public workers; - - /* - * Events - */ - ///Event for worker set - event WorkerSet( - address indexed _worker, - uint256 indexed _deactivationHeight, - uint256 _remainingHeight); - - ///Event for worker removed - event WorkerRemoved( - address indexed _worker, - bool _existed); - - /// @dev Constructor; - /// public method; - constructor() - public - OpsManaged() - { - } - - /// @dev Takes _worker, _deactivationHeight; - /// Sets worker and its deactivation height; - /// external method; - /// @param _worker worker - /// @param _deactivationHeight deactivationHeight - /// @return (remainingHeight) - function setWorker( - address _worker, - uint256 _deactivationHeight) - external - onlyOps - returns (uint256 /* remaining activation length */) - { - require(_worker != address(0)); - require(_deactivationHeight >= block.number); - - workers[_worker] = _deactivationHeight; - uint256 remainingHeight = _deactivationHeight - block.number; - //Event for worker set - emit WorkerSet(_worker, _deactivationHeight, remainingHeight); - - return (remainingHeight); - } - - /// @dev Takes _worker; - /// removes the worker; - /// external method; - /// @param _worker worker - /// @return (existed) - function removeWorker( - address _worker) - external - onlyOps - returns (bool existed) - { - existed = (workers[_worker] > 0); - - delete workers[_worker]; - //Event for worker removed - emit WorkerRemoved(_worker, existed); - - return existed; - } - - /// @dev Clean up or collectively revoke all workers; - /// external method; - /// only called by ops or admin; - function remove() - external - onlyAdminOrOps - { - selfdestruct(msg.sender); - } - - /// @dev Takes _worker; - /// checks if the worker is valid; - /// external method; - /// @param _worker worker - /// @return (isValid) - function isWorker( - address _worker) - external - view - returns (bool /* is active worker */) - { - return (workers[_worker] >= block.number); - } - -} \ No newline at end of file diff --git a/contracts/abi/Airdrop.abi b/contracts/abi/Airdrop.abi deleted file mode 100644 index 3fb51ce..0000000 --- a/contracts/abi/Airdrop.abi +++ /dev/null @@ -1 +0,0 @@ -[{"constant":true,"inputs":[],"name":"airdropBudgetHolder","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_adminAddress","type":"address"}],"name":"setAdminAddress","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_currency","type":"bytes3"}],"name":"acceptedMargins","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_opsAddress","type":"address"}],"name":"setOpsAddress","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_currency","type":"bytes3"}],"name":"unsetPriceOracle","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"conversionRate","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_currency","type":"bytes3"}],"name":"priceOracles","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"opsAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"baseCurrency","outputs":[{"name":"","type":"bytes3"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_transferAmount","type":"uint256"},{"name":"_commissionAmount","type":"uint256"},{"name":"_currency","type":"bytes3"}],"name":"getPricePointAndCalculatedAmounts","outputs":[{"name":"pricePoint","type":"uint256"},{"name":"tokenAmount","type":"uint256"},{"name":"commissionTokenAmount","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"remove","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_beneficiary","type":"address"},{"name":"_transferAmount","type":"uint256"},{"name":"_commissionBeneficiary","type":"address"},{"name":"_commissionAmount","type":"uint256"},{"name":"_currency","type":"bytes3"},{"name":"_intendedPricePoint","type":"uint256"},{"name":"_spender","type":"address"},{"name":"_airdropAmount","type":"uint256"}],"name":"payAirdrop","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_beneficiary","type":"address"},{"name":"_transferAmount","type":"uint256"},{"name":"_commissionBeneficiary","type":"address"},{"name":"_commissionAmount","type":"uint256"},{"name":"_currency","type":"bytes3"},{"name":"_intendedPricePoint","type":"uint256"}],"name":"pay","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_currency","type":"bytes3"}],"name":"getPricePoint","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_currency","type":"bytes3"},{"name":"_acceptedMargin","type":"uint256"}],"name":"setAcceptedMargin","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_proposedOwner","type":"address"}],"name":"initiateOwnershipTransfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"workers","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"proposedOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"brandedToken","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"conversionRateDecimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"completeOwnershipTransfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_currency","type":"bytes3"},{"name":"_oracleAddress","type":"address"}],"name":"setPriceOracle","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"adminAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_brandedToken","type":"address"},{"name":"_baseCurrency","type":"bytes3"},{"name":"_workers","type":"address"},{"name":"_airdropBudgetHolder","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_beneficiary","type":"address"},{"indexed":false,"name":"_tokenAmount","type":"uint256"},{"indexed":true,"name":"_commissionBeneficiary","type":"address"},{"indexed":false,"name":"_commissionTokenAmount","type":"uint256"},{"indexed":false,"name":"_currency","type":"bytes3"},{"indexed":false,"name":"_actualPricePoint","type":"uint256"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_airdropUsed","type":"uint256"}],"name":"AirdropPayment","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_beneficiary","type":"address"},{"indexed":false,"name":"_tokenAmount","type":"uint256"},{"indexed":false,"name":"_commissionBeneficiary","type":"address"},{"indexed":false,"name":"_commissionTokenAmount","type":"uint256"},{"indexed":false,"name":"_currency","type":"bytes3"},{"indexed":false,"name":"_intendedPricePoint","type":"uint256"},{"indexed":false,"name":"_actualPricePoint","type":"uint256"}],"name":"Payment","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_currency","type":"bytes3"},{"indexed":true,"name":"_address","type":"address"}],"name":"PriceOracleSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_currency","type":"bytes3"}],"name":"PriceOracleUnset","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_currency","type":"bytes3"},{"indexed":false,"name":"_acceptedMargin","type":"uint256"}],"name":"AcceptedMarginSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_sender","type":"address"}],"name":"Removed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_newAddress","type":"address"}],"name":"AdminAddressChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_newAddress","type":"address"}],"name":"OpsAddressChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_proposedOwner","type":"address"}],"name":"OwnershipTransferInitiated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_newOwner","type":"address"}],"name":"OwnershipTransferCompleted","type":"event"}] \ No newline at end of file diff --git a/contracts/abi/EIP20Interface.abi b/contracts/abi/EIP20Interface.abi deleted file mode 100644 index c21aacf..0000000 --- a/contracts/abi/EIP20Interface.abi +++ /dev/null @@ -1 +0,0 @@ -[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Approval","type":"event"}] \ No newline at end of file diff --git a/contracts/abi/EIP20Token.abi b/contracts/abi/EIP20Token.abi deleted file mode 100644 index 4433389..0000000 --- a/contracts/abi/EIP20Token.abi +++ /dev/null @@ -1 +0,0 @@ -[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_symbol","type":"string"},{"name":"_name","type":"string"},{"name":"_decimals","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Approval","type":"event"}] \ No newline at end of file diff --git a/contracts/abi/EIP20TokenMock.abi b/contracts/abi/EIP20TokenMock.abi deleted file mode 100644 index 94a24d3..0000000 --- a/contracts/abi/EIP20TokenMock.abi +++ /dev/null @@ -1 +0,0 @@ -[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_conversionRate","type":"uint256"}],"name":"setConverionRate","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"conversionRate","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"},{"name":"_value","type":"uint256"}],"name":"setBalance","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"conversionRateDecimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_conversionRate","type":"uint256"},{"name":"_conversionRateDecimals","type":"uint8"},{"name":"_symbol","type":"string"},{"name":"_name","type":"string"},{"name":"_decimals","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Approval","type":"event"}] \ No newline at end of file diff --git a/contracts/abi/OpsManaged.abi b/contracts/abi/OpsManaged.abi deleted file mode 100644 index d5985f6..0000000 --- a/contracts/abi/OpsManaged.abi +++ /dev/null @@ -1 +0,0 @@ -[{"constant":false,"inputs":[{"name":"_adminAddress","type":"address"}],"name":"setAdminAddress","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_opsAddress","type":"address"}],"name":"setOpsAddress","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"opsAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_proposedOwner","type":"address"}],"name":"initiateOwnershipTransfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"proposedOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"completeOwnershipTransfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"adminAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_newAddress","type":"address"}],"name":"AdminAddressChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_newAddress","type":"address"}],"name":"OpsAddressChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_proposedOwner","type":"address"}],"name":"OwnershipTransferInitiated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_newOwner","type":"address"}],"name":"OwnershipTransferCompleted","type":"event"}] \ No newline at end of file diff --git a/contracts/abi/Owned.abi b/contracts/abi/Owned.abi deleted file mode 100644 index baf9df8..0000000 --- a/contracts/abi/Owned.abi +++ /dev/null @@ -1 +0,0 @@ -[{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_proposedOwner","type":"address"}],"name":"initiateOwnershipTransfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"proposedOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"completeOwnershipTransfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_proposedOwner","type":"address"}],"name":"OwnershipTransferInitiated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_newOwner","type":"address"}],"name":"OwnershipTransferCompleted","type":"event"}] \ No newline at end of file diff --git a/contracts/abi/PriceOracle.abi b/contracts/abi/PriceOracle.abi deleted file mode 100644 index ed85687..0000000 --- a/contracts/abi/PriceOracle.abi +++ /dev/null @@ -1 +0,0 @@ -[{"constant":false,"inputs":[{"name":"_adminAddress","type":"address"}],"name":"setAdminAddress","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"priceValidityDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_opsAddress","type":"address"}],"name":"setOpsAddress","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"quoteCurrency","outputs":[{"name":"","type":"bytes3"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"opsAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_price","type":"uint256"}],"name":"setPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"baseCurrency","outputs":[{"name":"","type":"bytes3"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"expirationHeight","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_proposedOwner","type":"address"}],"name":"initiateOwnershipTransfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"proposedOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"completeOwnershipTransfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"adminAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_baseCurrency","type":"bytes3"},{"name":"_quoteCurrency","type":"bytes3"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_price","type":"uint256"},{"indexed":true,"name":"_expirationHeight","type":"uint256"}],"name":"PriceUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_newAddress","type":"address"}],"name":"AdminAddressChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_newAddress","type":"address"}],"name":"OpsAddressChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_proposedOwner","type":"address"}],"name":"OwnershipTransferInitiated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_newOwner","type":"address"}],"name":"OwnershipTransferCompleted","type":"event"}] \ No newline at end of file diff --git a/contracts/abi/PriceOracleInterface.abi b/contracts/abi/PriceOracleInterface.abi deleted file mode 100644 index c05eed0..0000000 --- a/contracts/abi/PriceOracleInterface.abi +++ /dev/null @@ -1 +0,0 @@ -[{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"priceValidityDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"quoteCurrency","outputs":[{"name":"","type":"bytes3"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"baseCurrency","outputs":[{"name":"","type":"bytes3"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"expirationHeight","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_price","type":"uint256"},{"indexed":true,"name":"_expirationHeight","type":"uint256"}],"name":"PriceUpdated","type":"event"}] \ No newline at end of file diff --git a/contracts/abi/PriceOracleMock.abi b/contracts/abi/PriceOracleMock.abi deleted file mode 100644 index b4e9810..0000000 --- a/contracts/abi/PriceOracleMock.abi +++ /dev/null @@ -1 +0,0 @@ -[{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"priceValidityDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"quoteCurrency","outputs":[{"name":"","type":"bytes3"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"baseCurrency","outputs":[{"name":"","type":"bytes3"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"expirationHeight","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_baseCurrency","type":"bytes3"},{"name":"_quoteCurrency","type":"bytes3"},{"name":"_price","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_price","type":"uint256"},{"indexed":true,"name":"_expirationHeight","type":"uint256"}],"name":"PriceUpdated","type":"event"}] \ No newline at end of file diff --git a/contracts/abi/Pricer.abi b/contracts/abi/Pricer.abi deleted file mode 100644 index bc7709b..0000000 --- a/contracts/abi/Pricer.abi +++ /dev/null @@ -1 +0,0 @@ -[{"constant":false,"inputs":[{"name":"_adminAddress","type":"address"}],"name":"setAdminAddress","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_currency","type":"bytes3"}],"name":"acceptedMargins","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_opsAddress","type":"address"}],"name":"setOpsAddress","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_currency","type":"bytes3"}],"name":"unsetPriceOracle","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"conversionRate","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_currency","type":"bytes3"}],"name":"priceOracles","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"opsAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"baseCurrency","outputs":[{"name":"","type":"bytes3"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_transferAmount","type":"uint256"},{"name":"_commissionAmount","type":"uint256"},{"name":"_currency","type":"bytes3"}],"name":"getPricePointAndCalculatedAmounts","outputs":[{"name":"pricePoint","type":"uint256"},{"name":"tokenAmount","type":"uint256"},{"name":"commissionTokenAmount","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"remove","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_beneficiary","type":"address"},{"name":"_transferAmount","type":"uint256"},{"name":"_commissionBeneficiary","type":"address"},{"name":"_commissionAmount","type":"uint256"},{"name":"_currency","type":"bytes3"},{"name":"_intendedPricePoint","type":"uint256"}],"name":"pay","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_currency","type":"bytes3"}],"name":"getPricePoint","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_currency","type":"bytes3"},{"name":"_acceptedMargin","type":"uint256"}],"name":"setAcceptedMargin","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_proposedOwner","type":"address"}],"name":"initiateOwnershipTransfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"proposedOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"brandedToken","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"conversionRateDecimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"completeOwnershipTransfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_currency","type":"bytes3"},{"name":"_oracleAddress","type":"address"}],"name":"setPriceOracle","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"adminAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_brandedToken","type":"address"},{"name":"_baseCurrency","type":"bytes3"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_beneficiary","type":"address"},{"indexed":false,"name":"_tokenAmount","type":"uint256"},{"indexed":false,"name":"_commissionBeneficiary","type":"address"},{"indexed":false,"name":"_commissionTokenAmount","type":"uint256"},{"indexed":false,"name":"_currency","type":"bytes3"},{"indexed":false,"name":"_intendedPricePoint","type":"uint256"},{"indexed":false,"name":"_actualPricePoint","type":"uint256"}],"name":"Payment","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_currency","type":"bytes3"},{"indexed":true,"name":"_address","type":"address"}],"name":"PriceOracleSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_currency","type":"bytes3"}],"name":"PriceOracleUnset","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_currency","type":"bytes3"},{"indexed":false,"name":"_acceptedMargin","type":"uint256"}],"name":"AcceptedMarginSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_sender","type":"address"}],"name":"Removed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_newAddress","type":"address"}],"name":"AdminAddressChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_newAddress","type":"address"}],"name":"OpsAddressChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_proposedOwner","type":"address"}],"name":"OwnershipTransferInitiated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_newOwner","type":"address"}],"name":"OwnershipTransferCompleted","type":"event"}] \ No newline at end of file diff --git a/contracts/abi/PricerInterface.abi b/contracts/abi/PricerInterface.abi deleted file mode 100644 index 4bebcba..0000000 --- a/contracts/abi/PricerInterface.abi +++ /dev/null @@ -1 +0,0 @@ -[{"constant":false,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_currency","type":"bytes3"}],"name":"acceptedMargins","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_currency","type":"bytes3"}],"name":"unsetPriceOracle","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"conversionRate","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_currency","type":"bytes3"}],"name":"priceOracles","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"baseCurrency","outputs":[{"name":"","type":"bytes3"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_transferAmount","type":"uint256"},{"name":"_commissionAmount","type":"uint256"},{"name":"_currency","type":"bytes3"}],"name":"getPricePointAndCalculatedAmounts","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_beneficiary","type":"address"},{"name":"_transferAmount","type":"uint256"},{"name":"_commissionBeneficiary","type":"address"},{"name":"_commissionAmount","type":"uint256"},{"name":"_currency","type":"bytes3"},{"name":"_intendedPricePoint","type":"uint256"}],"name":"pay","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_currency","type":"bytes3"}],"name":"getPricePoint","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_currency","type":"bytes3"},{"name":"_acceptedMargin","type":"uint256"}],"name":"setAcceptedMargin","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"brandedToken","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"conversionRateDecimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_currency","type":"bytes3"},{"name":"_oracleAddress","type":"address"}],"name":"setPriceOracle","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_beneficiary","type":"address"},{"indexed":false,"name":"_tokenAmount","type":"uint256"},{"indexed":false,"name":"_commissionBeneficiary","type":"address"},{"indexed":false,"name":"_commissionTokenAmount","type":"uint256"},{"indexed":false,"name":"_currency","type":"bytes3"},{"indexed":false,"name":"_intendedPricePoint","type":"uint256"},{"indexed":false,"name":"_actualPricePoint","type":"uint256"}],"name":"Payment","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_currency","type":"bytes3"},{"indexed":true,"name":"_address","type":"address"}],"name":"PriceOracleSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_currency","type":"bytes3"}],"name":"PriceOracleUnset","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_currency","type":"bytes3"},{"indexed":false,"name":"_acceptedMargin","type":"uint256"}],"name":"AcceptedMarginSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_sender","type":"address"}],"name":"Removed","type":"event"}] \ No newline at end of file diff --git a/contracts/abi/SafeMath.abi b/contracts/abi/SafeMath.abi deleted file mode 100644 index 0637a08..0000000 --- a/contracts/abi/SafeMath.abi +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/contracts/abi/UtilityTokenInterface.abi b/contracts/abi/UtilityTokenInterface.abi deleted file mode 100644 index 76373cd..0000000 --- a/contracts/abi/UtilityTokenInterface.abi +++ /dev/null @@ -1 +0,0 @@ -[{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"supply","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_beneficiary","type":"address"}],"name":"claim","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_beneficiary","type":"address"},{"name":"_amount","type":"uint256"}],"name":"mint","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"conversionRate","outputs":[{"name":"rate","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_burner","type":"address"},{"name":"_amount","type":"uint256"}],"name":"burn","outputs":[{"name":"success","type":"bool"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"uuid","outputs":[{"name":"getUuid","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"conversionRateDecimals","outputs":[{"name":"rateDecimal","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"}] \ No newline at end of file diff --git a/contracts/abi/Workers.abi b/contracts/abi/Workers.abi deleted file mode 100644 index edc1bf8..0000000 --- a/contracts/abi/Workers.abi +++ /dev/null @@ -1 +0,0 @@ -[{"constant":false,"inputs":[{"name":"_adminAddress","type":"address"}],"name":"setAdminAddress","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"workers","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_opsAddress","type":"address"}],"name":"setOpsAddress","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"opsAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"remove","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_worker","type":"address"}],"name":"isWorker","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_proposedOwner","type":"address"}],"name":"initiateOwnershipTransfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_worker","type":"address"}],"name":"removeWorker","outputs":[{"name":"existed","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"proposedOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"completeOwnershipTransfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_worker","type":"address"},{"name":"_deactivationHeight","type":"uint256"}],"name":"setWorker","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"adminAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_worker","type":"address"},{"indexed":true,"name":"_deactivationHeight","type":"uint256"},{"indexed":false,"name":"_remainingHeight","type":"uint256"}],"name":"WorkerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_worker","type":"address"},{"indexed":false,"name":"_existed","type":"bool"}],"name":"WorkerRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_newAddress","type":"address"}],"name":"AdminAddressChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_newAddress","type":"address"}],"name":"OpsAddressChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_proposedOwner","type":"address"}],"name":"OwnershipTransferInitiated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_newOwner","type":"address"}],"name":"OwnershipTransferCompleted","type":"event"}] \ No newline at end of file diff --git a/contracts/bin/Airdrop.bin b/contracts/bin/Airdrop.bin deleted file mode 100644 index 70465ec..0000000 --- a/contracts/bin/Airdrop.bin +++ /dev/null @@ -1 +0,0 @@ -60806040523480156200001157600080fd5b50604051608080620017ed833981016040908152815160208301519183015160609093015160008054600160a060020a03191633600160a060020a039081169190911790915591939184908490821615156200006c57600080fd5b7fffffff0000000000000000000000000000000000000000000000000000000000811615156200009b57600080fd5b60048054600160a060020a031916600160a060020a03848116919091178083556007805462ffffff19167d0100000000000000000000000000000000000000000000000000000000008604179055604080517f313ce5670000000000000000000000000000000000000000000000000000000081529051919092169263313ce567928082019260209290918290030181600087803b1580156200013d57600080fd5b505af115801562000152573d6000803e3d6000fd5b505050506040513d60208110156200016957600080fd5b50516007805460ff90921663010000000263ff00000019909216919091179055604080517f7ffdf53e0000000000000000000000000000000000000000000000000000000081529051600160a060020a03841691637ffdf53e9160048083019260209291908290030181600087803b158015620001e557600080fd5b505af1158015620001fa573d6000803e3d6000fd5b505050506040513d60208110156200021157600080fd5b5051600855604080517fe30ac6c30000000000000000000000000000000000000000000000000000000081529051600160a060020a0384169163e30ac6c39160048083019260209291908290030181600087803b1580156200027257600080fd5b505af115801562000287573d6000803e3d6000fd5b505050506040513d60208110156200029e57600080fd5b50516009805460ff191660ff9092169190911790555050600160a060020a0382161515620002cb57600080fd5b600160a060020a0381161515620002e157600080fd5b6009805461010060a860020a031916610100600160a060020a0394851602179055600a8054600160a060020a03191691909216179055506114c39050806200032a6000396000f30060806040526004361061012f5763ffffffff60e060020a60003504166310f6fa4781146101345780632c1e816d14610165578063313ce5671461019a5780634a9569c5146101c5578063707789c5146101f95780637307453a1461021a5780637ffdf53e1461023c57806383121455146102515780638da5cb5b146102735780638ea643761461028857806392a85fde1461029d578063a1543600146102cf578063a7f4377914610315578063ae20a9ae1461032c578063b2b802c81461038f578063bbd30f10146103cd578063bd90bc30146103ef578063c0b6f56114610414578063cabb62f014610435578063d153b60c1461044a578063d348050c1461045f578063e30ac6c314610474578063e71a781114610489578063f3443dd21461049e578063fc6f9468146104cc575b600080fd5b34801561014057600080fd5b506101496104e1565b60408051600160a060020a039092168252519081900360200190f35b34801561017157600080fd5b50610186600160a060020a03600435166104f0565b604080519115158252519081900360200190f35b3480156101a657600080fd5b506101af6105c0565b6040805160ff9092168252519081900360200190f35b3480156101d157600080fd5b506101e7600160e860020a0319600435166105d0565b60408051918252519081900360200190f35b34801561020557600080fd5b50610186600160a060020a03600435166105ec565b34801561022657600080fd5b50610186600160e860020a0319600435166106bc565b34801561024857600080fd5b506101e7610762565b34801561025d57600080fd5b50610149600160e860020a031960043516610768565b34801561027f57600080fd5b5061014961078d565b34801561029457600080fd5b5061014961079c565b3480156102a957600080fd5b506102b26107ab565b60408051600160e860020a03199092168252519081900360200190f35b3480156102db57600080fd5b506102f7600435602435600160e860020a0319604435166107d1565b60408051938452602084019290925282820152519081900360600190f35b34801561032157600080fd5b5061032a61081c565b005b34801561033857600080fd5b50610376600160a060020a036004358116906024359060443581169060643590600160e860020a0319608435169060a4359060c4351660e43561087f565b6040805192835260208301919091528051918290030190f35b34801561039b57600080fd5b506101e7600160a060020a036004358116906024359060443516606435600160e860020a03196084351660a435610a4c565b3480156103d957600080fd5b506101e7600160e860020a031960043516610b29565b3480156103fb57600080fd5b50610186600160e860020a031960043516602435610bc9565b34801561042057600080fd5b50610186600160a060020a0360043516610c39565b34801561044157600080fd5b50610149610cab565b34801561045657600080fd5b50610149610cbf565b34801561046b57600080fd5b50610149610cce565b34801561048057600080fd5b506101af610cdd565b34801561049557600080fd5b50610186610ce6565b3480156104aa57600080fd5b50610186600160e860020a031960043516600160a060020a0360243516610d6d565b3480156104d857600080fd5b50610149610fea565b600a54600160a060020a031681565b60006104fb33610ff9565b8061050a575061050a3361100d565b151561051557600080fd5b600054600160a060020a038381169116141561053057600080fd5b30600160a060020a031682600160a060020a03161415151561055157600080fd5b61055a8261103d565b1561056457600080fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384169081179091556040517f17bb0532ac84902a52bb6799529153f5ea501fc54fbcf3ea00dbd42bceb6b0f490600090a2506001919050565b6007546301000000900460ff1690565b600160e860020a03191660009081526005602052604090205490565b60006105f733610ff9565b8061060657506106063361100d565b151561061157600080fd5b600054600160a060020a038381169116141561062c57600080fd5b30600160a060020a031682600160a060020a03161415151561064d57600080fd5b6106568261100d565b1561066057600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384169081179091556040517fac46a4511b8366ae3b7cf3cf342e31556274975598dcae03c866f8f0f55d51c490600090a2506001919050565b60006106c73361103d565b15156106d257600080fd5b600160e860020a03198216600090815260066020526040902054600160a060020a0316151561070057600080fd5b600160e860020a03198216600081815260066020526040808220805473ffffffffffffffffffffffffffffffffffffffff19169055517f8bee55d48a68222fe9f1ee5b03929f037c08911acfe96caa89dcfe3fc1e953589190a2506001919050565b60085490565b600160e860020a031916600090815260066020526040902054600160a060020a031690565b600054600160a060020a031681565b600254600160a060020a031681565b6007547d0100000000000000000000000000000000000000000000000000000000000290565b60008080600160e860020a0319841615156107eb57600080fd5b6107f484610b29565b92506000831161080357600080fd5b61080e83878761106a565b909250905093509350939050565b6108253361100d565b8061083457506108343361103d565b151561083f57600080fd5b604051600160a060020a033316907f066a905b79c0121afe61e3a44e0b14b6bc1ec16d854cdba09efdfc9b6aa9af8190600090a233600160a060020a0316ff5b600080600080600080600960019054906101000a9004600160a060020a0316600160a060020a031663aa156645336040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b1580156108f857600080fd5b505af115801561090c573d6000803e3d6000fd5b505050506040513d602081101561092257600080fd5b5051151561092f57600080fd5b600160a060020a038816151561094457600080fd5b6109508e8e8e8e6110ed565b151561095b57600080fd5b8c93508a9250889150600160e860020a03198a1615610988576109808a8a8f8e611139565b909550935091505b61099488888686611196565b90506109a3888f868f8761126f565b15156109ae57600080fd5b87600160a060020a03168c600160a060020a03168f600160a060020a03167f12889b9f6a87492224e4fd8e6dbdb4618b3f564708185c493b152215ee961f5d87878f88886040518086815260200185815260200184600160e860020a031916600160e860020a03191681526020018381526020018281526020019550505050505060405180910390a4919092019c909b509950505050505050505050565b600080600080610a5e8a8a8a8a6110ed565b1515610a6957600080fd5b5087915085905083600160e860020a0319861615610a9557610a8d86868b8a611139565b909450925090505b610aa2338b858b8661126f565b1515610aad57600080fd5b60408051600160a060020a03808d168252602082018690528a168183015260608101849052600160e860020a03198816608082015260a0810187905260c0810183905290517f51e16b543c5bb3c6005bcb22b4b577f1567710d0f828897168bf3f1e9ad36a3f9181900360e00190a15001979650505050505050565b600160e860020a03198116600090815260066020526040812054600160a060020a0316801515610b5857600080fd5b80600160a060020a03166398d5fdca6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610b9657600080fd5b505af1158015610baa573d6000803e3d6000fd5b505050506040513d6020811015610bc057600080fd5b50519392505050565b6000610bd43361103d565b1515610bdf57600080fd5b600160e860020a03198316600081815260056020908152604091829020859055815185815291517f058ed7b764a1a386e76b3cbca5e1d213a98664cb17e47628ed1bb3047f5039929281900390910190a250600192915050565b6000610c4433610ff9565b1515610c4f57600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384169081179091556040517f20f5afdf40bf7b43c89031a5d4369a30b159e512d164aa46124bcb706b4a1caf90600090a2506001919050565b6009546101009004600160a060020a031681565b600154600160a060020a031681565b600454600160a060020a031690565b60095460ff1690565b60015460009033600160a060020a03908116911614610d0457600080fd5b6001805460008054600160a060020a0380841673ffffffffffffffffffffffffffffffffffffffff19928316178084559190931690935560405192909116917f624adc4c72536289dd9d5439ccdeccd8923cb9af95fb626b21935447c77b84079190a250600190565b6000610d783361103d565b1515610d8357600080fd5b600160a060020a0382161515610d9857600080fd5b600160e860020a031983161515610dae57600080fd5b600760009054906101000a90047d01000000000000000000000000000000000000000000000000000000000002600160e860020a03191682600160a060020a03166392a85fde6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610e2357600080fd5b505af1158015610e37573d6000803e3d6000fd5b505050506040513d6020811015610e4d57600080fd5b5051600160e860020a03191614610e6357600080fd5b82600160e860020a03191682600160a060020a03166382564bca6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610eac57600080fd5b505af1158015610ec0573d6000803e3d6000fd5b505050506040513d6020811015610ed657600080fd5b5051600160e860020a03191614610eec57600080fd5b600760039054906101000a900460ff1660ff1682600160a060020a031663313ce5676040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610f3d57600080fd5b505af1158015610f51573d6000803e3d6000fd5b505050506040513d6020811015610f6757600080fd5b505160ff1614610f7657600080fd5b600160e860020a03198316600081815260066020526040808220805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03871690811790915590519092917f7d3ca855476824d6b0058a0c46e19e7275ce11bbe83bb82418ecf3a94e09c0d191a350600192915050565b600354600160a060020a031681565b600054600160a060020a0390811691161490565b600354600090600160a060020a0316158015906110375750600354600160a060020a038381169116145b92915050565b600254600090600160a060020a031615801590611037575050600254600160a060020a0390811691161490565b60095460075460085460009283928392839283926110b29260ff928316600a90810a936110a6936301000000900416900a63ffffffff6113ef16565b9063ffffffff61141a16565b92506110c8886110a6898663ffffffff6113ef16565b91506110de886110a6888663ffffffff6113ef16565b91989197509095505050505050565b6000600160a060020a038516151561110457600080fd5b83151561111057600080fd5b600082111561112e57600160a060020a038316151561112e57600080fd5b506001949350505050565b60008060008060008061114b8a610b29565b92506000831161115a57600080fd5b61116d89846111688d6105d0565b611431565b151561117857600080fd5b61118383898961106a565b939b909a50929850919650505050505050565b82828201818110156111a6578091505b6000821115611266576111b7610cce565b600a54604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152898316602482015260448101869052905192909116916323b872dd916064808201926020929091908290030181600087803b15801561122f57600080fd5b505af1158015611243573d6000803e3d6000fd5b505050506040513d602081101561125957600080fd5b5051151561126657600080fd5b50949350505050565b60048054604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a03898116948201949094528784166024820152604481018790529051600093909216916323b872dd9160648082019260209290919082900301818787803b1580156112eb57600080fd5b505af11580156112ff573d6000803e3d6000fd5b505050506040513d602081101561131557600080fd5b5051151561132257600080fd5b600160a060020a038316156113e35760048054604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a038a811694820194909452868416602482015260448101869052905192909116916323b872dd916064808201926020929091908290030181600087803b1580156113ac57600080fd5b505af11580156113c0573d6000803e3d6000fd5b505050506040513d60208110156113d657600080fd5b505115156113e357600080fd5b50600195945050505050565b600082820283158061140b575082848281151561140857fe5b04145b151561141357fe5b9392505050565b600080828481151561142857fe5b04949350505050565b60006001828510611452578361144d868563ffffffff61147616565b111590505b801561146e57611468858463ffffffff61148816565b84111590505b949350505050565b60008282111561148257fe5b50900390565b60008282018381101561141357fe00a165627a7a72305820422b0e880a6661db9497e450a919860034ca79006efb5256c9c0e4cd548f66f50029 \ No newline at end of file diff --git a/contracts/bin/EIP20Interface.bin b/contracts/bin/EIP20Interface.bin deleted file mode 100644 index e69de29..0000000 diff --git a/contracts/bin/EIP20Token.bin b/contracts/bin/EIP20Token.bin deleted file mode 100644 index e69de29..0000000 diff --git a/contracts/bin/EIP20TokenMock.bin b/contracts/bin/EIP20TokenMock.bin deleted file mode 100644 index 7707622..0000000 --- a/contracts/bin/EIP20TokenMock.bin +++ /dev/null @@ -1 +0,0 @@ -608060405234801561001057600080fd5b506040516108503803806108508339810160409081528151602080840151928401516060850151608086015191860180519496909491019284918491849161005e91600191908601906100a7565b5081516100729060009060208501906100a7565b506002805460ff1990811660ff9384161790915560059890985560068054909816961695909517909555506101429350505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100e857805160ff1916838001178555610115565b82800160010185558215610115579182015b828111156101155782518255916020019190600101906100fa565b50610121929150610125565b5090565b61013f91905b80821115610121576000815560010161012b565b90565b6106ff806101516000396000f3006080604052600436106100c45763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100c9578063095ea7b31461015357806318160ddd1461018b57806323b872dd146101b2578063313ce567146101dc57806357f3c8971461020757806370a082311461021f5780637ffdf53e1461024057806395d89b4114610255578063a9059cbb1461026a578063dd62ed3e1461028e578063e30443bc146102b5578063e30ac6c3146102d9575b600080fd5b3480156100d557600080fd5b506100de6102ee565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610118578181015183820152602001610100565b50505050905090810190601f1680156101455780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015f57600080fd5b50610177600160a060020a0360043516602435610384565b604080519115158252519081900360200190f35b34801561019757600080fd5b506101a06103ee565b60408051918252519081900360200190f35b3480156101be57600080fd5b50610177600160a060020a03600435811690602435166044356103f3565b3480156101e857600080fd5b506101f1610506565b6040805160ff9092168252519081900360200190f35b34801561021357600080fd5b5061017760043561050f565b34801561022b57600080fd5b506101a0600160a060020a0360043516610517565b34801561024c57600080fd5b506101a0610532565b34801561026157600080fd5b506100de610538565b34801561027657600080fd5b50610177600160a060020a0360043516602435610598565b34801561029a57600080fd5b506101a0600160a060020a0360043581169060243516610657565b3480156102c157600080fd5b50610177600160a060020a0360043516602435610682565b3480156102e557600080fd5b506101f16106a2565b60008054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561037a5780601f1061034f5761010080835404028352916020019161037a565b820191906000526020600020905b81548152906001019060200180831161035d57829003601f168201915b5050505050905090565b600160a060020a03338116600081815260046020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b600090565b600160a060020a03831660009081526003602052604081205461041c908363ffffffff6106ab16565b600160a060020a038086166000908152600360209081526040808320949094556004815283822033909316825291909152205461045f908363ffffffff6106ab16565b600160a060020a03808616600090815260046020908152604080832033851684528252808320949094559186168152600390915220546104a5908363ffffffff6106bd16565b600160a060020a0380851660008181526003602090815260409182902094909455805186815290519193928816927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35060019392505050565b60025460ff1690565b600555600190565b600160a060020a031660009081526003602052604090205490565b60055481565b60018054604080516020601f6002600019610100878916150201909516949094049384018190048102820181019092528281526060939092909183018282801561037a5780601f1061034f5761010080835404028352916020019161037a565b600160a060020a0333166000908152600360205260408120546105c1908363ffffffff6106ab16565b600160a060020a0333811660009081526003602052604080822093909355908516815220546105f6908363ffffffff6106bd16565b600160a060020a038085166000818152600360209081526040918290209490945580518681529051919333909316927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a350600192915050565b600160a060020a03918216600090815260046020908152604080832093909416825291909152205490565b600160a060020a0391909116600090815260036020526040902055600190565b60065460ff1681565b6000828211156106b757fe5b50900390565b6000828201838110156106cc57fe5b93925050505600a165627a7a72305820e7bd40ebd246a69787db0f60ea611d6732d82010b099f409b4ab62d90e32e4970029 \ No newline at end of file diff --git a/contracts/bin/OpsManaged.bin b/contracts/bin/OpsManaged.bin deleted file mode 100644 index b6df26c..0000000 --- a/contracts/bin/OpsManaged.bin +++ /dev/null @@ -1 +0,0 @@ -608060405234801561001057600080fd5b5060008054600160a060020a033316600160a060020a03199091161790556105008061003d6000396000f30060806040526004361061008d5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416632c1e816d8114610092578063707789c5146100c75780638da5cb5b146100e85780638ea6437614610119578063c0b6f5611461012e578063d153b60c1461014f578063e71a781114610164578063fc6f946814610179575b600080fd5b34801561009e57600080fd5b506100b3600160a060020a036004351661018e565b604080519115158252519081900360200190f35b3480156100d357600080fd5b506100b3600160a060020a036004351661025e565b3480156100f457600080fd5b506100fd61032e565b60408051600160a060020a039092168252519081900360200190f35b34801561012557600080fd5b506100fd61033d565b34801561013a57600080fd5b506100b3600160a060020a036004351661034c565b34801561015b57600080fd5b506100fd6103be565b34801561017057600080fd5b506100b36103cd565b34801561018557600080fd5b506100fd610454565b600061019933610463565b806101a857506101a833610477565b15156101b357600080fd5b600054600160a060020a03838116911614156101ce57600080fd5b30600160a060020a031682600160a060020a0316141515156101ef57600080fd5b6101f8826104a7565b1561020257600080fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384169081179091556040517f17bb0532ac84902a52bb6799529153f5ea501fc54fbcf3ea00dbd42bceb6b0f490600090a2506001919050565b600061026933610463565b80610278575061027833610477565b151561028357600080fd5b600054600160a060020a038381169116141561029e57600080fd5b30600160a060020a031682600160a060020a0316141515156102bf57600080fd5b6102c882610477565b156102d257600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384169081179091556040517fac46a4511b8366ae3b7cf3cf342e31556274975598dcae03c866f8f0f55d51c490600090a2506001919050565b600054600160a060020a031681565b600254600160a060020a031681565b600061035733610463565b151561036257600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384169081179091556040517f20f5afdf40bf7b43c89031a5d4369a30b159e512d164aa46124bcb706b4a1caf90600090a2506001919050565b600154600160a060020a031681565b60015460009033600160a060020a039081169116146103eb57600080fd5b6001805460008054600160a060020a0380841673ffffffffffffffffffffffffffffffffffffffff19928316178084559190931690935560405192909116917f624adc4c72536289dd9d5439ccdeccd8923cb9af95fb626b21935447c77b84079190a250600190565b600354600160a060020a031681565b600054600160a060020a0390811691161490565b600354600090600160a060020a0316158015906104a15750600354600160a060020a038381169116145b92915050565b600254600090600160a060020a0316158015906104a1575050600254600160a060020a03908116911614905600a165627a7a723058208eee66f60cfe198ac1e1b9817295d106448bb086506065bb67fbed1123b05d110029 \ No newline at end of file diff --git a/contracts/bin/Owned.bin b/contracts/bin/Owned.bin deleted file mode 100644 index 576b26e..0000000 --- a/contracts/bin/Owned.bin +++ /dev/null @@ -1 +0,0 @@ -608060405234801561001057600080fd5b5060008054600160a060020a033316600160a060020a031990911617905561024d8061003d6000396000f3006080604052600436106100615763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416638da5cb5b8114610066578063c0b6f56114610097578063d153b60c146100cc578063e71a7811146100e1575b600080fd5b34801561007257600080fd5b5061007b6100f6565b60408051600160a060020a039092168252519081900360200190f35b3480156100a357600080fd5b506100b8600160a060020a0360043516610105565b604080519115158252519081900360200190f35b3480156100d857600080fd5b5061007b610177565b3480156100ed57600080fd5b506100b8610186565b600054600160a060020a031681565b60006101103361020d565b151561011b57600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384169081179091556040517f20f5afdf40bf7b43c89031a5d4369a30b159e512d164aa46124bcb706b4a1caf90600090a2506001919050565b600154600160a060020a031681565b60015460009033600160a060020a039081169116146101a457600080fd5b6001805460008054600160a060020a0380841673ffffffffffffffffffffffffffffffffffffffff19928316178084559190931690935560405192909116917f624adc4c72536289dd9d5439ccdeccd8923cb9af95fb626b21935447c77b84079190a250600190565b600054600160a060020a03908116911614905600a165627a7a72305820d77c51e6d8aac50bde1dc8c1f8eaed0cb054ab9cbb968c8344a571c9cfb506180029 \ No newline at end of file diff --git a/contracts/bin/PriceOracle.bin b/contracts/bin/PriceOracle.bin deleted file mode 100644 index 1ec6c0a..0000000 --- a/contracts/bin/PriceOracle.bin +++ /dev/null @@ -1 +0,0 @@ -6060604052341561000f57600080fd5b6040516040806107e2833981016040528080519190602001805160008054600160a060020a03191633600160a060020a03161790559150507fffffff0000000000000000000000000000000000000000000000000000000000808216908316141561007957600080fd5b6006805465ffffff000000191663010000007d01000000000000000000000000000000000000000000000000000000000093849004021762ffffff191691909204179055610716806100cc6000396000f3006060604052600436106100da5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416632c1e816d81146100df578063313ce56714610112578063562e58011461013b578063707789c51461016057806382564bca1461017f5780638da5cb5b146101c75780638ea64376146101f657806391b7f5ed1461020957806392a85fde1461021f57806398d5fdca14610232578063a05e7d0914610245578063c0b6f56114610258578063d153b60c14610277578063e71a78111461028a578063fc6f94681461029d575b600080fd5b34156100ea57600080fd5b6100fe600160a060020a03600435166102b0565b604051901515815260200160405180910390f35b341561011d57600080fd5b610125610383565b60405160ff909116815260200160405180910390f35b341561014657600080fd5b61014e610388565b60405190815260200160405180910390f35b341561016b57600080fd5b6100fe600160a060020a036004351661038e565b341561018a57600080fd5b610192610461565b6040517fffffff0000000000000000000000000000000000000000000000000000000000909116815260200160405180910390f35b34156101d257600080fd5b6101da61048e565b604051600160a060020a03909116815260200160405180910390f35b341561020157600080fd5b6101da61049d565b341561021457600080fd5b61014e6004356104ac565b341561022a57600080fd5b610192610518565b341561023d57600080fd5b61014e61053e565b341561025057600080fd5b61014e610559565b341561026357600080fd5b6100fe600160a060020a036004351661055f565b341561028257600080fd5b6101da6105d4565b341561029557600080fd5b6100fe6105e3565b34156102a857600080fd5b6101da61066a565b60006102bb33610679565b806102ca57506102ca3361068d565b15156102d557600080fd5b600054600160a060020a03838116911614156102f057600080fd5b30600160a060020a031682600160a060020a03161415151561031157600080fd5b61031a826106bd565b1561032457600080fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384169081179091557f17bb0532ac84902a52bb6799529153f5ea501fc54fbcf3ea00dbd42bceb6b0f460405160405180910390a2506001919050565b601290565b61465090565b600061039933610679565b806103a857506103a83361068d565b15156103b357600080fd5b600054600160a060020a03838116911614156103ce57600080fd5b30600160a060020a031682600160a060020a0316141515156103ef57600080fd5b6103f88261068d565b1561040257600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384169081179091557fac46a4511b8366ae3b7cf3cf342e31556274975598dcae03c866f8f0f55d51c460405160405180910390a2506001919050565b600654630100000090047d0100000000000000000000000000000000000000000000000000000000000290565b600054600160a060020a031681565b600254600160a060020a031681565b60006104b7336106bd565b15156104c257600080fd5b600082116104cf57600080fd5b60048290556104dc610388565b43016005819055827f945c1c4e99aa89f648fbfe3df471b916f719e16d960fcec0737d4d56bd69683860405160405180910390a3505060055490565b6006547d0100000000000000000000000000000000000000000000000000000000000290565b6000600554431161055157600454610554565b60005b905090565b60055490565b600061056a33610679565b151561057557600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384169081179091557f20f5afdf40bf7b43c89031a5d4369a30b159e512d164aa46124bcb706b4a1caf60405160405180910390a2506001919050565b600154600160a060020a031681565b60015460009033600160a060020a0390811691161461060157600080fd5b6001805460008054600160a060020a0380841673ffffffffffffffffffffffffffffffffffffffff1992831617928390559216909255167f624adc4c72536289dd9d5439ccdeccd8923cb9af95fb626b21935447c77b840760405160405180910390a250600190565b600354600160a060020a031681565b600054600160a060020a0390811691161490565b600354600090600160a060020a0316158015906106b75750600354600160a060020a038381169116145b92915050565b600254600090600160a060020a0316158015906106b7575050600254600160a060020a03908116911614905600a165627a7a72305820005c6b165fb4a58e076ec5c1e11ad661d645033a0e467fa5c2149d677d01c8e00029 \ No newline at end of file diff --git a/contracts/bin/PriceOracleInterface.bin b/contracts/bin/PriceOracleInterface.bin deleted file mode 100644 index e69de29..0000000 diff --git a/contracts/bin/PriceOracleMock.bin b/contracts/bin/PriceOracleMock.bin deleted file mode 100644 index 89a120d..0000000 --- a/contracts/bin/PriceOracleMock.bin +++ /dev/null @@ -1 +0,0 @@ -608060405234801561001057600080fd5b5060405160608061025d8339810160409081528151602083015191909201516001805465ffffff000000191663010000007d01000000000000000000000000000000000000000000000000000000000094859004021762ffffff1916929093049190911790915560009081556101d190819061008c90396000f3006080604052600436106100775763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663313ce567811461007c578063562e5801146100a757806382564bca146100ce57806392a85fde1461011857806398d5fdca1461012d578063a05e7d09146100a7575b600080fd5b34801561008857600080fd5b50610091610142565b6040805160ff9092168252519081900360200190f35b3480156100b357600080fd5b506100bc610147565b60408051918252519081900360200190f35b3480156100da57600080fd5b506100e361014c565b604080517fffffff00000000000000000000000000000000000000000000000000000000009092168252519081900360200190f35b34801561012457600080fd5b506100e3610179565b34801561013957600080fd5b506100bc61019f565b601290565b600090565b600154630100000090047d0100000000000000000000000000000000000000000000000000000000000290565b6001547d0100000000000000000000000000000000000000000000000000000000000290565b600054905600a165627a7a7230582078799a045b6b4b51424e6349f566d70d3c128ab5fab5ed92edf9ee6d41c17a980029 \ No newline at end of file diff --git a/contracts/bin/Pricer.bin b/contracts/bin/Pricer.bin deleted file mode 100644 index 02816ae..0000000 --- a/contracts/bin/Pricer.bin +++ /dev/null @@ -1 +0,0 @@ -608060405234801561001057600080fd5b5060405160408061141e83398101604052805160209091015160008054600160a060020a03191633600160a060020a03908116919091179091558216151561005757600080fd5b7fffffff00000000000000000000000000000000000000000000000000000000008116151561008557600080fd5b60048054600160a060020a031916600160a060020a03848116919091178083556007805462ffffff19167d0100000000000000000000000000000000000000000000000000000000008604179055604080517f313ce5670000000000000000000000000000000000000000000000000000000081529051919092169263313ce567928082019260209290918290030181600087803b15801561012657600080fd5b505af115801561013a573d6000803e3d6000fd5b505050506040513d602081101561015057600080fd5b50516007805460ff90921663010000000263ff00000019909216919091179055604080517f7ffdf53e0000000000000000000000000000000000000000000000000000000081529051600160a060020a03841691637ffdf53e9160048083019260209291908290030181600087803b1580156101cb57600080fd5b505af11580156101df573d6000803e3d6000fd5b505050506040513d60208110156101f557600080fd5b5051600855604080517fe30ac6c30000000000000000000000000000000000000000000000000000000081529051600160a060020a0384169163e30ac6c39160048083019260209291908290030181600087803b15801561025557600080fd5b505af1158015610269573d6000803e3d6000fd5b505050506040513d602081101561027f57600080fd5b50516009805460ff191660ff909216919091179055506111789050806102a66000396000f30060806040526004361061010e5763ffffffff60e060020a6000350416632c1e816d8114610113578063313ce567146101485780634a9569c514610173578063707789c5146101a75780637307453a146101c85780637ffdf53e146101ea57806383121455146101ff5780638da5cb5b1461023d5780638ea643761461025257806392a85fde14610267578063a154360014610299578063a7f43779146102df578063b2b802c8146102f6578063bbd30f1014610334578063bd90bc3014610356578063c0b6f5611461037b578063d153b60c1461039c578063d348050c146103b1578063e30ac6c3146103c6578063e71a7811146103db578063f3443dd2146103f0578063fc6f94681461041e575b600080fd5b34801561011f57600080fd5b50610134600160a060020a0360043516610433565b604080519115158252519081900360200190f35b34801561015457600080fd5b5061015d610503565b6040805160ff9092168252519081900360200190f35b34801561017f57600080fd5b50610195600160e860020a031960043516610513565b60408051918252519081900360200190f35b3480156101b357600080fd5b50610134600160a060020a036004351661052f565b3480156101d457600080fd5b50610134600160e860020a0319600435166105ff565b3480156101f657600080fd5b506101956106a5565b34801561020b57600080fd5b50610221600160e860020a0319600435166106ab565b60408051600160a060020a039092168252519081900360200190f35b34801561024957600080fd5b506102216106d0565b34801561025e57600080fd5b506102216106df565b34801561027357600080fd5b5061027c6106ee565b60408051600160e860020a03199092168252519081900360200190f35b3480156102a557600080fd5b506102c1600435602435600160e860020a031960443516610714565b60408051938452602084019290925282820152519081900360600190f35b3480156102eb57600080fd5b506102f461075f565b005b34801561030257600080fd5b50610195600160a060020a036004358116906024359060443516606435600160e860020a03196084351660a4356107c2565b34801561034057600080fd5b50610195600160e860020a03196004351661089f565b34801561036257600080fd5b50610134600160e860020a03196004351660243561093f565b34801561038757600080fd5b50610134600160a060020a03600435166109af565b3480156103a857600080fd5b50610221610a21565b3480156103bd57600080fd5b50610221610a30565b3480156103d257600080fd5b5061015d610a3f565b3480156103e757600080fd5b50610134610a48565b3480156103fc57600080fd5b50610134600160e860020a031960043516600160a060020a0360243516610acf565b34801561042a57600080fd5b50610221610d78565b600061043e33610d87565b8061044d575061044d33610d9b565b151561045857600080fd5b600054600160a060020a038381169116141561047357600080fd5b30600160a060020a031682600160a060020a03161415151561049457600080fd5b61049d82610dcb565b156104a757600080fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384169081179091556040517f17bb0532ac84902a52bb6799529153f5ea501fc54fbcf3ea00dbd42bceb6b0f490600090a2506001919050565b6007546301000000900460ff1690565b600160e860020a03191660009081526005602052604090205490565b600061053a33610d87565b80610549575061054933610d9b565b151561055457600080fd5b600054600160a060020a038381169116141561056f57600080fd5b30600160a060020a031682600160a060020a03161415151561059057600080fd5b61059982610d9b565b156105a357600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384169081179091556040517fac46a4511b8366ae3b7cf3cf342e31556274975598dcae03c866f8f0f55d51c490600090a2506001919050565b600061060a33610dcb565b151561061557600080fd5b600160e860020a03198216600090815260066020526040902054600160a060020a0316151561064357600080fd5b600160e860020a03198216600081815260066020526040808220805473ffffffffffffffffffffffffffffffffffffffff19169055517f8bee55d48a68222fe9f1ee5b03929f037c08911acfe96caa89dcfe3fc1e953589190a2506001919050565b60085490565b600160e860020a031916600090815260066020526040902054600160a060020a031690565b600054600160a060020a031681565b600254600160a060020a031681565b6007547d0100000000000000000000000000000000000000000000000000000000000290565b60008080600160e860020a03198416151561072e57600080fd5b6107378461089f565b92506000831161074657600080fd5b610751838787610df8565b909250905093509350939050565b61076833610d9b565b80610777575061077733610dcb565b151561078257600080fd5b604051600160a060020a033316907f066a905b79c0121afe61e3a44e0b14b6bc1ec16d854cdba09efdfc9b6aa9af8190600090a233600160a060020a0316ff5b6000806000806107d48a8a8a8a610e7b565b15156107df57600080fd5b5087915085905083600160e860020a031986161561080b5761080386868b8a610ec7565b909450925090505b610818338b858b86610f24565b151561082357600080fd5b60408051600160a060020a03808d168252602082018690528a168183015260608101849052600160e860020a03198816608082015260a0810187905260c0810183905290517f51e16b543c5bb3c6005bcb22b4b577f1567710d0f828897168bf3f1e9ad36a3f9181900360e00190a15001979650505050505050565b600160e860020a03198116600090815260066020526040812054600160a060020a03168015156108ce57600080fd5b80600160a060020a03166398d5fdca6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561090c57600080fd5b505af1158015610920573d6000803e3d6000fd5b505050506040513d602081101561093657600080fd5b50519392505050565b600061094a33610dcb565b151561095557600080fd5b600160e860020a03198316600081815260056020908152604091829020859055815185815291517f058ed7b764a1a386e76b3cbca5e1d213a98664cb17e47628ed1bb3047f5039929281900390910190a250600192915050565b60006109ba33610d87565b15156109c557600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384169081179091556040517f20f5afdf40bf7b43c89031a5d4369a30b159e512d164aa46124bcb706b4a1caf90600090a2506001919050565b600154600160a060020a031681565b600454600160a060020a031690565b60095460ff1690565b60015460009033600160a060020a03908116911614610a6657600080fd5b6001805460008054600160a060020a0380841673ffffffffffffffffffffffffffffffffffffffff19928316178084559190931690935560405192909116917f624adc4c72536289dd9d5439ccdeccd8923cb9af95fb626b21935447c77b84079190a250600190565b6000610ada33610dcb565b1515610ae557600080fd5b600160a060020a0382161515610afa57600080fd5b600160e860020a031983161515610b1057600080fd5b600760009054906101000a90047d010000000000000000000000000000000000000000000000000000000000027cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191682600160a060020a03166392a85fde6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610b9b57600080fd5b505af1158015610baf573d6000803e3d6000fd5b505050506040513d6020811015610bc557600080fd5b5051600160e860020a03191614610bdb57600080fd5b827cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191682600160a060020a03166382564bca6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610c3a57600080fd5b505af1158015610c4e573d6000803e3d6000fd5b505050506040513d6020811015610c6457600080fd5b5051600160e860020a03191614610c7a57600080fd5b600760039054906101000a900460ff1660ff1682600160a060020a031663313ce5676040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610ccb57600080fd5b505af1158015610cdf573d6000803e3d6000fd5b505050506040513d6020811015610cf557600080fd5b505160ff1614610d0457600080fd5b600160e860020a03198316600081815260066020526040808220805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03871690811790915590519092917f7d3ca855476824d6b0058a0c46e19e7275ce11bbe83bb82418ecf3a94e09c0d191a350600192915050565b600354600160a060020a031681565b600054600160a060020a0390811691161490565b600354600090600160a060020a031615801590610dc55750600354600160a060020a038381169116145b92915050565b600254600090600160a060020a031615801590610dc5575050600254600160a060020a0390811691161490565b6009546007546008546000928392839283928392610e409260ff928316600a90810a93610e34936301000000900416900a63ffffffff6110a416565b9063ffffffff6110cf16565b9250610e5688610e34898663ffffffff6110a416565b9150610e6c88610e34888663ffffffff6110a416565b91989197509095505050505050565b6000600160a060020a0385161515610e9257600080fd5b831515610e9e57600080fd5b6000821115610ebc57600160a060020a0383161515610ebc57600080fd5b506001949350505050565b600080600080600080610ed98a61089f565b925060008311610ee857600080fd5b610efb8984610ef68d610513565b6110e6565b1515610f0657600080fd5b610f11838989610df8565b939b909a50929850919650505050505050565b60048054604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a03898116948201949094528784166024820152604481018790529051600093909216916323b872dd9160648082019260209290919082900301818787803b158015610fa057600080fd5b505af1158015610fb4573d6000803e3d6000fd5b505050506040513d6020811015610fca57600080fd5b50511515610fd757600080fd5b600160a060020a038316156110985760048054604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a038a811694820194909452868416602482015260448101869052905192909116916323b872dd916064808201926020929091908290030181600087803b15801561106157600080fd5b505af1158015611075573d6000803e3d6000fd5b505050506040513d602081101561108b57600080fd5b5051151561109857600080fd5b50600195945050505050565b60008282028315806110c057508284828115156110bd57fe5b04145b15156110c857fe5b9392505050565b60008082848115156110dd57fe5b04949350505050565b600060018285106111075783611102868563ffffffff61112b16565b111590505b80156111235761111d858463ffffffff61113d16565b84111590505b949350505050565b60008282111561113757fe5b50900390565b6000828201838110156110c857fe00a165627a7a72305820aa0e79d9729860c3ea975c3ca5566b13c5b3aeabc5145d317f0d4a0b48cfd9d80029 \ No newline at end of file diff --git a/contracts/bin/PricerInterface.bin b/contracts/bin/PricerInterface.bin deleted file mode 100644 index e69de29..0000000 diff --git a/contracts/bin/SafeMath.bin b/contracts/bin/SafeMath.bin deleted file mode 100644 index b35addd..0000000 --- a/contracts/bin/SafeMath.bin +++ /dev/null @@ -1 +0,0 @@ -604c602c600b82828239805160001a60731460008114601c57601e565bfe5b5030600052607381538281f30073000000000000000000000000000000000000000030146080604052600080fd00a165627a7a723058203d7cd16523f4631b70b5489d2d1c388d470d5ac1c771ea4b73a0fd8136d15f640029 \ No newline at end of file diff --git a/contracts/bin/UtilityTokenInterface.bin b/contracts/bin/UtilityTokenInterface.bin deleted file mode 100644 index e69de29..0000000 diff --git a/contracts/bin/Workers.bin b/contracts/bin/Workers.bin deleted file mode 100644 index 0537141..0000000 --- a/contracts/bin/Workers.bin +++ /dev/null @@ -1 +0,0 @@ -608060405234801561001057600080fd5b5060008054600160a060020a033316600160a060020a03199091161790556107508061003d6000396000f3006080604052600436106100c45763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416632c1e816d81146100c95780634048a257146100fe578063707789c5146101315780638da5cb5b146101525780638ea6437614610183578063a7f4377914610198578063aa156645146101af578063c0b6f561146101d0578063c4f987a5146101f1578063d153b60c14610212578063e71a781114610227578063ea6790cf1461023c578063fc6f946814610260575b600080fd5b3480156100d557600080fd5b506100ea600160a060020a0360043516610275565b604080519115158252519081900360200190f35b34801561010a57600080fd5b5061011f600160a060020a0360043516610345565b60408051918252519081900360200190f35b34801561013d57600080fd5b506100ea600160a060020a0360043516610357565b34801561015e57600080fd5b50610167610427565b60408051600160a060020a039092168252519081900360200190f35b34801561018f57600080fd5b50610167610436565b3480156101a457600080fd5b506101ad610445565b005b3480156101bb57600080fd5b506100ea600160a060020a0360043516610474565b3480156101dc57600080fd5b506100ea600160a060020a0360043516610492565b3480156101fd57600080fd5b506100ea600160a060020a0360043516610504565b34801561021e57600080fd5b50610167610576565b34801561023357600080fd5b506100ea610585565b34801561024857600080fd5b5061011f600160a060020a036004351660243561060c565b34801561026c57600080fd5b506101676106a4565b6000610280336106b3565b8061028f575061028f336106c7565b151561029a57600080fd5b600054600160a060020a03838116911614156102b557600080fd5b30600160a060020a031682600160a060020a0316141515156102d657600080fd5b6102df826106f7565b156102e957600080fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384169081179091556040517f17bb0532ac84902a52bb6799529153f5ea501fc54fbcf3ea00dbd42bceb6b0f490600090a2506001919050565b60046020526000908152604090205481565b6000610362336106b3565b806103715750610371336106c7565b151561037c57600080fd5b600054600160a060020a038381169116141561039757600080fd5b30600160a060020a031682600160a060020a0316141515156103b857600080fd5b6103c1826106c7565b156103cb57600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384169081179091556040517fac46a4511b8366ae3b7cf3cf342e31556274975598dcae03c866f8f0f55d51c490600090a2506001919050565b600054600160a060020a031681565b600254600160a060020a031681565b61044e336106c7565b8061045d575061045d336106f7565b151561046857600080fd5b33600160a060020a0316ff5b600160a060020a031660009081526004602052604090205443111590565b600061049d336106b3565b15156104a857600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384169081179091556040517f20f5afdf40bf7b43c89031a5d4369a30b159e512d164aa46124bcb706b4a1caf90600090a2506001919050565b600061050f336106f7565b151561051a57600080fd5b50600160a060020a03811660008181526004602090815260408083208054908490558151931080845290519093927fc5917d6d705542e8299632992e81d551fc6e12c5c0dd7ab918b9df7db5555b2b92908290030190a2919050565b600154600160a060020a031681565b60015460009033600160a060020a039081169116146105a357600080fd5b6001805460008054600160a060020a0380841673ffffffffffffffffffffffffffffffffffffffff19928316178084559190931690935560405192909116917f624adc4c72536289dd9d5439ccdeccd8923cb9af95fb626b21935447c77b84079190a250600190565b600080610618336106f7565b151561062357600080fd5b600160a060020a038416151561063857600080fd5b4383101561064557600080fd5b50600160a060020a038316600081815260046020908152604091829020859055815143860380825292519293869390927fc905a4aa20c3ea64a398e2cd342f153389c4c72818b5dbc6fb5e83a628de09a9928290030190a39392505050565b600354600160a060020a031681565b600054600160a060020a0390811691161490565b600354600090600160a060020a0316158015906106f15750600354600160a060020a038381169116145b92915050565b600254600090600160a060020a0316158015906106f1575050600254600160a060020a03908116911614905600a165627a7a7230582000ed02b6cc372037162983a7773d8a8621a8eb6427b805155d2518f972afc9e20029 \ No newline at end of file diff --git a/contracts/openst-protocol/EIP20Token.sol b/contracts/openst-protocol/EIP20Token.sol deleted file mode 100644 index 3766478..0000000 --- a/contracts/openst-protocol/EIP20Token.sol +++ /dev/null @@ -1,132 +0,0 @@ -pragma solidity ^0.4.23; - -// Copyright 2017 OpenST Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ---------------------------------------------------------------------------- -// Utility chain: EIP20 Token Implementation -// -// http://www.simpletoken.org/ -// -// ---------------------------------------------------------------------------- - -import "./EIP20Interface.sol"; -import "../SafeMath.sol"; - -/** - @title EIP20Token - @notice Implements EIP20 token -*/ -contract EIP20Token is EIP20Interface { - using SafeMath for uint256; - - string private tokenName; - string private tokenSymbol; - uint8 private tokenDecimals; - - mapping(address => uint256) balances; - mapping(address => mapping (address => uint256)) allowed; - - - constructor(string _symbol, string _name, uint8 _decimals) public - { - tokenSymbol = _symbol; - tokenName = _name; - tokenDecimals = _decimals; - } - - - function name() public view returns (string) { - return tokenName; - } - - - function symbol() public view returns (string) { - return tokenSymbol; - } - - - function decimals() public view returns (uint8) { - return tokenDecimals; - } - - - function balanceOf(address _owner) public view returns (uint256) { - return balances[_owner]; - } - - - function allowance(address _owner, address _spender) public view returns (uint256 remaining) { - return allowed[_owner][_spender]; - } - - - function transfer(address _to, uint256 _value) public returns (bool success) { - // According to the EIP20 spec, "transfers of 0 values MUST be treated as normal - // transfers and fire the Transfer event". - // Also, should throw if not enough balance. This is taken care of by SafeMath. - balances[msg.sender] = balances[msg.sender].sub(_value); - balances[_to] = balances[_to].add(_value); - - emit Transfer(msg.sender, _to, _value); - - return true; - } - - - function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { - balances[_from] = balances[_from].sub(_value); - allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); - balances[_to] = balances[_to].add(_value); - - emit Transfer(_from, _to, _value); - - return true; - } - - - function approve(address _spender, uint256 _value) public returns (bool success) { - - allowed[msg.sender][_spender] = _value; - - emit Approval(msg.sender, _spender, _value); - - return true; - } - - - function claimEIP20(address _beneficiary, uint256 _amount) internal returns (bool success) { - // claimable tokens are minted in the contract address to be pulled on claim - balances[address(this)] = balances[address(this)].sub(_amount); - balances[_beneficiary] = balances[_beneficiary].add(_amount); - - emit Transfer(address(this), _beneficiary, _amount); - - return true; - } - - - function mintEIP20(uint256 _amount) internal returns (bool /* success */) { - // mint EIP20 tokens in contract address for them to be claimed - balances[address(this)] = balances[address(this)].add(_amount); - - return true; - } - - function burnEIP20(uint256 _amount) internal returns (bool /* success */) { - balances[msg.sender] = balances[msg.sender].sub(_amount); - - return true; - } -} diff --git a/contracts/openst-protocol/UtilityTokenInterface.sol b/contracts/openst-protocol/UtilityTokenInterface.sol deleted file mode 100644 index 5860a07..0000000 --- a/contracts/openst-protocol/UtilityTokenInterface.sol +++ /dev/null @@ -1,43 +0,0 @@ -/* solhint-disable-next-line compiler-fixed */ -pragma solidity ^0.4.23; - -// Copyright 2017 OpenST Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ---------------------------------------------------------------------------- -// Utility chain: UtilityTokenInterface -// -// http://www.simpletoken.org/ -// -// ---------------------------------------------------------------------------- - -contract UtilityTokenInterface { - - /// @dev transfer full claim to beneficiary - function claim(address _beneficiary) public returns (bool success); - /// @dev Mint new utility token into claim for beneficiary - function mint(address _beneficiary, uint256 _amount) public returns (bool success); - /// @dev Burn utility tokens after having redeemed them - /// through the protocol for the staked Simple Token - function burn(address _burner, uint256 _amount) public payable returns (bool success); - - /// @dev Get totalTokenSupply as view so that child cannot edit - function totalSupply() public view returns (uint256 supply); - /// @dev Get unique universal identifier for utility token - function uuid() public view returns (bytes32 getUuid); - /// @dev Get conversion rate for utility token - function conversionRate() public view returns (uint256 rate); - /// @dev Get conversion rate decimal factor for utility token - function conversionRateDecimals() public view returns (uint8 rateDecimal); -} \ No newline at end of file diff --git a/contracts/test/multisigwallet/MultiSigWalletDouble.sol b/contracts/test/multisigwallet/MultiSigWalletDouble.sol new file mode 100644 index 0000000..a5b9c5c --- /dev/null +++ b/contracts/test/multisigwallet/MultiSigWalletDouble.sol @@ -0,0 +1,110 @@ +pragma solidity ^0.4.23; + +// Copyright 2018 OpenST Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ---------------------------------------------------------------------------- +// Utility Chain: MultiSigWallet +// +// http://www.simpletoken.org/ +// +// ---------------------------------------------------------------------------- + +import "../../MultiSigWallet.sol"; + + +/** + * @dev Contract introduces submitFoo() function which behaves like + * other submit* functions (submitAddWallet, etc). + * The foo() function fails based on storage variable which could be + * set/unset. This way the test of transaction execution of + * MultisigWallet could imitate the non-happy-path. + */ +contract MultiSigWalletDouble is MultiSigWallet { + + /* Usings */ + + using SafeMath for uint256; + + + /* Constants */ + + bytes4 constant public FOO_CALLPREFIX = bytes4( + keccak256("foo()") + ); + + + /* Storage */ + + bool fooThrows; + + + /* Special Functions */ + + constructor(address[] _wallets, uint256 _required) + MultiSigWallet(_wallets, _required) + public + { + fooThrows = true; + } + + + /* External Functions */ + + /** + * @dev Submits a foo() function that fails based on storage variable + * fooThrows. Used for testing non-happy path of + * MultisigWallet executeTransaction. + * + * @return Newly created transaction id. + */ + function submitFoo() + external + onlyWallet + returns (uint256 transactionID_) + { + transactionID_ = addTransaction( + address(this), + abi.encodeWithSelector(FOO_CALLPREFIX) + ); + + confirmTransaction(transactionID_); + } + + + /* Public Functions */ + + function makeFooThrow() + public + { + fooThrows = true; + } + + function makeFooNotThrow() + public + { + fooThrows = false; + } + + function foo() + public + view + onlyMultisig + { + if ( fooThrows ) { + revert("Foo is set to throw."); + } + } + +} \ No newline at end of file diff --git a/contracts/test/token_rules/TokenRulesFailingGlobalConstraint.sol b/contracts/test/token_rules/TokenRulesFailingGlobalConstraint.sol new file mode 100644 index 0000000..a30afe2 --- /dev/null +++ b/contracts/test/token_rules/TokenRulesFailingGlobalConstraint.sol @@ -0,0 +1,38 @@ +pragma solidity ^0.4.23; + +// Copyright 2018 OpenST Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import "../../GlobalConstraintInterface.sol"; + +contract TokenRulesFailingGlobalConstraint is GlobalConstraintInterface +{ + /* External Functions */ + + function check( + address _from, + address[] _transfersTo, + uint256[] _transfersAmount + ) + external + view + returns (bool) + { + _from; + _transfersTo; + _transfersAmount; + + return false; + } +} diff --git a/contracts/test/token_rules/TokenRulesPassingGlobalConstraint.sol b/contracts/test/token_rules/TokenRulesPassingGlobalConstraint.sol new file mode 100644 index 0000000..1b659fe --- /dev/null +++ b/contracts/test/token_rules/TokenRulesPassingGlobalConstraint.sol @@ -0,0 +1,38 @@ +pragma solidity ^0.4.23; + +// Copyright 2018 OpenST Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import "../../GlobalConstraintInterface.sol"; + +contract TokenRulesPassingGlobalConstraint is GlobalConstraintInterface +{ + /* External Functions */ + + function check( + address _from, + address[] _transfersTo, + uint256[] _transfersAmount + ) + external + view + returns (bool) + { + _from; + _transfersTo; + _transfersAmount; + + return true; + } +} diff --git a/contracts/truffle/Migrations.sol b/contracts/truffle/Migrations.sol index 5e03293..44eb67c 100644 --- a/contracts/truffle/Migrations.sol +++ b/contracts/truffle/Migrations.sol @@ -1,23 +1,24 @@ pragma solidity ^0.4.23; contract Migrations { - address public owner; - uint public last_completed_migration; - modifier restricted() { - if (msg.sender == owner) _; - } + address public owner; + uint public last_completed_migration; - constructor() public { - owner = msg.sender; - } + modifier restricted() { + if (msg.sender == owner) _; + } - function setCompleted(uint completed) public restricted { - last_completed_migration = completed; - } + constructor() public { + owner = msg.sender; + } - function upgrade(address new_address) public restricted { - Migrations upgraded = Migrations(new_address); - upgraded.setCompleted(last_completed_migration); - } + function setCompleted(uint completed) public restricted { + last_completed_migration = completed; + } + + function upgrade(address new_address) public restricted { + Migrations upgraded = Migrations(new_address); + upgraded.setCompleted(last_completed_migration); + } } diff --git a/docs/AirdropModelCacheKlass.html b/docs/AirdropModelCacheKlass.html deleted file mode 100644 index 67bd0f9..0000000 --- a/docs/AirdropModelCacheKlass.html +++ /dev/null @@ -1,391 +0,0 @@ - - - - - - - OpenST Payments Class: AirdropModelCacheKlass - - - - - - - - - - - - - -
-
- - -
- -
- - -

Class: AirdropModelCacheKlass

-
- -
- -

- AirdropModelCacheKlass -

- - -
- - -
-
- - -
-
-

new AirdropModelCacheKlass(cache)

- - -
-
- - -
- constructor -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
cache - - -object - - - - - get/set related arguments
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - -
- - - - - - - - - - - - - - - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/baseCacheManagementKlass.html b/docs/baseCacheManagementKlass.html deleted file mode 100644 index 16d9b62..0000000 --- a/docs/baseCacheManagementKlass.html +++ /dev/null @@ -1,1335 +0,0 @@ - - - - - - - OpenST Payments Class: baseCacheManagementKlass - - - - - - - - - - - - - -
-
- - -
- -
- - -

Class: baseCacheManagementKlass

-
- -
- -

- baseCacheManagementKlass -

- - -
- - -
-
- - -
-
-

new baseCacheManagementKlass(params)

- - -
-
- - -
- constructor -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
params - - -Object - - - - - cache key generation & expiry related params
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - -
- - - - - - - - - - - - - - -

Methods

- -
- -
-
-

_cacheKeyPrefix()

- - -
-
- - -
- cache key prefix -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -String - - - -
-
- - - - - -
- - - -
-
-

_fetchFromCache()

- - -
-
- - -
- fetch from cache -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Object - - - -
-
- - - - - -
- - - -
-
-

_setCache(dataToSet)

- - -
-
- - -
- set data in cache. -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
dataToSet - - -Object - - - - - data to se tin cache
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Result - - - -
-
- - - - - -
- - - -
-
-

_sharedCacheKeyPrefix()

- - -
-
- - -
- Shared cache key prefix -This cache is shared between company api and saas -Cache keys with these prefixes can be flushed via company api or saas. -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -String - - - -
-
- - - - - -
- - - -
-
-

clear()

- - -
-
- - -
- clear cache -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Promise.<Result> - - - -
-
- - - - - -
- - - -
-
-

fetch()

- - -
-
- - -
- Fetch data from cache, in case of cache miss calls sub class method to fetch data from source -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
- - On success, data.value has value. On failure, error details returned. -
- - - -
-
- Type -
-
- -Promise.<Result> - - - -
-
- - - - - -
- - - -
-
-

fetchDataFromSource()

- - -
-
- - -
- fetch data from source -return should be of klass Result -data attr of return is returned and set in cache -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Result - - - -
-
- - - - - -
- - - -
-
-

setCacheExpiry()

- - -
-
- - -
- set cache expiry in oThis.cacheExpiry and return it -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Number - - - -
-
- - - - - -
- - - -
-
-

setCacheKey()

- - -
-
- - -
- set cache key in oThis.cacheKey and return it -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -String - - - -
-
- - - - - -
- -
- - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/baseCacheMultiManagementKlass.html b/docs/baseCacheMultiManagementKlass.html deleted file mode 100644 index fcd0631..0000000 --- a/docs/baseCacheMultiManagementKlass.html +++ /dev/null @@ -1,1137 +0,0 @@ - - - - - - - OpenST Payments Class: baseCacheMultiManagementKlass - - - - - - - - - - - - - -
-
- - -
- -
- - -

Class: baseCacheMultiManagementKlass

-
- -
- -

- baseCacheMultiManagementKlass -

- - -
- - -
-
- - -
-
-

new baseCacheMultiManagementKlass(params)

- - -
-
- - -
- constructor -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
params - - -Object - - - - - cache key generation & expiry related params
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - -
- - - - - - - - - - - - - - -

Methods

- -
- -
-
-

_fetchFromCache()

- - -
-
- - -
- fetch from cache -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Object - - - -
-
- - - - - -
- - - -
-
-

_setCache(dataToSet)

- - -
-
- - -
- set data in cache. -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
dataToSet - - -Object - - - - - data to set in cache
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Result - - - -
-
- - - - - -
- - - -
-
-

clear()

- - -
-
- - -
- clear cache -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Promise.<Result> - - - -
-
- - - - - -
- - - -
-
-

fetch()

- - -
-
- - -
- Fetch data from cache, in case of cache miss calls sub class method to fetch data from source -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
- - On success, data.value has value. On failure, error details returned. -
- - - -
-
- Type -
-
- -Promise.<Result> - - - -
-
- - - - - -
- - - -
-
-

fetchDataFromSource()

- - -
-
- - -
- fetch data from source -return should be of klass Result -data attr of return is returned and set in cache -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Result - - - -
-
- - - - - -
- - - -
-
-

setCacheExpiry()

- - -
-
- - -
- set cache expiry in oThis.cacheExpiry and return it -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Number - - - -
-
- - - - - -
- - - -
-
-

setCacheKeys()

- - -
-
- - -
- set cache keys in oThis.cacheKeys and return it -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -String - - - -
-
- - - - - -
- -
- - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/classes.list.html b/docs/classes.list.html deleted file mode 100644 index 1eaf0f3..0000000 --- a/docs/classes.list.html +++ /dev/null @@ -1,381 +0,0 @@ - - - - - - - OpenST Payments Classes - - - - - - - - - - - - - -
-
- - -
- -
- - -

Classes

-
- -
- -

- -

- - -
- - -
-
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - -

Classes

- -
-
AirdropModelCacheKlass
-
- -
baseCacheManagementKlass
-
- -
baseCacheMultiManagementKlass
-
- -
BasicHelperKlass
-
- -
AdjustAirdropAmountKlass
-
- -
AirdropBalanceCache
-
- -
PricerCache
-
- -
Airdrop
-
- -
BrandedToken
-
- -
ContractInteractHelper
-
- -
OpsManagedContract
-
- -
OwnedContract
-
- -
MockToken
-
- -
Pricer
-
- -
Workers
-
- -
MySQLQueryBuilderKlass
-
- -
SetWorkerOps
-
- -
TransactionHelper
-
- -
DynamoDBInit
-
- -
userAirdropDetailCache
-
-
- - - - - -

Namespaces

- -
-
web3EventsDecoder
-
- -
web3EventsFormatter
-
-
- - - - - - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/fonts/glyphicons-halflings-regular.eot b/docs/fonts/glyphicons-halflings-regular.eot deleted file mode 100644 index b93a495..0000000 Binary files a/docs/fonts/glyphicons-halflings-regular.eot and /dev/null differ diff --git a/docs/fonts/glyphicons-halflings-regular.svg b/docs/fonts/glyphicons-halflings-regular.svg deleted file mode 100644 index 94fb549..0000000 --- a/docs/fonts/glyphicons-halflings-regular.svg +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/fonts/glyphicons-halflings-regular.ttf b/docs/fonts/glyphicons-halflings-regular.ttf deleted file mode 100644 index 1413fc6..0000000 Binary files a/docs/fonts/glyphicons-halflings-regular.ttf and /dev/null differ diff --git a/docs/fonts/glyphicons-halflings-regular.woff b/docs/fonts/glyphicons-halflings-regular.woff deleted file mode 100644 index 9e61285..0000000 Binary files a/docs/fonts/glyphicons-halflings-regular.woff and /dev/null differ diff --git a/docs/fonts/glyphicons-halflings-regular.woff2 b/docs/fonts/glyphicons-halflings-regular.woff2 deleted file mode 100644 index 64539b5..0000000 Binary files a/docs/fonts/glyphicons-halflings-regular.woff2 and /dev/null differ diff --git a/docs/global.html b/docs/global.html deleted file mode 100644 index 49ca8a1..0000000 --- a/docs/global.html +++ /dev/null @@ -1,375 +0,0 @@ - - - - - - - OpenST Payments Global - - - - - - - - - - - - - -
-
- - -
- -
- - -

Global

-
- -
- -

- -

- - -
- - -
-
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - - - - - - - -

Members

- -
- -
-
-

<constant> rootPrefix

- - -
-
- -
- List of all addresses and there respective abi, bin, passphrase -required for platform. - -And helper methods to access this information using human readable -names. -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- -
- - - - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/img/glyphicons-halflings-white.png b/docs/img/glyphicons-halflings-white.png deleted file mode 100644 index 3bf6484..0000000 Binary files a/docs/img/glyphicons-halflings-white.png and /dev/null differ diff --git a/docs/img/glyphicons-halflings.png b/docs/img/glyphicons-halflings.png deleted file mode 100644 index a996999..0000000 Binary files a/docs/img/glyphicons-halflings.png and /dev/null differ diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index 86b33e9..0000000 --- a/docs/index.html +++ /dev/null @@ -1,425 +0,0 @@ - - - - - - - OpenST Payments Index - - - - - - - - - - - - - -
-
- - -
- -
- - - - - - - - - - - - - - - - - - - - - - -
-

OpenST Payments - Advance Payment infrastructure on top of the OpenST network

Latest version -Travis -Downloads per month -Gitter: JOIN CHAT

-

While OpenST 0.9 is available as-is for anyone to use, we caution that this is early stage software and under heavy ongoing development and improvement. Please report bugs and suggested improvements.

-

Install OpenST Payments

npm install @openstfoundation/openst-payments --save

Init DynamoDB

Following commands need to be run once, only for the first time. DynamoDB initial migrations for shard management are -run in it and one shard is created and registered for storing token balance.

-
. ./mocha_test/scripts/set_env_vars.sh
-node tools/dynamo_db_init.js

Run Test Chain

cd mocha_test/scripts/
-sh start_test_chain.sh

Set EVN Variables

Setup Initial Setup Variables:

export OST_UTILITY_GETH_RPC_PROVIDER=''
-export OST_UTILITY_GETH_WS_PROVIDER=''
-export OST_UTILITY_DEPLOYER_ADDR=''
-export OST_UTILITY_DEPLOYER_PASSPHRASE=''
-export OST_UTILITY_OPS_ADDR=''
-export OST_UTILITY_OPS_PASSPHRASE=''

Deploy Branded Token Contract:

node tools/deploy/EIP20TokenMock.js conversionRate symbol name decimals gasPrice

Deploy Workers Contract:

node tools/deploy/workers.js gasPrice chainId

Deploy Airdrop Contract:

node tools/deploy/airdrop.js brandedTokenContractAddress baseCurrency workerContractAddress airdropBudgetHolder gasPrice chainId

Set Caching Engine:

export OST_CACHING_ENGINE='none'
-For using redis/memcache as cache engine refer - [OpenSTFoundation/ost-price-oracle](https://github.com/OpenSTFoundation/ost-price-oracle)

Set DB Details For Payments/Airdrop:

export OP_MYSQL_HOST=''
-export OP_MYSQL_USER=''
-export OP_MYSQL_PASSWORD=''
-export OP_MYSQL_DATABASE=''
-export OP_MYSQL_CONNECTION_POOL_SIZE='5'

Create Airdrop Tables:

node migrations/create_tables.js 

Deploy Service Examples:

const OpenSTPayment = require('@openstfoundation/openst-payments')
-  , Deploy = OpenSTPayment.services.deploy
-;  
-  // Deploy Workers
-  const deployWorkerObject = new Deploy.workers({
-    gas_price: gasPrice,
-    options: {returnType: 'txHash'}
-  });
-  deployWorkerObject.perform();
-
-  // Deploy Airdrop
-  const deployAirdropObject = new Deploy.airdrop({
-    branded_token_contract_address: brandedTokenAddress,
-    base_currency: baseCurrency,
-    worker_contract_address: workerContractAddress,
-    airdrop_budget_holder: airdropBudgetHolder,
-    gas_price: gasPrice,
-    options: {returnType: 'txHash'}
-  });
-  deployAirdropObject.perform();
-

OpsManaged Service Examples

const OpenSTPayment = require('@openstfoundation/openst-payments')
-  , OpsManaged = OpenSTPayment.services.opsManaged
-;  
-  // Set Ops Address
-  const setOpsObject = new OpsManaged.setOps({
-    contract_address: contractAddress,
-    gas_price: gasPrice,
-    chain_id: chainId,
-    deployer_address: deployerAddress,
-    deployer_passphrase: deployerPassphrase,
-    ops_address: opsAddress,
-    options: {returnType: 'txHash'}
-  });
-  setOpsObject.perform();
-
-  // Get Ops Address
-  const getOpsObject = new OpsManaged.getOps({
-    contract_address: contractAddress,
-    gas_price: gasPrice,
-    chain_id: chainId
-  });
-  getOpsObject.perform();

Workers Service Examples

const OpenSTPayment = require('@openstfoundation/openst-payments')
-  , Workers = OpenSTPayment.services.workers
-;  
-  // Set Worker
-  const setWorkerObject = new Workers.setWorker({
-      workers_contract_address: constants.workersContractAddress,
-      sender_address: constants.ops,
-      sender_passphrase: constants.opsPassphrase,
-      worker_address: workerAddress,
-      deactivation_height: deactivationHeight.toString(10),
-      gas_price: gasPrice,
-      chain_id: chainId,
-      options: {returnType: 'txHash'}
-  });
-  setWorkerObject.perform();
-
-  // Is Worker
-  const isWorkerObject = new Workers.isWorker({
-      workers_contract_address: workersContractAddress,
-      worker_address: workerAddress,
-      chain_id: chainId
-  });
-  isWorkerObject.perform();

Airdrop Management Service Examples:

const OpenSTPayment = require('@openstfoundation/openst-payments')
-  , AirdropManager = OpenSTPayment.services.airdropManager
-;  
-  // Register Airdrop
-  const registerObject = new AirdropManager.register({
-    airdrop_contract_address: airdropContractAddress,
-    chain_id: chainId
-  });
-  registerObject.perform();
-
-  // Set Price Oracle
-  const setPriceOracleObject = new AirdropManager.setPriceOracle({
-      airdrop_contract_address: airdropContractAddress,
-      chain_id: chainId,
-      sender_address: senderAddress,
-      sender_passphrase: senderPassphrase,
-      currency: currency,
-      price_oracle_contract_address: priceOracleContractAddress,
-      gas_price: gasPrice,
-      options: {tag: 'airdrop.setPriceOracle', returnType: 'txHash'}
-  });
-  setPriceOracleObject.perform();
-
-  // Set Accepted Margin
-  const setAcceptedMarginObject = new AirdropManager.setAcceptedMargin({
-    airdrop_contract_address: airdropContractAddress,
-    chain_id: chainId,
-    sender_address: senderAddress,
-    sender_passphrase: senderPassphrase,
-    currency: currency,
-    accepted_margin: acceptedMargin,
-    gas_price: gasPrice,
-    options: {tag: 'airdrop.setAcceptedMargin', returnType: 'txHash'}
-  });
-  setAcceptedMarginObject.perform();
-
-  // Transfer Amount to airdrop budget holder
-  const transferObject = new AirdropManager.transfer({
-    sender_address: senderAddress,
-    sender_passphrase: senderPassphrase,
-    airdrop_contract_address: airdropContractAddress,
-    amount: airdropBudgetAmountInWei,
-    gas_price: gasPrice,
-    chain_id: chainId,
-    options: {tag: 'airdrop.transfer', returnType: 'txHash'}
-  });
-  transferObject.perform();
-
-  // Approve airdrop budget holder
-  const approveObject = new AirdropManager.approve({
-    airdrop_contract_address: airdropContractAddress,
-    airdrop_budget_holder_passphrase: airdropBudgetHolderPassphrase,
-    gas_price: gasPrice,
-    chain_id: chainId,
-    options: {tag: 'airdrop.approve', returnType: 'txHash'}
-  });
-  approveObject.perform();
-
-  // Allocate airdrop amount to users in batch
-  const batchAllocatorObject = new AirdropManager.batchAllocator({
-    airdrop_contract_address: airdropContractAddress,
-    transaction_hash: transactionHash,
-    airdrop_users: {userAddress1: {airdropAmount: amountInWei, expiryTimestamp: 0}, userAddress2: {airdropAmount: amountInWei, expiryTimestamp: 0}},
-    chain_id: chainId
-  });
-  batchAllocatorObject.perform();
-
-  // Get Users Airdrop Balance
-  const userBalanceObject = new AirdropManager.userBalance({
-    airdrop_contract_address: airdropContractAddress,
-    chain_id: chainId,
-    user_addresses: [user1, user2]
-  });
-  userBalanceObject.perform();
-
-  // Call Pay method
-  const payObject = new AirdropManager.pay({
-    airdrop_contract_address: airdropContractAddress,
-    chain_id: chainId,
-    sender_worker_address: workerAddress,
-    sender_worker_passphrase: workerPassphrase,
-    beneficiary_address: beneficiary,
-    transfer_amount: transferAmount.toString(10),
-    commission_beneficiary_address: commissionBeneficiary,
-    commission_amount: commissionAmount.toString(10),
-    currency: currency,
-    intended_price_point: intendedPricePoint,
-    spender: spenderAddress,
-    gas_price: gasPrice,
-    options: {tag:'airdrop.pay', returnType: 'txHash'}
-  });
-  payObject.perform()
-

For further implementation details, please refer to the API documentation.

-
- - - - - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-helpers_basic_helper-BasicHelperKlass.html b/docs/module-helpers_basic_helper-BasicHelperKlass.html deleted file mode 100644 index 92eaef3..0000000 --- a/docs/module-helpers_basic_helper-BasicHelperKlass.html +++ /dev/null @@ -1,2419 +0,0 @@ - - - - - - - OpenST Payments Class: BasicHelperKlass - - - - - - - - - - - - - -
-
- - -
- -
- - -

Class: BasicHelperKlass

-
- -
- -

- helpers/basic_helper~ - - BasicHelperKlass -

- - -
- - -
-
- - -
-
-

new BasicHelperKlass()

- - -
-
- - -
- Basic helper methods constructor -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - -
- - - - - - - - - - - - - - -

Methods

- -
- -
-
-

convertToBigNumber(amountInWei)

- - -
-
- - -
- Convert number to big number. Make sure it's a valid number -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
amountInWei - - -number - - - - - amount in wei to be formatted
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -BigNumber - - - -
-
- - - - - -
- - - -
-
-

formatWeiToString(amountInWei)

- - -
-
- - -
- Convert wei to proper string. Make sure it's a valid number -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
amountInWei - - -number - - - - - amount in wei to be formatted
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -string - - - -
-
- - - - - -
- - - -
-
-

getReturnType(returnType)

- - -
-
- - -
- get return type for transaction -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
returnType - - -string - - - - - return from geth transactions when following event is received
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -string - - - -
-
- - - - - -
- - - -
-
-

isAddressValid(address)

- - -
-
- - -
- Check if address is valid or not -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
address - - -string - - - - - Address
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -boolean - - - -
-
- - - - - -
- - - -
-
-

isBTConversionRateValid(conversionRate)

- - -
-
- - -
- Check if branded token conversion rate is valid or not -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
conversionRate - - -number - - - - - Branded token conversion rate
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -boolean - - - -
-
- - - - - -
- - - -
-
-

isBTNameValid(name)

- - -
-
- - -
- Check if branded token name is valid or not -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
name - - -string - - - - - Branded token name
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -boolean - - - -
-
- - - - - -
- - - -
-
-

isBTSymbolValid(symbol)

- - -
-
- - -
- Check if branded token symbol is valid or not -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
symbol - - -string - - - - - Branded token symbol
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -boolean - - - -
-
- - - - - -
- - - -
-
-

isNonZeroWeiValid(amountInWei)

- - -
-
- - -
- Check if amount is valid wei number and not zero -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
amountInWei - - -number - - - - - amount in wei
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -boolean - - - -
-
- - - - - -
- - - -
-
-

isReturnTypeTxHash(returnType)

- - -
-
- - -
- check if return type is txHash or not -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
returnType - - -string - - - - - return type
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -boolean - - - -
-
- - - - - -
- - - -
-
-

isReturnTypeTxReceipt(returnType)

- - -
-
- - -
- check if return type is txReceipt or not -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
returnType - - -string - - - - - return type
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -boolean - - - -
-
- - - - - -
- - - -
-
-

isReturnTypeUUID(returnType)

- - -
-
- - -
- check if return type is uuid or not -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
returnType - - -string - - - - - return type
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -boolean - - - -
-
- - - - - -
- - - -
-
-

isTxHashValid(transactionHash)

- - -
-
- - -
- Check if transaction hash is valid or not -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
transactionHash - - -string - - - - - Transaction hash
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -boolean - - - -
-
- - - - - -
- - - -
-
-

isUuidValid(uuid)

- - -
-
- - -
- Check if uuid is valid or not -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
uuid - - -string - - - - - Branded Token UUID
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -boolean - - - -
-
- - - - - -
- - - -
-
-

isValidChainId(chainId)

- - -
-
- - -
- Check if chainId is valid -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
chainId - - -Number - - - - - chainId
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Bool - - - -
-
- - - - - -
- -
- - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-helpers_basic_helper.html b/docs/module-helpers_basic_helper.html deleted file mode 100644 index d7aa955..0000000 --- a/docs/module-helpers_basic_helper.html +++ /dev/null @@ -1,311 +0,0 @@ - - - - - - - OpenST Payments Module: helpers/basic_helper - - - - - - - - - - - - - -
-
- - -
- -
- - -

Module: helpers/basic_helper

-
- -
- -
- - -
-
- - -
Perform basic validations
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - -

Classes

- -
-
BasicHelperKlass
-
-
- - - - - - - - - - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_airdrop_management_adjust_airdrop_amount-AdjustAirdropAmountKlass.html b/docs/module-lib_airdrop_management_adjust_airdrop_amount-AdjustAirdropAmountKlass.html deleted file mode 100644 index ab7a6b1..0000000 --- a/docs/module-lib_airdrop_management_adjust_airdrop_amount-AdjustAirdropAmountKlass.html +++ /dev/null @@ -1,831 +0,0 @@ - - - - - - - OpenST Payments Class: AdjustAirdropAmountKlass - - - - - - - - - - - - - -
-
- - -
- -
- - -

Class: AdjustAirdropAmountKlass

-
- -
- -

- lib/airdrop_management/adjust_airdrop_amount~ - - AdjustAirdropAmountKlass -

- - -
- - -
-
- - -
-
-

new AdjustAirdropAmountKlass(airdropContractAddress, userAddress, airdropAmountUsed)

- - -
-
- - -
- Constructor to create object of userBalance -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
airdropContractAddress - - -Hex - - - - - airdrop contract address
userAddress - - -Array - - - - - Array of user addressed
airdropAmountUsed - - -BigNumber - - - - - used airdrop amount
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Object - - - -
-
- - - - - -
- - -
- - - - - - - - - - - - - - -

Methods

- -
- -
-
-

creditAirdropUsedAmount()

- - -
-
- - -
- Credit airdrop used amount. decreases airdrop_used_amount of user_airdrop_details table -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

debitAirdropUsedAmount()

- - -
-
- - -
- Debit airdrop used amount -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

rollbackCreditAirdropAdjustedAmount()

- - -
-
- - -
- Rollback credit airdrop used amount -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - - - - - -
- - - -
-
-

rollbackDebitAirdropAdjustedAmount()

- - -
-
- - -
- Rollback debit airdrop used amount -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - - - - - -
- -
- - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_airdrop_management_adjust_airdrop_amount.html b/docs/module-lib_airdrop_management_adjust_airdrop_amount.html deleted file mode 100644 index 04932ba..0000000 --- a/docs/module-lib_airdrop_management_adjust_airdrop_amount.html +++ /dev/null @@ -1,311 +0,0 @@ - - - - - - - OpenST Payments Module: lib/airdrop_management/adjust_airdrop_amount - - - - - - - - - - - - - -
-
- - -
- -
- - -

Module: lib/airdrop_management/adjust_airdrop_amount

-
- -
- -
- - -
-
- - -
This class would be used for calculating user airdrop balance.

- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - -

Classes

- -
-
AdjustAirdropAmountKlass
-
-
- - - - - - - - - - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_cache_management_airdrop_cache-AirdropBalanceCache.html b/docs/module-lib_cache_management_airdrop_cache-AirdropBalanceCache.html deleted file mode 100644 index a690a42..0000000 --- a/docs/module-lib_cache_management_airdrop_cache-AirdropBalanceCache.html +++ /dev/null @@ -1,428 +0,0 @@ - - - - - - - OpenST Payments Class: AirdropBalanceCache - - - - - - - - - - - - - -
-
- - -
- -
- - -

Class: AirdropBalanceCache

-
- -
- -

- lib/cache_management/airdrop_cache~ - - AirdropBalanceCache -

- - -
- - -
-
- - -
-
-

new AirdropBalanceCache(chainId, airdropAddress)

- - -
-
- - -
- constructor -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
chainId - - -string - - - - - Chain id
airdropAddress - - -string - - - - - address of airdrop contract
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - -
- - -

Extends

- - - - -
    -
  • PricerCacheKlass
  • -
- - - - - - - - - - - - - - - - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_cache_management_airdrop_cache.html b/docs/module-lib_cache_management_airdrop_cache.html deleted file mode 100644 index 777a745..0000000 --- a/docs/module-lib_cache_management_airdrop_cache.html +++ /dev/null @@ -1,311 +0,0 @@ - - - - - - - OpenST Payments Module: lib/cache_management/airdrop_cache - - - - - - - - - - - - - -
-
- - -
- -
- - -

Module: lib/cache_management/airdrop_cache

-
- -
- -
- - -
-
- - -
This is cache layer for airdrop balance related caching

- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - -

Classes

- -
-
AirdropBalanceCache
-
-
- - - - - - - - - - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_cache_management_pricer_cache-PricerCache.html b/docs/module-lib_cache_management_pricer_cache-PricerCache.html deleted file mode 100644 index 335a189..0000000 --- a/docs/module-lib_cache_management_pricer_cache-PricerCache.html +++ /dev/null @@ -1,3891 +0,0 @@ - - - - - - - OpenST Payments Class: PricerCache - - - - - - - - - - - - - -
-
- - -
- -
- - -

Class: PricerCache

-
- -
- -

- lib/cache_management/pricer_cache~ - - PricerCache -

- - -
- - -
-
- - -
-
-

new PricerCache(chainId, contractAddress)

- - -
-
- - -
- constructor -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
chainId - - -string - - - - - Chain id
contractAddress - - -string - - - - - address of pricer/airdrop contract
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - -
- - - - - - - - - - - - - - -

Methods

- -
- -
-
-

clearAcceptedMargins(currency)

- - -
-
- - -
- reset accepted margin cache -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
currency - - -string - - - - - currency
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

clearBrandedTokenAddress(brandedTokenAddress)

- - -
-
- - -
- clear branded token address cache -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
brandedTokenAddress - - -string - - - - - branded token address
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

clearCache(key)

- - -
-
- - -
- Clear cache for given key -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
key - - -string - - - - - cache key
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

clearConversionRate()

- - -
-
- - -
- Clear conversion rate from cache -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

clearConversionRateDecimals()

- - -
-
- - -
- Clear conversion rate decimals from cache -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

clearDecimals()

- - -
-
- - -
- clear decimals from cache -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

clearPriceOracles(currency, address)

- - -
-
- - -
- Clear price oracle address for given currency in cache -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
currency - - -string - - - - - currency
address - - -string - - - - - price oracle address
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

clearPricePoint(address)

- - -
-
- - -
- Clear price point of price oracle from cache -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
address - - -string - - - - - price oracle address
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

getAcceptedMargins(currency)

- - -
-
- - -
- Get accepted margin -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
currency - - -string - - - - - currency
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

getBrandedTokenAddress()

- - -
-
- - -
- Get branded token address for pricer -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

getCacheKey(owner)

- - -
-
- - -
- Get conversion rate for pricer -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
owner - - -string - - - - - address of user whose balance is to be found
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

getCacheValue(key)

- - -
-
- - -
- Get cached value -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
key - - -string - - - - - key
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

getConversionRate()

- - -
-
- - -
- Get conversion rate for pricer -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

getConversionRateDecimals()

- - -
-
- - -
- Get conversion rate decimals for pricer -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

getDecimals()

- - -
-
- - -
- Get decimals for pricer -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

getPriceOracles(currency)

- - -
-
- - -
- Get price oracle address for given currency from cache -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
currency - - -string - - - - - currency
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

getPricePoint(address)

- - -
-
- - -
- Get price point of price oracle from cache -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
address - - -string - - - - - price oracle address
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

setAcceptedMargins(currency, margin)

- - -
-
- - -
- Set accepted margin -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
currency - - -string - - - - - currency
margin - - -BigNumber - - - - - accepted margin value
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

setBrandedTokenAddress(brandedTokenAddress)

- - -
-
- - -
- Set branded token address for pricer -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
brandedTokenAddress - - -string - - - - - branded token address
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

setCacheValue(key, value)

- - -
-
- - -
- Set value in cache -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
key - - -string - - - - - key
value - - -string - - - - - value
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

setConversionRate(conversionRate)

- - -
-
- - -
- Set conversion rate to cache -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
conversionRate - - -BigNumber - - - - - conversion rate of pricer/airdrop
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

setConversionRateDecimals(conversionRateDecimals)

- - -
-
- - -
- Set conversion rate decimals to cache -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
conversionRateDecimals - - -BigNumber - - - - - conversion rate of pricer/airdrop
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

setDecimals(conversionRateDecimals)

- - -
-
- - -
- Set decimals to cache -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
conversionRateDecimals - - -BigNumber - - - - - conversion rate of pricer/airdrop
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

setPriceOracles(currency, address)

- - -
-
- - -
- Set price oracle address for given currency in cache -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
currency - - -string - - - - - currency
address - - -string - - - - - price oracle address
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

setPricePoint(pricePoint, address)

- - -
-
- - -
- Set price point of price oracle from cache -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
pricePoint - - -string - - - - - price oracle price point
address - - -string - - - - - price oracle address
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- -
- - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_cache_management_pricer_cache.html b/docs/module-lib_cache_management_pricer_cache.html deleted file mode 100644 index 44812eb..0000000 --- a/docs/module-lib_cache_management_pricer_cache.html +++ /dev/null @@ -1,311 +0,0 @@ - - - - - - - OpenST Payments Module: lib/cache_management/pricer_cache - - - - - - - - - - - - - -
-
- - -
- -
- - -

Module: lib/cache_management/pricer_cache

-
- -
- -
- - -
-
- - -
This is cache layer for pricer balance related caching

- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - -

Classes

- -
-
PricerCache
-
-
- - - - - - - - - - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_contract_interact_airdrop-Airdrop.html b/docs/module-lib_contract_interact_airdrop-Airdrop.html deleted file mode 100644 index 1ccfe39..0000000 --- a/docs/module-lib_contract_interact_airdrop-Airdrop.html +++ /dev/null @@ -1,424 +0,0 @@ - - - - - - - OpenST Payments Class: Airdrop - - - - - - - - - - - - - -
-
- - -
- -
- - -

Class: Airdrop

-
- -
- -

- lib/contract_interact/airdrop~ - - Airdrop -

- - -
- - -
-
- - -
-
-

new Airdrop(airdropContractAddress, chainId)

- - -
-
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
airdropContractAddress - - -string - - - - - airdrop contract address
chainId - - -string - - - - - chain ID
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - -
- - -

Extends

- - - - -
    -
  • Pricer
  • -
- - - - - - - - - - - - - - - - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_contract_interact_airdrop.html b/docs/module-lib_contract_interact_airdrop.html deleted file mode 100644 index 333fda8..0000000 --- a/docs/module-lib_contract_interact_airdrop.html +++ /dev/null @@ -1,311 +0,0 @@ - - - - - - - OpenST Payments Module: lib/contract_interact/airdrop - - - - - - - - - - - - - -
-
- - -
- -
- - -

Module: lib/contract_interact/airdrop

-
- -
- -
- - -
-
- - -
This is a utility file which would be used for executing all methods on Pricer.sol contract.

- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - -

Classes

- -
-
Airdrop
-
-
- - - - - - - - - - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_contract_interact_branded_token-BrandedToken.html b/docs/module-lib_contract_interact_branded_token-BrandedToken.html deleted file mode 100644 index 6ef6fd9..0000000 --- a/docs/module-lib_contract_interact_branded_token-BrandedToken.html +++ /dev/null @@ -1,1573 +0,0 @@ - - - - - - - OpenST Payments Class: BrandedToken - - - - - - - - - - - - - -
-
- - -
- -
- - -

Class: BrandedToken

-
- -
- -

- lib/contract_interact/branded_token~ - - BrandedToken -

- - -
- - -
-
- - -
-
-

new BrandedToken(brandedTokenAddress, chainId)

- - -
-
- - -
- Constructor to create object of BrandedToken -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
brandedTokenAddress - - -string - - - - - Branded token address
chainId - - -number - - - - - chainId
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - -
- - - - - - - - - - - - -

Members

- -
- -
-
-

brandedTokenAddress

- - -
-
- -
- branded token address -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - -
-
-

chainId

- - -
-
- -
- chain id -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- -
- - - -

Methods

- -
- -
-
-

approveByBudgetHolder(airdropBudgetHolderAddress, airdropBudgetHolderPassphrase, airdropContractAddress, amount, gasPrice, options)

- - -
-
- - -
- Approve amount to budget holder -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
airdropBudgetHolderAddress - - -string - - - - - address of airdropBudgetHolder
airdropBudgetHolderPassphrase - - -string - - - - - Passphrase of airdropBudgetHolder
airdropContractAddress - - -string - - - - - airdrop contract address
amount - - -BigNumber - - - - - amount in wei
gasPrice - - -BigNumber - - - - - gas price
options - - -object - - - - - for params like returnType, tag.
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

creditBalance(owner, amount)

- - -
-
- - -
- Credit balance in cache -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
owner - - -string - - - - - Account address
amount - - -BigNumber - - - - - amount to be credited
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

debitBalance(owner, bigAmount)

- - -
-
- - -
- Debit balance in cache -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
owner - - -string - - - - - Account address
bigAmount - - -BigNumber - - - - - amount to be debited
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

getBalanceOf(owner)

- - -
-
- - -
- Fetch Balance For a given address -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
owner - - -string - - - - - address for which balance is to be fetched
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

transferToAirdropBudgetHolder(senderAddress, senderPassphrase, airdropBudgetHolderAddress, amount, gasPrice, options)

- - -
-
- - -
- Transfer amount to budget holder -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
senderAddress - - -string - - - - - address of sender
senderPassphrase - - -string - - - - - passphrase of sender
airdropBudgetHolderAddress - - -string - - - - - recipient address
amount - - -BigNumber - - - - - amount in wei
gasPrice - - -BigNumber - - - - - gas price
options - - -object - - - - - for params like returnType, tag.
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- -
- - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_contract_interact_branded_token.html b/docs/module-lib_contract_interact_branded_token.html deleted file mode 100644 index 316b0eb..0000000 --- a/docs/module-lib_contract_interact_branded_token.html +++ /dev/null @@ -1,311 +0,0 @@ - - - - - - - OpenST Payments Module: lib/contract_interact/branded_token - - - - - - - - - - - - - -
-
- - -
- -
- - -

Module: lib/contract_interact/branded_token

-
- -
- -
- - -
-
- - -
This is a utility file which would be used for executing all methods on EIP20Token contract.

- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - -

Classes

- -
-
BrandedToken
-
-
- - - - - - - - - - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_contract_interact_helper-ContractInteractHelper.html b/docs/module-lib_contract_interact_helper-ContractInteractHelper.html deleted file mode 100644 index eddd62e..0000000 --- a/docs/module-lib_contract_interact_helper-ContractInteractHelper.html +++ /dev/null @@ -1,4593 +0,0 @@ - - - - - - - OpenST Payments Class: ContractInteractHelper - - - - - - - - - - - - - -
-
- - -
- -
- - -

Class: ContractInteractHelper

-
- -
- -

- lib/contract_interact/helper~ - - ContractInteractHelper -

- - -
- - -
-
- - -
-
-

new ContractInteractHelper()

- - -
-
- - -
- contract interact helper constructor -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - -
- - - - - - - - - - - - - - -

Methods

- -
- -
-
-

call(web3Provider, currContractAddr, encodeABI [, options] [, transactionOutputs])

- - -
-
- - -
- Call methods (execute methods which DO NOT modify state of contracts) -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
web3Provider - - -object - - - - - - - - - - - It could be value chain or utility chain provider
currContractAddr - - -String - - - - - - - - - - - current contract address
encodeABI - - -Object - - - - - - - - - - - encoded method ABI data
options - - -Object - - - - - - - <optional>
- - - - - -
optional params
transactionOutputs - - -Object - - - - - - - <optional>
- - - - - -
optional transactionOutputs
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise - - - -
-
- - - - - -
- - - -
-
-

generateManagedKeyPassphrase()

- - -
-
- - -
- Stub method to generate managed key passphrase -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -String - - - -
-
- - - - - -
- - - -
-
-

getNotificationData(topics, publisher, method, contractName, contractAddress, web3Provider, options)

- - -
-
- - -
- get notification event formatted data -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
topics - - -array - - - - - topics where the event will be published
publisher - - -String - - - - - publisher name
method - - -String - - - - - method name
contractName - - -String - - - - - name of contract
contractAddress - - -String - - - - - address of contract
web3Provider - - -Object - - - - - address of contract
options - - -Object - - - - - options
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

getTransactionOutputs(transactionObject)

- - -
-
- - -
- get outputs of a given transaction -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
transactionObject - - -object - - - - - transactionObject is returned from call method.
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -array - - - -
-
- - - - - -
- - - -
-
-

getTransactionReceiptFromTrasactionHash(web3Provider, transactionHash)

- - -
-
- - -
- Get transaction receipt -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
web3Provider - - -Web3 - - - - - It could be value chain or utility chain provider
transactionHash - - -String - - - - - transaction hash
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

isDecimal(num)

- - -
-
- - -
- check if return type is true/false -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
num - - -Number - - - - - Number
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
- Note - Don't use for BigNumbers -
- - - -
-
- Type -
-
- -boolean - - - -
-
- - - - - -
- - - -
-
-

isValidCurrency(currency, allow_blank)

- - -
-
- - -
- valid currency -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
currency - - -string - - - - - currency
allow_blank - - -bool - - - - - true / false, '' if allow_blank is true
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
- - true / false -
- - - -
-
- Type -
-
- -Bool - - - -
-
- - - - - -
- - - -
-
-

performSend(Object, string, senderAddr)

- - -
-
- - -
- Perform send -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
Object - - -params - - - - - parmaters
string - - -returnType - - - - - return type
senderAddr - - -String - - - - - address of transaction's sender senderAddr
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

safeSend(web3Provider, currContractAddr, senderName, encodeABI [, txOptions] [, addressToNameMap])

- - -
-
- - -
- Safe Send a transaction (this internally waits for transaction to be mined) -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
web3Provider - - -Web3 - - - - - - - - - - - It could be value chain or utility chain provider
currContractAddr - - -String - - - - - - - - - - - current contract address
senderName - - -String - - - - - - - - - - - name of transaction's sender
encodeABI - - -Object - - - - - - - - - - - encoded method ABI data
txOptions - - -Object - - - - - - - <optional>
- - - - - -
optional txOptions
addressToNameMap - - -Object - - - - - - - <optional>
- - - - - -
optional addressToNameMap
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

safeSendFromAddr(web3Provider, currContractAddr, senderAddr, senderPassphrase, encodeABI [, txOptions] [, addressToNameMap])

- - -
-
- - -
- Safe Send a transaction (this internally waits for transaction to be mined) -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
web3Provider - - -Web3 - - - - - - - - - - - It could be value chain or utility chain provider
currContractAddr - - -String - - - - - - - - - - - current contract address
senderAddr - - -String - - - - - - - - - - - address of transaction's sender senderAddr
senderPassphrase - - -String - - - - - - - - - - - passphrase of
encodeABI - - -Object - - - - - - - - - - - encoded method ABI data
txOptions - - -Object - - - - - - - <optional>
- - - - - -
optional txOptions
addressToNameMap - - -Object - - - - - - - <optional>
- - - - - -
optional addressToNameMap
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

send(web3Provider, currContractAddr, encodeABI [, options] [, transactionOutputs])

- - -
-
- - -
- Send methods (execute methods which modify state of a contracts) -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
web3Provider - - -Web3 - - - - - - - - - - - It could be value chain or utility chain provider
currContractAddr - - -String - - - - - - - - - - - current contract address
encodeABI - - -Object - - - - - - - - - - - encoded method ABI data
options - - -Object - - - - - - - <optional>
- - - - - -
optional params
transactionOutputs - - -Object - - - - - - - <optional>
- - - - - -
optional transactionOutputs
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise - - - -
-
- - - - - -
- - - -
-
-

toAddress(web3Provider, result)

- - -
-
- - -
- Decode result and typecast it to an Address -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
web3Provider - - -Web3 - - - - - It could be value chain or utility chain provider
result - - -String - - - - - current contract address
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

toNumber(web3Provider, result)

- - -
-
- - -
- Decode result and typecast it to a Number -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
web3Provider - - -Web3 - - - - - It could be value chain or utility chain provider
result - - -String - - - - - current contract address
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

toString(web3Provider, result)

- - -
-
- - -
- Decode result and typecast it to a String -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
web3Provider - - -Web3 - - - - - It could be value chain or utility chain provider
result - - -String - - - - - current contract address
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

validateAirdropPayParams(senderAddress, beneficiaryAddress, transferAmount, commissionBeneficiaryAddress, commissionAmount, currency, intendedPricePoint, gasPrice, user)

- - -
-
- - -
- Validate Airdrop pay params -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
senderAddress - - -string - - - - - address of sender
beneficiaryAddress - - -string - - - - - address of beneficiary account
transferAmount - - -BigNumber - - - - - transfer amount (in wei)
commissionBeneficiaryAddress - - -string - - - - - address of commision beneficiary account
commissionAmount - - -BigNumber - - - - - commission amount (in wei)
currency - - -string - - - - - quote currency
intendedPricePoint - - -BigNumber - - - - - price point at which the pay is intended (in wei)
gasPrice - - -BigNumber - - - - - gas price
user - - -Hex - - - - - User address
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

validateCommonPayParams(senderAddress, beneficiaryAddress, transferAmount, commissionBeneficiaryAddress, commissionAmount, currency)

- - -
-
- - -
- Validate common pay params -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
senderAddress - - -string - - - - - address of sender
beneficiaryAddress - - -string - - - - - address of beneficiary account
transferAmount - - -BigNumber - - - - - transfer amount (in wei)
commissionBeneficiaryAddress - - -string - - - - - address of commision beneficiary account
commissionAmount - - -BigNumber - - - - - commission amount (in wei)
currency - - -string - - - - - quote currency
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

validatePayParams(senderAddress, beneficiaryAddress, transferAmount, commissionBeneficiaryAddress, commissionAmount, currency, intendedPricePoint, gasPrice)

- - -
-
- - -
- Validate Airdrop params -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
senderAddress - - -string - - - - - address of sender
beneficiaryAddress - - -string - - - - - address of beneficiary account
transferAmount - - -BigNumber - - - - - transfer amount (in wei)
commissionBeneficiaryAddress - - -string - - - - - address of commision beneficiary account
commissionAmount - - -BigNumber - - - - - commission amount (in wei)
currency - - -string - - - - - quote currency
intendedPricePoint - - -BigNumber - - - - - price point at which the pay is intended (in wei)
gasPrice - - -BigNumber - - - - - gas price
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

validatePostAirdropPayParams()

- - -
-
- - -
- Validate post airdrop pay params -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
params.beneficiaryAddress - - -string - - - - - beneficiary address
params.commissionBeneficiaryAddress - - -string - - - - - commission beneficiary address
params.spender - - -string - - - - - spender address
params.brandedTokenAddress - - -string - - - - - branded token address
params.contractAddress - - -string - - - - - contractAddress address
params.airdropBudgetHolder - - -string - - - - - airdrop budget holder address
params.totalAmount - - -number - - - - - total amount that was debited from spender account
params.airdropAmountToUse - - -number - - - - - airdrop amount that was used in the transaction
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- -
- - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_contract_interact_helper.html b/docs/module-lib_contract_interact_helper.html deleted file mode 100644 index c64f3a3..0000000 --- a/docs/module-lib_contract_interact_helper.html +++ /dev/null @@ -1,311 +0,0 @@ - - - - - - - OpenST Payments Module: lib/contract_interact/helper - - - - - - - - - - - - - -
-
- - -
- -
- - -

Module: lib/contract_interact/helper

-
- -
- -
- - -
-
- - -
This is utility class for contract interacts

- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - -

Classes

- -
-
ContractInteractHelper
-
-
- - - - - - - - - - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_contract_interact_ops_managed_contract-OpsManagedContract.html b/docs/module-lib_contract_interact_ops_managed_contract-OpsManagedContract.html deleted file mode 100644 index 9f19c7a..0000000 --- a/docs/module-lib_contract_interact_ops_managed_contract-OpsManagedContract.html +++ /dev/null @@ -1,774 +0,0 @@ - - - - - - - OpenST Payments Class: OpsManagedContract - - - - - - - - - - - - - -
-
- - -
- -
- - -

Class: OpsManagedContract

-
- -
- -

- lib/contract_interact/ops_managed_contract~ - - OpsManagedContract -

- - -
- - -
-
- - -
-
-

new OpsManagedContract(contractAddress, defaultGasPrice, chainId)

- - -
-
- - -
- Ops managed contract interact constructor -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contractAddress - - -string - - - - - address where Contract has been deployed
defaultGasPrice - - -string - - - - - default Gas Price
chainId - - -number - - - - - chain id
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - -
- - -

Extends

- - - - -
    -
  • OwnedContract
  • -
- - - - - - - - - - - - - - - -

Methods

- -
- -
-
-

getOpsAddress()

- - -
-
- - -
- Get currContract's Ops Address -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

setOpsAddress(senderAddress, senderPassphrase, opsAddress, options)

- - -
-
- - -
- Set currContract's Ops Address -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
senderAddress - - -string - - - - - Sender Address
senderPassphrase - - -String - - - - - Sender Passphrase
opsAddress - - -String - - - - - address which is to be made Ops Address of currContract
options - - -Object - - - - - options for this transaction
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- -
- - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_contract_interact_ops_managed_contract.html b/docs/module-lib_contract_interact_ops_managed_contract.html deleted file mode 100644 index b2c3d63..0000000 --- a/docs/module-lib_contract_interact_ops_managed_contract.html +++ /dev/null @@ -1,311 +0,0 @@ - - - - - - - OpenST Payments Module: lib/contract_interact/ops_managed_contract - - - - - - - - - - - - - -
-
- - -
- -
- - -

Module: lib/contract_interact/ops_managed_contract

-
- -
- -
- - -
-
- - -
This is a utility file which would be used for executing all methods on OpsManaged Contract.

- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - -

Classes

- -
-
OpsManagedContract
-
-
- - - - - - - - - - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_contract_interact_owned_contract-OwnedContract.html b/docs/module-lib_contract_interact_owned_contract-OwnedContract.html deleted file mode 100644 index 8dc678f..0000000 --- a/docs/module-lib_contract_interact_owned_contract-OwnedContract.html +++ /dev/null @@ -1,763 +0,0 @@ - - - - - - - OpenST Payments Class: OwnedContract - - - - - - - - - - - - - -
-
- - -
- -
- - -

Class: OwnedContract

-
- -
- -

- lib/contract_interact/owned_contract~ - - OwnedContract -

- - -
- - -
-
- - -
-
-

new OwnedContract(contractAddress, web3Provider, currContract, defaultGasPrice)

- - -
-
- - -
- Owned contract interact constructor -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contractAddress - - -String - - - - - address where Contract has been deployed
web3Provider - - -String - - - - - web3 provider of network where currContract has been deployed
currContract - - -String - - - - - Contract Instance
defaultGasPrice - - -String - - - - - default Gas Price
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - -
- - - - - - - - - - - - - - -

Methods

- -
- -
-
-

getOwner()

- - -
-
- - -
- Get address of Owner of currContract -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<string> - - - -
-
- - - - - -
- - - -
-
-

initiateOwnerShipTransfer(senderName, proposedOwner, customOptions)

- - -
-
- - -
- Initiate Ownership of currContract -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
senderName - - -string - - - - - Sender of this Transaction
proposedOwner - - -string - - - - - address to which ownership needs to be transferred
customOptions - - -object - - - - - custom params of this transaction
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- -
- - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_contract_interact_owned_contract.html b/docs/module-lib_contract_interact_owned_contract.html deleted file mode 100644 index 6b1bcf2..0000000 --- a/docs/module-lib_contract_interact_owned_contract.html +++ /dev/null @@ -1,311 +0,0 @@ - - - - - - - OpenST Payments Module: lib/contract_interact/owned_contract - - - - - - - - - - - - - -
-
- - -
- -
- - -

Module: lib/contract_interact/owned_contract

-
- -
- -
- - -
-
- - -
This is a utility file which would be used for executing all methods on Owned Contract.

- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - -

Classes

- -
-
OwnedContract
-
-
- - - - - - - - - - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_contract_interact_pricer-MockToken.html b/docs/module-lib_contract_interact_pricer-MockToken.html deleted file mode 100644 index 816d5ec..0000000 --- a/docs/module-lib_contract_interact_pricer-MockToken.html +++ /dev/null @@ -1,1199 +0,0 @@ - - - - - - - OpenST Payments Class: MockToken - - - - - - - - - - - - - -
-
- - -
- -
- - -

Class: MockToken

-
- -
- -

- lib/contract_interact/pricer~ - - MockToken -

- - -
- - -
-
- - -
-
-

new MockToken()

- - -
-
- - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - -
- - - - - - - - - - - - - - -

Methods

- -
- -
-
-

approve(senderAddr, senderPassphrase, spenderAddress, value, gasPrice)

- - -
-
- - -
- Approve -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
senderAddr - - -string - - - - - address of sender
senderPassphrase - - -string - - - - - passphrase of sender
spenderAddress - - -string - - - - - address which will be approved for spending
value - - -BigNumber - - - - - amount which is being approved (in wei)
gasPrice - - -BigNumber - - - - - gas price
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

balanceOf(ownerAddress)

- - -
-
- - -
- Get balance of address -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
ownerAddress - - -String - - - - - address for which balance is to be fetched
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

setBalance(senderAddr, senderPassphrase, ownerAddress, value, gasPrice)

- - -
-
- - -
- Set balance -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
senderAddr - - -string - - - - - address of user who is sending amount
senderPassphrase - - -string - - - - - sender address passphrase
ownerAddress - - -string - - - - - address for which balance is to be set
value - - -BigNumber - - - - - amount which is being transferred (in wei)
gasPrice - - -BigNumber - - - - - gas price
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

setConversionRate(senderAddr, senderPassphrase, conversionRate, gasPrice)

- - -
-
- - -
- Set conversion rate -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
senderAddr - - -string - - - - - address of sender
senderPassphrase - - -string - - - - - passphrase of sender
conversionRate - - -number - - - - - conversion rate of branded token
gasPrice - - -BigNumber - - - - - gas price
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- -
- - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_contract_interact_pricer-Pricer.html b/docs/module-lib_contract_interact_pricer-Pricer.html deleted file mode 100644 index 713de95..0000000 --- a/docs/module-lib_contract_interact_pricer-Pricer.html +++ /dev/null @@ -1,5571 +0,0 @@ - - - - - - - OpenST Payments Class: Pricer - - - - - - - - - - - - - -
-
- - -
- -
- - -

Class: Pricer

-
- -
- -

- lib/contract_interact/pricer~ - - Pricer -

- - -
- - -
-
- - -
-
-

new Pricer(pricerAddress, chainId)

- - -
-
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
pricerAddress - - -string - - - - - Pricer contract address
chainId - - -string - - - - - chain ID
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - -
- - - - - - - - - - - - - - -

Methods

- -
- -
-
-

_asyncPay(spenderAddress, senderPassphrase, beneficiaryAddress, transferAmount, commissionBeneficiaryAddress, commissionAmount, currency, intendedPricePoint, gasPrice, options)

- - -
-
- - -
- Actual Pay - can give rejections of promise -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
spenderAddress - - -string - - - - - address of sender
senderPassphrase - - -string - - - - - passphrase of sender
beneficiaryAddress - - -string - - - - - address of beneficiary account
transferAmount - - -BigNumber - - - - - transfer amount (in wei)
commissionBeneficiaryAddress - - -string - - - - - address of commision beneficiary account
commissionAmount - - -BigNumber - - - - - commission amount (in wei)
currency - - -string - - - - - quote currency
intendedPricePoint - - -BigNumber - - - - - price point at which the pay is intended (in wei)
gasPrice - - -BigNumber - - - - - gas price
options - - -object - - - - - for params like returnType, tag.
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

acceptedMargins(currency)

- - -
-
- - -
- Get acceptable margin for the given currency -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
currency - - -string - - - - - quote currency
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

baseCurrency()

- - -
-
- - -
- Get base currency of pricer -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

brandedToken()

- - -
-
- - -
- Get branded token address of pricer from cache, if not found in cache get from contract -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

conversionRate()

- - -
-
- - -
- Get conversion rate of pricer -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

conversionRateDecimals()

- - -
-
- - -
- Get conversion rate decimals of pricer -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

decimals()

- - -
-
- - -
- Get decimal of pricer -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

getAcceptedMarginsFromContract(currency)

- - -
-
- - -
- Get acceptable margin for the given currency from contract -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
currency - - -string - - - - - quote currency
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

getBalanceOf(owner)

- - -
-
- - -
- Get balance of the account -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
owner - - -string - - - - - account address
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
- 10^18 -
- - - -
-
- Type -
-
- -BigNumer - - - -
-
- - - - - -
- - - -
-
-

getBrandedTokenAddressFromContract()

- - -
-
- - -
- Get branded token address of pricer from contract -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

getConversionRateDecimalsFromContract()

- - -
-
- - -
- Get conversion rate decimals of pricer from contract -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

getConversionRateFromContract()

- - -
-
- - -
- Get conversion rate of pricer from contract -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

getDecimalsFromContract()

- - -
-
- - -
- Get decimal of pricer from contract -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

getEstimatedTotalAmount(transferAmount, commissionAmount, intendedPricePoint)

- - -
-
- - -
- Get estimated total amount -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
transferAmount - - -BigNumber - - - - - Transfer amount
commissionAmount - - -BigNumber - - - - - Commission amount
intendedPricePoint - - -BigNumber - - - - - Intended price point
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -BigNumber - - - -
-
- - - - - -
- - - -
-
-

getPriceOraclesFromContract(currency)

- - -
-
- - -
- Get address of price oracle for the given currency from contract -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
currency - - -string - - - - - quote currency
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

getPricePoint(currency)

- - -
-
- - -
- Get current price point from the price oracle for the give currency -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
currency - - -string - - - - - quote currency
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

getPricePointAndCalculatedAmounts(transferAmount, commissionAmount, currency)

- - -
-
- - -
- Get current price point and calculated token amounts -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
transferAmount - - -BigNumber - - - - - transfer amount (in wei)
commissionAmount - - -BigNumber - - - - - commision amount (in wei)
currency - - -string - - - - - quote currency
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

getPricePointFromContract(currency)

- - -
-
- - -
- Get current price point from the price oracle for the give currency from contract -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
currency - - -string - - - - - quote currency
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

getTxReceipt(transactionHash)

- - -
-
- - -
- Get transaction receipt from transaction hash -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
transactionHash - - -string - - - - - transaction hash
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
- 10^18 -
- - - -
-
- Type -
-
- -BigNumer - - - -
-
- - - - - -
- - - -
-
-

pay(spenderAddress, senderPassphrase, beneficiaryAddress, transferAmount, commissionBeneficiaryAddress, commissionAmount, currency, intendedPricePoint, gasPrice, options)

- - -
-
- - -
- Pay -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
spenderAddress - - -string - - - - - address of sender
senderPassphrase - - -string - - - - - passphrase of sender
beneficiaryAddress - - -string - - - - - address of beneficiary account
transferAmount - - -BigNumber - - - - - transfer amount (in wei)
commissionBeneficiaryAddress - - -string - - - - - address of commision beneficiary account
commissionAmount - - -BigNumber - - - - - commission amount (in wei)
currency - - -string - - - - - quote currency
intendedPricePoint - - -BigNumber - - - - - price point at which the pay is intended (in wei)
gasPrice - - -BigNumber - - - - - gas price
options - - -object - - - - - for params like returnType, tag.
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

priceOracles(currency)

- - -
-
- - -
- Get address of price oracle for the given currency -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
currency - - -string - - - - - quote currency
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

setAcceptedMargin(senderAddress, senderPassphrase, currency, acceptedMargin, gasPrice, options)

- - -
-
- - -
- Set or update the acceptable margin range for a given currency -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
senderAddress - - -string - - - - - address of sender
senderPassphrase - - -string - - - - - passphrase of sender
currency - - -string - - - - - quote currency
acceptedMargin - - -BigNumber - - - - - accepted margin for the given currency (in wei)
gasPrice - - -BigNumber - - - - - gas price
options - - -object - - - - - for params like returnType, tag.
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

setAddressToNameMap()

- - -
-
- - -
- set address to name map -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

setPriceOracle(senderAddress, senderPassphrase, currency, address, gasPrice, options)

- - -
-
- - -
- Set or updates the price oracle address for a given currency -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
senderAddress - - -string - - - - - address of sender
senderPassphrase - - -string - - - - - passphrase of sender
currency - - -string - - - - - quote currency
address - - -string - - - - - address of price pracle
gasPrice - - -BigNumber - - - - - gas price
options - - -object - - - - - for params like returnType, tag.
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

setTokenObj()

- - -
-
- - -
- set token object -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

toWei(value)

- - -
-
- - -
- Convert value in wei -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
value - - -BigNumber - - - - - amount in decimal
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
- 10^18 -
- - - -
-
- Type -
-
- -BigNumer - - - -
-
- - - - - -
- - - -
-
-

unsetPriceOracle(senderAddress, senderPassphrase, currency, gasPrice, options)

- - -
-
- - -
- Remove the price oracle address for a given currency -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
senderAddress - - -string - - - - - address of sender
senderPassphrase - - -string - - - - - passphrase of sender
currency - - -string - - - - - quote currency
gasPrice - - -BigNumber - - - - - gas price
options - - -object - - - - - for params like returnType, tag.
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

validateSetAcceptedMarginParams(senderAddress, currency, acceptedMargin, gasPrice)

- - -
-
- - -
- Validate set accepted margin params parameters -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
senderAddress - - -string - - - - - address of sender
currency - - -string - - - - - quote currency
acceptedMargin - - -BigNumber - - - - - accepted margin for the given currency (in wei)
gasPrice - - -BigNumber - - - - - gas price
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -result - - - -
-
- - - - - -
- - - -
-
-

validateSetPriceOracleParams(senderAddress, currency, address, gasPrice)

- - -
-
- - -
- Validate set price oracle parameters -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
senderAddress - - -string - - - - - address of sender
currency - - -string - - - - - quote currency
address - - -string - - - - - address of price pracle
gasPrice - - -BigNumber - - - - - gas price
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -result - - - -
-
- - - - - -
- - - -
-
-

validateUnsetPriceOracleParams(senderAddress, currency, gasPrice)

- - -
-
- - -
- Validate unset price oracle parameters -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
senderAddress - - -string - - - - - address of sender
currency - - -string - - - - - quote currency
gasPrice - - -BigNumber - - - - - gas price
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

verifyReceiptAndUpdateAcceptedMarginCache(acceptedMargin, currency, receipt)

- - -
-
- - -
- Verify receipt and update accepted margin in cache -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
acceptedMargin - - -BigNumber - - - - - accepted margin for the given currency (in wei)
currency - - -string - - - - - quote currency
receipt - - -Object - - - - - transaction receipt
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- -
- - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_contract_interact_pricer.html b/docs/module-lib_contract_interact_pricer.html deleted file mode 100644 index 9e37e50..0000000 --- a/docs/module-lib_contract_interact_pricer.html +++ /dev/null @@ -1,407 +0,0 @@ - - - - - - - OpenST Payments Module: lib/contract_interact/pricer - - - - - - - - - - - - - -
-
- - -
- -
- - -

Module: lib/contract_interact/pricer

-
- -
- -
- - -
-
- - -
This is a utility file which would be used for executing all methods on Pricer contract.

- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - -

Classes

- -
-
MockToken
-
- -
Pricer
-
-
- - - - - - - - - - - - - -
- -
- - - - -

Module: lib/contract_interact/pricer

-
- -
- -
- - -
-
- - -
This is a utility file which would be used for executing all methods on Pricer contract.

- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - -

Classes

- -
-
MockToken
-
- -
Pricer
-
-
- - - - - - - - - - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_contract_interact_workers-Workers.html b/docs/module-lib_contract_interact_workers-Workers.html deleted file mode 100644 index e2410d4..0000000 --- a/docs/module-lib_contract_interact_workers-Workers.html +++ /dev/null @@ -1,1818 +0,0 @@ - - - - - - - OpenST Payments Class: Workers - - - - - - - - - - - - - -
-
- - -
- -
- - -

Class: Workers

-
- -
- -

- lib/contract_interact/workers~ - - Workers -

- - -
- - -
-
- - -
-
-

new Workers(workerAddress, chainId)

- - -
-
- - -
- Workers contract interact class constructor -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
workerAddress - - -string - - - - - address of worker (external address)
chainId - - -number - - - - - chain id
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - -
- - - - - - - - - - - - - - -

Methods

- -
- -
-
-

_validateRemoveParams(senderAddress, gasPrice)

- - -
-
- - -
- Validate Remove (selfdestruct) params -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
senderAddress - - -string - - - - - address of sender
gasPrice - - -BigNumber - - - - - gas price
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -result - - - -
-
- - - - - -
- - - -
-
-

_validateRemoveWorkerParams(senderAddress, workerAddress, gasPrice)

- - -
-
- - -
- Validate remove worker params -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
senderAddress - - -string - - - - - address of sender
workerAddress - - -string - - - - - worker address
gasPrice - - -BigNumber - - - - - gas price
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -result - - - -
-
- - - - - -
- - - -
-
-

getTxReceipt(transactionHash)

- - -
-
- - -
- Get transaction receipt from transaction hash -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
transactionHash - - -string - - - - - transaction hash -TODO - this can be moved to a util class
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

isWorker(workerAddress)

- - -
-
- - -
- Check if the given worker address is valid or not -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
workerAddress - - -string - - - - - worker address
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

remove(senderAddr, senderPassphrase, gasPrice, object)

- - -
-
- - -
- Remove (selfdestruct) -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
senderAddr - - -string - - - - - address of sender
senderPassphrase - - -string - - - - - passphrase of sender
gasPrice - - -BigNumber - - - - - gas price
object - - -options - - - - - for params like returnType, tag.
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Promise - - - -
-
- - - - - -
- - - -
-
-

removeWorker(senderAddress, senderPassphrase, workerAddress, gasPrice, options)

- - -
-
- - -
- Remove worker -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
senderAddress - - -string - - - - - address of sender
senderPassphrase - - -string - - - - - passphrase of sender
workerAddress - - -string - - - - - worker address
gasPrice - - -BigNumber - - - - - gas price
options - - -object - - - - - for params like returnType, tag.
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

setWorker(senderAddress, senderPassphrase, workerAddress, deactivationHeight, gasPrice, options)

- - -
-
- - -
- Set or update the worker -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
senderAddress - - -string - - - - - address of sender
senderPassphrase - - -string - - - - - passphrase of sender
workerAddress - - -string - - - - - worker address
deactivationHeight - - -number - - - - - block number till which the worker is valid
gasPrice - - -BigNumber - - - - - gas price
options - - -object - - - - - for params like returnType, tag.
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- -
- - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_contract_interact_workers.html b/docs/module-lib_contract_interact_workers.html deleted file mode 100644 index e0f04a6..0000000 --- a/docs/module-lib_contract_interact_workers.html +++ /dev/null @@ -1,311 +0,0 @@ - - - - - - - OpenST Payments Module: lib/contract_interact/workers - - - - - - - - - - - - - -
-
- - -
- -
- - -

Module: lib/contract_interact/workers

-
- -
- -
- - -
-
- - -
This is a utility file which would be used for executing all methods on Workers contract.

- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - -

Classes

- -
-
Workers
-
-
- - - - - - - - - - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_query_builder_mysql-MySQLQueryBuilderKlass.html b/docs/module-lib_query_builder_mysql-MySQLQueryBuilderKlass.html deleted file mode 100644 index 6ae15c5..0000000 --- a/docs/module-lib_query_builder_mysql-MySQLQueryBuilderKlass.html +++ /dev/null @@ -1,2662 +0,0 @@ - - - - - - - OpenST Payments Class: MySQLQueryBuilderKlass - - - - - - - - - - - - - -
-
- - -
- -
- - -

Class: MySQLQueryBuilderKlass

-
- -
- -

- lib/query_builder/mysql~ - - MySQLQueryBuilderKlass -

- - -
- - -
-
- - -
-
-

new MySQLQueryBuilderKlass(params)

- - -
-
- - -
- MySQL query builder constructor -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
params - - -Object - - - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
table_name - - -String - - - - - - - <optional>
- - - - - -
MySQL table name for which query need to be build
- -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - -
- - - - - - - - - - - - - - -

Methods

- -
- -
-
-

<private> _generateDelete()

- - -
-
- - -
- Generate the final DELETE statement -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

<private> _generateInsert()

- - -
-
- - -
- Generate the final INSERT statement -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

<private> _generateSelect()

- - -
-
- - -
- Generate the final SELECT statement -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

<private> _generateUpdate()

- - -
-
- - -
- Generate the final UPDATE statement -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-

delete()

- - -
-
- - -
- Delete row from table - -Example 1: -delete() -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
- oThis -
- - - -
-
- Type -
-
- -object.<self> - - - -
-
- - - - - -
- - - -
-
-

generate()

- - -
-
- - -
- Generate final query supported by mysql node module -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -object.<response> - - - -
-
- - - - - -
- - - -
-
-

group_by()

- - -
-
- - -
- List of fields to be grouped by from table. If called multiple times, group by conditions will be joined by COMMA. - -Possible data types: -* Array - list of field names will be joined by comma -* String - list of field names will be used as it is - -Example 1: -group_by(['name', 'created_at']) - -Example 2: -group_by('name, created_at') -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
- oThis -
- - - -
-
- Type -
-
- -object.<self> - - - -
-
- - - - - -
- - - -
-
-

having()

- - -
-
- - -
- List of fields for having clause. If called multiple times, having conditions will be joined by AND. - -Possible data types: -* Array - index 0 should have the having sub query and other indexes should have the valued to be replaced in sub query -* String - where sub query, used as it is. - -Example 1: Where in array format -having(['MIN(`salary`) < ?', 10]) - -Example 2: condition in string. Will be used as it is -having('MIN(`salary`) < 10') -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
- oThis -
- - - -
-
- Type -
-
- -object.<self> - - - -
-
- - - - - -
- - - -
-
-

insert((object), (object), (object))

- - -
-
- - -
- Insert single record in table. Method can't be called twice on same object - -Example 1: Insert in object format. -insert({name: 'ACMA', id: 10}) -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
(object) - - insertFields - key and value pairs of columns and values to be inserted
(object) - - insertOptions -
(object) - - [insertOptions.touch] - if true, auto insert created_at and updated_at values. Default is true.
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
- oThis -
- - - -
-
- Type -
-
- -object.<self> - - - -
-
- - - - - -
- - - -
-
-

insertMultiple(insertColumns, insertValues, insertOptions)

- - -
-
- - -
- Insert multiple records in table. Method can't be called twice on same object - -Example 1: -insertMultiple(['name', 'symbol'], [['ABC', '123'], ['ABD', '456']]) -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
insertColumns - - -array - - - - - list of columns. also columns are mandatory
insertValues - - -array - - - - - array of array with values
insertOptions - - -object - - - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
touch - - -object - - - - - - - <optional>
- - - - - -
if true, auto insert created_at and updated_at values. Default is true.
- -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
- oThis -
- - - -
-
- Type -
-
- -object.<self> - - - -
-
- - - - - -
- - - -
-
-

limit((number))

- - -
-
- - -
- Limit of records to be fetched. If called multiple times, it will overwrite the previous value - -Example 1: -limit(100) -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
(number) - - recordsLimit - limit for select query
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
- oThis -
- - - -
-
- Type -
-
- -object.<self> - - - -
-
- - - - - -
- - - -
-
-

offset((number))

- - -
-
- - -
- Offset for records to be fetched. If called multiple times, it will overwrite the previous value. limit is mandatory for offset - -Example 1: -offset(10) -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
(number) - - recordsOffset - offset for select query
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
- oThis -
- - - -
-
- Type -
-
- -object.<self> - - - -
-
- - - - - -
- - - -
-
-

onDuplicate()

- - -
-
- - -
- On Duplicate conditions to be applied to the INSERT query. If called multiple times, conditions will be joined by COMMA. - -Possible data types: -* Array - index 0 should have the On Duplicate sub query and other indexes should have the valued to be replaced in sub query -* Object - key and value pairs of columns and values to be joined by COMMA to form On Duplicate sub query -* String - sub query, used as it is. - -Example 1: ON DUPLICATE in array format -onDuplicate(['name=? , id=?', 'ACMA', 10]) - -Example 2: ON DUPLICATE in object format. Conditions will be joined by , -onDuplicate({name: 'ACMA', id: 10}) - -Example 3: ON DUPLICATE in string. Will be used as it is -onDuplicate('id=10') -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
- oThis -
- - - -
-
- Type -
-
- -object.<self> - - - -
-
- - - - - -
- - - -
-
-

order_by()

- - -
-
- - -
- List of fields to be ordered by from table. If called multiple times, order by conditions will be joined by COMMA. - -Possible data types: -* Object - where keys are column names and value is order -* String - order will be used as it is - -Example 1: -order_by({'name': 'ASC', 'created_at': 'DESC'}) - -Example 2: -order_by('name ASC, created_at DESC') - -Example 3: -order_by([1, 2, 3]) -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
- oThis -
- - - -
-
- Type -
-
- -object.<self> - - - -
-
- - - - - -
- - - -
-
-

select()

- - -
-
- - -
- List of fields to be selected from table. If called multiple times, select columns will be joined by COMMA. - -Possible data types: -* blank/undefined - '*' will be used to fetch all columns -* Array - list of field names will be joined by comma -* String - list of field names will be used as it is - -Example 1: '*' will be used to fetch all columns -select() - -Example 2: list of field names in array. Will be joined by comma -select(['name', 'created_at']) - -Example 3: list of field names in string. Will be used as it is -select('name, created_at') -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
- oThis -
- - - -
-
- Type -
-
- -object.<self> - - - -
-
- - - - - -
- - - -
-
-

update(updateFields, insertOptions)

- - -
-
- - -
- Update columns to be applied to the query. If called multiple times, update fields will be joined by COMMA. - -Possible data types: -* Array - index 0 should have the update sub query and other indexes should have the valued to be replaced in sub query -* Object - key and value pairs of columns and values to be joined by COMMA to form update sub query -* String - update sub query, used as it is. -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
updateFields - - -* - - - - - refer possible data types
insertOptions - - -object - - - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
touch - - -object - - - - - - - <optional>
- - - - - -
if true, auto insert created_at and updated_at values. Default is true. - -Example 1: update in array format -update(['name=?, id=?', 'ACMA', 10]) - -Example 2: Update in object format. Fields will be joined by {,} -update({name: 'ACMA', id: 10}) - -Example 3: Update in string. Will be used as it is -update('id=10')
- -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
- oThis -
- - - -
-
- Type -
-
- -object.<self> - - - -
-
- - - - - -
- - - -
-
-

where()

- - -
-
- - -
- Where conditions to be applied to the query. If called multiple times, where conditions will be joined by AND. - -Possible data types: -* Array - index 0 should have the where sub query and other indexes should have the valued to be replaced in sub query -* Object - key and value pairs of columns and values to be joined by AND to form where sub query -* String - where sub query, used as it is. - -Example 1: Where in array format -where(['name=? AND id=?', 'ACMA', 10]) - -Example 2: Where in object format. Conditions will be joined by AND -where({name: 'ACMA', id: 10}) -where({name: [1,2,3], id: 10}) - -Example 3: condition in string. Will be used as it is -where('id=10') -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
- oThis -
- - - -
-
- Type -
-
- -object.<self> - - - -
-
- - - - - -
- -
- - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_query_builder_mysql.html b/docs/module-lib_query_builder_mysql.html deleted file mode 100644 index 45e7a40..0000000 --- a/docs/module-lib_query_builder_mysql.html +++ /dev/null @@ -1,339 +0,0 @@ - - - - - - - OpenST Payments Module: lib/query_builder/mysql - - - - - - - - - - - - - -
-
- - -
- -
- - -

Module: lib/query_builder/mysql

-
- -
- -
- - -
-
- - -
Form mysql query

- - -Max supported SELECT query: -SELECT [columns] - FROM [table] - WHERE [where conditions] - GROUP BY [columns] - ORDER BY [order by columns] - HAVING [having condition] - LIMIT [limit and offset]; - -Max supported INSERT query: -INSERT INTO [table] ([columns]) - VALUES ([values]), ([values]) - ON DUPLICATE KEY UPDATE [conditions]; - -Max supported UPDATE query: -UPDATE [table] - SET [column=value], [column=value] - WHERE [where conditions] - ORDER BY [order by columns] - LIMIT [limit]; - -Max supported DELETE query: -DELETE FROM [table] - WHERE [where conditions] - ORDER BY [order by columns] - LIMIT [limit];
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - -

Classes

- -
-
MySQLQueryBuilderKlass
-
-
- - - - - - - - - - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_set_worker_and_ops-SetWorkerOps.html b/docs/module-lib_set_worker_and_ops-SetWorkerOps.html deleted file mode 100644 index 4acc688..0000000 --- a/docs/module-lib_set_worker_and_ops-SetWorkerOps.html +++ /dev/null @@ -1,603 +0,0 @@ - - - - - - - OpenST Payments Class: SetWorkerOps - - - - - - - - - - - - - -
-
- - -
- -
- - -

Class: SetWorkerOps

-
- -
- -

- lib/set_worker_and_ops~ - - SetWorkerOps -

- - -
- - -
-
- - -
-
-

new SetWorkerOps()

- - -
-
- - -
- Set Worker Contract and OPS Address -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - -
- - - - - - - - - - - - - - -

Methods

- -
- -
-
-

perform( [options])

- - -
-
- - -
- Set Worker and Ops for a contract. -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
options - - -object - - - - - - - <optional>
- - - - - -
-
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
gasPrice - - -number - - - - - - - <optional>
- - - - - -
Gas Price to use
chainId - - -number - - - - - - - <optional>
- - - - - -
Chain Id where contract need to be deployed
- -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Promise.<result> - - - -
-
- - - - - -
- -
- - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_set_worker_and_ops.html b/docs/module-lib_set_worker_and_ops.html deleted file mode 100644 index 4a082d8..0000000 --- a/docs/module-lib_set_worker_and_ops.html +++ /dev/null @@ -1,311 +0,0 @@ - - - - - - - OpenST Payments Module: lib/set_worker_and_ops - - - - - - - - - - - - - -
-
- - -
- -
- - -

Module: lib/set_worker_and_ops

-
- -
- -
- - -
-
- - -
Set Worker Contract and OPS Address
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - -

Classes

- -
-
SetWorkerOps
-
-
- - - - - - - - - - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_transaction_helper-TransactionHelper.html b/docs/module-lib_transaction_helper-TransactionHelper.html deleted file mode 100644 index e8513ca..0000000 --- a/docs/module-lib_transaction_helper-TransactionHelper.html +++ /dev/null @@ -1,3873 +0,0 @@ - - - - - - - OpenST Payments Class: TransactionHelper - - - - - - - - - - - - - -
-
- - -
- -
- - -

Class: TransactionHelper

-
- -
- -

- lib/transaction_helper~ - - TransactionHelper -

- - -
- - -
-
- - -
-
-

new TransactionHelper(chainId)

- - -
-
- - -
- constructor -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
chainId - - -string - - - - - chain id
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - -
- - - - - - - - - - - - - - -

Methods

- -
- -
-
-

afterAirdropPayFailure(brandedTokenAddress, airdropAddress, spenderAddress, estimatedPayAmount, estimatedAirdropAmount, airdropBugdetAddress)

- - -
-
- - -
- After airdrop pay function, this is called after the pay is failed -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
brandedTokenAddress - - -string - - - - - branded token address
airdropAddress - - -string - - - - - airdrop contract address
spenderAddress - - -string - - - - - spender address
estimatedPayAmount - - -BigNumber - - - - - estimated pay amount in weis
estimatedAirdropAmount - - -BigNumber - - - - - estimated airdrop amount
airdropBugdetAddress - - -string - - - - - airdrop budget holder address
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

afterAirdropPaySuccess(brandedTokenAddress, airdropAddress, spenderAddress, estimatedPayAmount, estimatedAirdropAmount, beneficiaryAddress, actualBeneficiaryAmount, commissionBeneficiaryAddress, actualCommissionBeneficiaryAmount, actualAirdropAmount, airdropBugdetAddress)

- - -
-
- - -
- After airdrop pay function, this is called after the pay is successfull -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
brandedTokenAddress - - -string - - - - - branded token address
airdropAddress - - -string - - - - - airdrop contract address
spenderAddress - - -string - - - - - spender address
estimatedPayAmount - - -BigNumber - - - - - estimated pay amount in weis
estimatedAirdropAmount - - -BigNumber - - - - - estimated airdrop amount
beneficiaryAddress - - -string - - - - - beneficiary address
actualBeneficiaryAmount - - -BigNumber - - - - - actual beneficiary amount in weis
commissionBeneficiaryAddress - - -string - - - - - commission beneficiary address
actualCommissionBeneficiaryAmount - - -BigNumber - - - - - actual commission beneficiary amount
actualAirdropAmount - - -BigNumber - - - - - actual airdrop amount
airdropBugdetAddress - - -string - - - - - airdrop budget holder address
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

afterPayFailure(brandedTokenAddress, spenderAddress, estimatedPayAmount)

- - -
-
- - -
- After pay function, this is called after the pay is failed -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
brandedTokenAddress - - -string - - - - - branded token address
spenderAddress - - -string - - - - - spender address
estimatedPayAmount - - -BigNumber - - - - - estimated pay amount in weis
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

afterPaySuccess(brandedTokenAddress, spenderAddress, estimatedPayAmount, beneficiaryAddress, actualBeneficiaryAmount, commissionBeneficiaryAddress, actualCommissionBeneficiaryAmount)

- - -
-
- - -
- After pay function, this is called after the pay is successfull -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
brandedTokenAddress - - -string - - - - - branded token address
spenderAddress - - -string - - - - - spender address
estimatedPayAmount - - -BigNumber - - - - - estimated pay amount in weis
beneficiaryAddress - - -string - - - - - beneficiary address
actualBeneficiaryAmount - - -BigNumber - - - - - actual beneficiary amount in weis
commissionBeneficiaryAddress - - -string - - - - - commission beneficiary address
actualCommissionBeneficiaryAmount - - -BigNumber - - - - - actual commission beneficiary amount
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

beforeAirdropPay(brandedTokenAddress, airdropAddress, spenderAddress, totalTransferAmount, airdropBalanceToUse, airdropBugdetAddress)

- - -
-
- - -
- Before airdrop pay function, this is called before the pay is called -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
brandedTokenAddress - - -string - - - - - branded token address
airdropAddress - - -string - - - - - airdrop contract address
spenderAddress - - -string - - - - - spender address
totalTransferAmount - - -BigNumber - - - - - estimated pay amount in weis
airdropBalanceToUse - - -BigNumber - - - - - estimated airdrop amount
airdropBugdetAddress - - -string - - - - - airdrop budget holder address
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<array.<result>> - - - -
-
- - - - - -
- - - -
-
-

beforePay(brandedTokenAddress, spenderAddress, estimatedPayAmount)

- - -
-
- - -
- Before pay function, this is called before the pay is called -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
brandedTokenAddress - - -string - - - - - branded token address
spenderAddress - - -string - - - - - spender address
estimatedPayAmount - - -BigNumber - - - - - estimated pay amount in weis
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

clearUserDetailCache(airdropContractAddress, owner)

- - -
-
- - -
- Clear user detail cache for the user addressess -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
airdropContractAddress - - -string - - - - - airdrop contract address
owner - - -string - - - - - Account address
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

creditAirdropBalance(airdropContractAddress, owner, bigAmount)

- - -
-
- - -
- Credit airdrop balance in db and clear cache -It decreases airdrop_used_amount for user in user_airdrop_details table -Clears the cache -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
airdropContractAddress - - -string - - - - - airdrop contract address
owner - - -string - - - - - Account address
bigAmount - - -BigNumber - - - - - amount to be credited
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

creditBalance(brandedTokenAddress, owner, bigAmount)

- - -
-
- - -
- Credit balance in cache -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
brandedTokenAddress - - -string - - - - - branded token address
owner - - -string - - - - - Account address
bigAmount - - -BigNumber - - - - - amount to be credited
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

debitAirdropBalance(airdropContractAddress, owner, bigAmount)

- - -
-
- - -
- Debit airdrop balance in db and clear cache -It increases airdrop_used_amount for user in user_airdrop_details table -Clears the cache -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
airdropContractAddress - - -string - - - - - airdrop contract address
owner - - -string - - - - - Account address
bigAmount - - -BigNumber - - - - - amount to be debited
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

debitBalance(brandedTokenAddress, owner, bigAmount)

- - -
-
- - -
- Debit balance in cache -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
brandedTokenAddress - - -string - - - - - branded token address
owner - - -string - - - - - Account address
bigAmount - - -BigNumber - - - - - amount to be debited
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

getActualAmountsFromDecodedEvents(decodedEvent, eventName)

- - -
-
- - -
- Get actual beneficiary amount, actual commission amount and actual airdrop amount from decoded events -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
decodedEvent - - -Object - - - - - Decoded event from receipt
eventName - - -string - - - - - Event name
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -result - - - -
-
- - - - - -
- - - -
-
-

getActualAmountsFromReceipt(transactionReceipt, addressToNameMap, eventName)

- - -
-
- - -
- Get actual beneficiary amount, actual commission amount and actual airdrop amount from transaction receipt -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
transactionReceipt - - -Object - - - - - transaction receipt
addressToNameMap - - -Object - - - - - address to name map object
eventName - - -string - - - - - Event name
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -result - - - -
-
- - - - - -
- - - -
-
-

isAllResponseSuccessful(results)

- - -
-
- - -
- Check if all response is success -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
results - - -array - - - - - response array
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -boolean - - - -
-
- - - - - -
- - - -
-
-

updateAirdropBalance(airdropContractAddress, owner, toCreditBigAmount)

- - -
-
- - -
- Update airdrop balance -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
airdropContractAddress - - -string - - - - - airdrop contract address
owner - - -string - - - - - Account address
toCreditBigAmount - - -BigNumber - - - - - to credit amount - this can be negative also
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- - - -
-
-

updateBalance(brandedTokenAddress, owner, toCreditBigAmount)

- - -
-
- - -
- Update balance to cache -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
brandedTokenAddress - - -string - - - - - branded token address
owner - - -string - - - - - Account address
toCreditBigAmount - - -BigNumber - - - - - to credit amount - this can be negative also
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -promise.<result> - - - -
-
- - - - - -
- -
- - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_transaction_helper.html b/docs/module-lib_transaction_helper.html deleted file mode 100644 index 082686a..0000000 --- a/docs/module-lib_transaction_helper.html +++ /dev/null @@ -1,311 +0,0 @@ - - - - - - - OpenST Payments Module: lib/transaction_helper - - - - - - - - - - - - - -
-
- - -
- -
- - -

Module: lib/transaction_helper

-
- -
- -
- - -
-
- - -
This is transaction helper that manages the cache updation

- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - -

Classes

- -
-
TransactionHelper
-
-
- - - - - - - - - - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_web3_events_formatter-web3EventsDecoder.html b/docs/module-lib_web3_events_formatter-web3EventsDecoder.html deleted file mode 100644 index 1872276..0000000 --- a/docs/module-lib_web3_events_formatter-web3EventsDecoder.html +++ /dev/null @@ -1,491 +0,0 @@ - - - - - - - OpenST Payments Namespace: web3EventsDecoder - - - - - - - - - - - - - -
-
- - -
- -
- - -

Namespace: web3EventsDecoder

-
- -
- -

- lib/web3/events/formatter~ - - web3EventsDecoder -

- - -
- - -
-
- - -
Ivent Decoder.
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - - - - - - - - - -

Methods

- -
- -
-
-

perform(txReceipt, addressToNameMap)

- - -
-
- - -
- performer -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
txReceipt - - -Object - - - - -
addressToNameMap - - -Hash - - - - - Map of the address(key) to name(value)
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - -
- object of resulthelpwe\\er -
- - - -
-
- Type -
-
- -result - - - -
-
- - - - - -
- -
- - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_web3_events_formatter-web3EventsFormatter.html b/docs/module-lib_web3_events_formatter-web3EventsFormatter.html deleted file mode 100644 index f9d8038..0000000 --- a/docs/module-lib_web3_events_formatter-web3EventsFormatter.html +++ /dev/null @@ -1,457 +0,0 @@ - - - - - - - OpenST Payments Namespace: web3EventsFormatter - - - - - - - - - - - - - -
-
- - -
- -
- - -

Namespace: web3EventsFormatter

-
- -
- -

- lib/web3/events/formatter~ - - web3EventsFormatter -

- - -
- - -
-
- - -
Event Formatter.
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - - - - - - - - - -

Methods

- -
- -
-
-

perform(formattedTransactionReceipt)

- - -
-
- - -
- performer -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
formattedTransactionReceipt - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Promise.<{}> - - - -
-
- - - - - -
- -
- - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-lib_web3_events_formatter.html b/docs/module-lib_web3_events_formatter.html deleted file mode 100644 index f222e9b..0000000 --- a/docs/module-lib_web3_events_formatter.html +++ /dev/null @@ -1,407 +0,0 @@ - - - - - - - OpenST Payments Module: lib/web3/events/formatter - - - - - - - - - - - - - -
-
- - -
- -
- - -

Module: lib/web3/events/formatter

-
- -
- -
- - -
-
- - -
Format decoded event into Hash with all the events received into it.
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - - - - - -

Namespaces

- -
-
web3EventsDecoder
-
- -
web3EventsFormatter
-
-
- - - - - - - - - -
- -
- - - - -

Module: lib/web3/events/formatter

-
- -
- -
- - -
-
- - -
Decode logs from a transaction receipt
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - - - - - -

Namespaces

- -
-
web3EventsDecoder
-
- -
web3EventsFormatter
-
-
- - - - - - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-tools_deploy_DeployHelper.html b/docs/module-tools_deploy_DeployHelper.html deleted file mode 100644 index eaeec04..0000000 --- a/docs/module-tools_deploy_DeployHelper.html +++ /dev/null @@ -1,821 +0,0 @@ - - - - - - - OpenST Payments Module: tools/deploy/DeployHelper - - - - - - - - - - - - - -
-
- - -
- -
- - -

Module: tools/deploy/DeployHelper

-
- -
- -
- - -
-
- - -
Deploy Helper class to perform deploy
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - - - - - - - - - -

Methods

- -
- -
-
-

<static> writeContractAddressToFile(fileName, contractAddress)

- - -
-
- - -
- Write contract address to file based on parameter -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fileName - - -String - - - - - file name
contractAddress - - -Hex - - - - - contract Address
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - - - - - -
- - - -
-
-

<async, inner> perform(contractName, web3Provider, contractAbi, contractBin, deployerName [, customOptions] [, constructorArgs])

- - -
-
- - -
- Method deploys contract -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
contractName - - -String - - - - - - - - - - - Contract Name to be deployed
web3Provider - - -Web3 - - - - - - - - - - - Web3 Provider object
contractAbi - - -String - - - - - - - - - - - Contract Abi to be deployed
contractBin - - -String - - - - - - - - - - - Contract Bin file to be deployed
deployerName - - -String - - - - - - - - - - - Deployer name
customOptions - - -Object - - - - - - - <optional>
- - - - - -
Custom options for value/utility chain
constructorArgs - - -Object - - - - - - - <optional>
- - - - - -
Arguments to be passed while deploying contract
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Promise.<Object> - - - -
-
- - - - - -
- -
- - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-tools_deploy_EIP20TokenMock.html b/docs/module-tools_deploy_EIP20TokenMock.html deleted file mode 100644 index 4869ffc..0000000 --- a/docs/module-tools_deploy_EIP20TokenMock.html +++ /dev/null @@ -1,448 +0,0 @@ - - - - - - - OpenST Payments Module: tools/deploy/EIP20TokenMock - - - - - - - - - - - - - -
-
- - -
- -
- - -

Module: tools/deploy/EIP20TokenMock

-
- -
- -
- - -
-
- - -
This is script for deploying Pricer contract on any chain.

- - Prerequisite: -
    -
  1. Deployer Address
  2. -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - - - - - - - - - -

Methods

- -
- -
-
-

<async, inner> performer(arguments)

- - -
-
- - -
- It is the main performer method of this deployment script -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
arguments - - -Array - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - - - - - -
- -
- - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-tools_deploy_helper.html b/docs/module-tools_deploy_helper.html deleted file mode 100644 index d0da17d..0000000 --- a/docs/module-tools_deploy_helper.html +++ /dev/null @@ -1,306 +0,0 @@ - - - - - - - OpenST Payments Module: tools/deploy/helper - - - - - - - - - - - - - -
-
- - -
- -
- - -

Module: tools/deploy/helper

-
- -
- -
- - -
-
- - -
This is utility class for deploying contract

- -Ref: module:tools/deploy/DeployHelper
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-tools_deploy_pricer.html b/docs/module-tools_deploy_pricer.html deleted file mode 100644 index 75f6ac0..0000000 --- a/docs/module-tools_deploy_pricer.html +++ /dev/null @@ -1,1495 +0,0 @@ - - - - - - - OpenST Payments Module: tools/deploy/pricer - - - - - - - - - - - - - -
-
- - -
- -
- - -

Module: tools/deploy/pricer

-
- -
- -
- - -
-
- - -
This is script for deploying Pricer contract on any chain.

- - Prerequisite: -
    -
  1. Deployer Address
  2. -
- - These are the following steps:
-
    -
  1. Deploy Pricer contract
  2. -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - - - - - - - - - -

Methods

- -
- -
-
-

<async, inner> performer(arguments)

- - -
-
- - -
- It is the main performer method of this deployment script -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
arguments - - -Array - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - - - - - -
- - - -
-
-

<async, inner> performer(arguments)

- - -
-
- - -
- It is the main performer method of this deployment script -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
arguments - - -Array - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - - - - - -
- - - -
-
-

<inner> validate(arguments)

- - -
-
- - -
- Validation Method -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
arguments - - -Array - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - - - - - -
- - - -
-
-

<inner> validate(arguments)

- - -
-
- - -
- Validation Method -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
arguments - - -Array - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - - - - - -
- -
- - - - - -
- -
- - - - -

Module: tools/deploy/pricer

-
- -
- -
- - -
-
- - -
This is script for deploying Pricer contract on any chain.

- - Prerequisite: -
    -
  1. Deployer Address
  2. -
- - These are the following steps:
-
    -
  1. Deploy Airdrop contract
  2. -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - - - - - - - - - -

Methods

- -
- -
-
-

<async, inner> performer(arguments)

- - -
-
- - -
- It is the main performer method of this deployment script -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
arguments - - -Array - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - - - - - -
- - - -
-
-

<async, inner> performer(arguments)

- - -
-
- - -
- It is the main performer method of this deployment script -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
arguments - - -Array - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - - - - - -
- - - -
-
-

<inner> validate(arguments)

- - -
-
- - -
- Validation Method -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
arguments - - -Array - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - - - - - -
- - - -
-
-

<inner> validate(arguments)

- - -
-
- - -
- Validation Method -
- - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
arguments - - -Array - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - - - - - -
- -
- - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-tools_deploy_workers.html b/docs/module-tools_deploy_workers.html deleted file mode 100644 index 6877d87..0000000 --- a/docs/module-tools_deploy_workers.html +++ /dev/null @@ -1,406 +0,0 @@ - - - - - - - OpenST Payments Module: tools/deploy/workers - - - - - - - - - - - - - -
-
- - -
- -
- - -

Module: tools/deploy/workers

-
- -
- -
- - -
-
- - -
This is script for deploying Workers contract on any chain.

- - Prerequisite: -
    -
  1. Deployer Address
  2. -
- - These are the following steps:
-
    -
  1. Deploy Workers contract
  2. -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - - - - - - - - - -

Methods

- -
- -
-
-

<async, inner> performer()

- - -
-
- - -
- It is the main performer method of this deployment script - -Example: -node tools/deploy/worker.js gasPrice chainId -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Returns:
- - - - - - - - -
- -
- - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-tools_dynamo_db_init-DynamoDBInit.html b/docs/module-tools_dynamo_db_init-DynamoDBInit.html deleted file mode 100644 index c9389f4..0000000 --- a/docs/module-tools_dynamo_db_init-DynamoDBInit.html +++ /dev/null @@ -1,343 +0,0 @@ - - - - - - - OpenST Payments Class: DynamoDBInit - - - - - - - - - - - - - -
-
- - -
- -
- - -

Class: DynamoDBInit

-
- -
- -

- tools/dynamo_db_init~ - - DynamoDBInit -

- - -
- - -
-
- - -
-
-

new DynamoDBInit()

- - -
-
- - -
- Dynamo db init -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - -
- - - - - - - - - - - - - - - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/module-tools_dynamo_db_init.html b/docs/module-tools_dynamo_db_init.html deleted file mode 100644 index ae952d9..0000000 --- a/docs/module-tools_dynamo_db_init.html +++ /dev/null @@ -1,311 +0,0 @@ - - - - - - - OpenST Payments Module: tools/dynamo_db_init - - - - - - - - - - - - - -
-
- - -
- -
- - -

Module: tools/dynamo_db_init

-
- -
- -
- - -
-
- - -
Dynamo DB init
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - -

Classes

- -
-
DynamoDBInit
-
-
- - - - - - - - - - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/modules.list.html b/docs/modules.list.html deleted file mode 100644 index 0a4433d..0000000 --- a/docs/modules.list.html +++ /dev/null @@ -1,381 +0,0 @@ - - - - - - - OpenST Payments Modules - - - - - - - - - - - - - -
-
- - -
- -
- - -

Modules

-
- -
- -

- -

- - -
- - -
-
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - -

Classes

- -
-
AirdropModelCacheKlass
-
- -
baseCacheManagementKlass
-
- -
baseCacheMultiManagementKlass
-
- -
BasicHelperKlass
-
- -
AdjustAirdropAmountKlass
-
- -
AirdropBalanceCache
-
- -
PricerCache
-
- -
Airdrop
-
- -
BrandedToken
-
- -
ContractInteractHelper
-
- -
OpsManagedContract
-
- -
OwnedContract
-
- -
MockToken
-
- -
Pricer
-
- -
Workers
-
- -
MySQLQueryBuilderKlass
-
- -
SetWorkerOps
-
- -
TransactionHelper
-
- -
DynamoDBInit
-
- -
userAirdropDetailCache
-
-
- - - - - -

Namespaces

- -
-
web3EventsDecoder
-
- -
web3EventsFormatter
-
-
- - - - - - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/namespaces.list.html b/docs/namespaces.list.html deleted file mode 100644 index 445c624..0000000 --- a/docs/namespaces.list.html +++ /dev/null @@ -1,381 +0,0 @@ - - - - - - - OpenST Payments Namespaces - - - - - - - - - - - - - -
-
- - -
- -
- - -

Namespaces

-
- -
- -

- -

- - -
- - -
-
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - -

Classes

- -
-
AirdropModelCacheKlass
-
- -
baseCacheManagementKlass
-
- -
baseCacheMultiManagementKlass
-
- -
BasicHelperKlass
-
- -
AdjustAirdropAmountKlass
-
- -
AirdropBalanceCache
-
- -
PricerCache
-
- -
Airdrop
-
- -
BrandedToken
-
- -
ContractInteractHelper
-
- -
OpsManagedContract
-
- -
OwnedContract
-
- -
MockToken
-
- -
Pricer
-
- -
Workers
-
- -
MySQLQueryBuilderKlass
-
- -
SetWorkerOps
-
- -
TransactionHelper
-
- -
DynamoDBInit
-
- -
userAirdropDetailCache
-
-
- - - - - -

Namespaces

- -
-
web3EventsDecoder
-
- -
web3EventsFormatter
-
-
- - - - - - - - - -
- -
- - - - -
-
- -
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/quicksearch.html b/docs/quicksearch.html deleted file mode 100644 index 0a366cd..0000000 --- a/docs/quicksearch.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - diff --git a/docs/scripts/docstrap.lib.js b/docs/scripts/docstrap.lib.js deleted file mode 100644 index 09d9272..0000000 --- a/docs/scripts/docstrap.lib.js +++ /dev/null @@ -1,11 +0,0 @@ -if(!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){function c(a){var b="length"in a&&a.length,c=_.type(a);return"function"!==c&&!_.isWindow(a)&&(!(1!==a.nodeType||!b)||("array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a))}function d(a,b,c){if(_.isFunction(b))return _.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return _.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(ha.test(b))return _.filter(b,a,c);b=_.filter(b,a)}return _.grep(a,function(a){return U.call(b,a)>=0!==c})}function e(a,b){for(;(a=a[b])&&1!==a.nodeType;);return a}function f(a){var b=oa[a]={};return _.each(a.match(na)||[],function(a,c){b[c]=!0}),b}function g(){Z.removeEventListener("DOMContentLoaded",g,!1),a.removeEventListener("load",g,!1),_.ready()}function h(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=_.expando+h.uid++}function i(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(ua,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c||"false"!==c&&("null"===c?null:+c+""===c?+c:ta.test(c)?_.parseJSON(c):c)}catch(a){}sa.set(a,b,c)}else c=void 0;return c}function j(){return!0}function k(){return!1}function l(){try{return Z.activeElement}catch(a){}}function m(a,b){return _.nodeName(a,"table")&&_.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function n(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function o(a){var b=Ka.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function p(a,b){for(var c=0,d=a.length;d>c;c++)ra.set(a[c],"globalEval",!b||ra.get(b[c],"globalEval"))}function q(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(ra.hasData(a)&&(f=ra.access(a),g=ra.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)_.event.add(b,e,j[e][c])}sa.hasData(a)&&(h=sa.access(a),i=_.extend({},h),sa.set(b,i))}}function r(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&_.nodeName(a,b)?_.merge([a],c):c}function s(a,b){var c=b.nodeName.toLowerCase();"input"===c&&ya.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}function t(b,c){var d,e=_(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:_.css(e[0],"display");return e.detach(),f}function u(a){var b=Z,c=Oa[a];return c||(c=t(a,b),"none"!==c&&c||(Na=(Na||_("