1.0.2 • Published 3 years ago

@nodeberry/solidity-payment-processor v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Solidity Payment Processor

A Library for Processing Stablecoin Payments & ERC20 payments in smart contract development. Built for easier payment processing inside smart contracts.

Supports 50+ ERC20 tokens & all stablecoins. Integrate to your smart contracts with ease.

code style: prettier Code-coverage: 98.44%

Table of contents

Built with


Overview

Prerequisites

The repository is built using hardhat. So it is recommended to install hardhat globally through npm or yarn using the following commands. Also the development of these smart contracts are done in npm version v7.21.1 & NodeJs version v16.1.0

sudo npm i -g hardhat

Installation

$ npm i @nodeberry/solidity-payment-processor

Usage

Once installed, you can use the contracts in the library by importing them:

pragma solidity ^0.8.7;

import "@nodeberry/solidity-payment-processor/contracts/PaymentProcessor.sol";

contract TestProcessor is PaymentProcessor {
    // Initialize Your Smart Contracts
    constructor() PaymentProcessor() {}

    function mockSale(string memory _ticker, uint256 _usd) public virtual {
        // Process Payments Equivalent in USD inside your smart contracts
        // usd should be represented in 8 decimals - 1 USD = 100000000
        payment(_ticker, "", _usd);
    }
}

If you're new to smart contract development, head to Developing Smart Contracts to learn about creating a new project and compiling your contracts.

To keep your system secure, you should always use the installed code as-is, and neither copy-paste it from online sources, nor modify it yourself. The library is designed so that only the contracts and functions you use are deployed, so you don't need to worry about it needlessly increasing gas costs.

Learn More

Project structure

  1. All contract codes, interfaces and utilites imported in the smart contracts can be found at /contracts
  2. All chainlink related contracts are found at /contracts/chainlink
  3. All contract interfaces are found at /contracts/interface.
  4. An example implementation is given at /contracts/example.

All configuration is done in hardhat.config.js & linting configurations are made in .solhint.json & .prettierrc

Directory layout

├── contracts
	├── chainlink
	├── example
	├── interface
	├── mock
	├── PaymentProcessor.sol
├── test
├── .prettierrc
├── .eslintrc.js
├── .solcover.js
├── .solhint.json
├── package.json
├── hardhat.config.js
└── README.md

Testing

For running unit & integration tests:

$ npm run test

To run code-coverage:

$  npm run coverage

Contribute

Nodeberry Contracts exists thanks to its contributors. There are many ways you can participate and help build high quality software.

License

The Contracts are released under the MIT License.

abbrevabort-controlleraes-jsaddressabstract-leveldownagent-baseamdefineacceptsansi-escapesansi-colorsajvadm-zipansi-markanymatchansi-stylesantlr4tsarray-backansi-regexarray-unionargparseasn1array-uniqarray-flattenassert-plusasync-limiterasn1.jsasyncassertion-erroravailable-typed-arraysasync-eventemitterasynckitbalanced-matchbase-xaws-sign2aws4bech32base64-jsbcrypt-pbkdfbignumber.jsbig.jsbinary-extensionsbn.jsbluebirdblakejsbody-parserboolbaseborcbrace-expansionbracesbrorandbrowser-stdoutbrowserify-aesbrowserify-cipherbrowserify-desbrowserify-rsabs58checkbrowserify-signbs58buffer-to-arraybufferbufferbuffer-frombytesbufferutilcacheable-requestbuffer-xorcaselesscall-bindcheck-errorchalkcheeriocamelcasecheerio-selectcborchokidarci-infochownrcidsclass-isclone-responsecliuicolor-convertcipher-basecolor-namecode-point-atcombined-streamconcat-mapcommandercontent-hashcommand-line-argscommand-existscontent-dispositioncontent-typecookie-signaturecore-util-iscookiejarcookiecorscreate-hashcore-js-purecreate-ecdhcrypto-browserifycreate-hmaccrc-32css-whatcross-spawndcss-selectdashdashdecode-uri-componentdeathdebugdecamelizedecompress-responsedeep-eqldefer-to-connectdeep-isdeferred-leveldowndefine-propertiesdelayed-streamdepddelimit-streamdetect-indentdes.jsdiffie-hellmandestroydetect-portdom-serializerdir-globdiffdom-walkdomelementtypeduplexer3domhandleree-firstdomutilsencodeurlemoji-regexecc-jsbnellipticencoding-downend-of-streamentitiesenv-pathsenquirererrnoerror-exes-to-primitivees-abstractescape-htmles6-iteratores6-symbolescape-string-regexpes5-extesprimaetagescodegenestraverseesutilseth-ens-namehashethereum-bloom-filterseth-sig-utileth-libethereumjs-abiethereum-cryptographyethereumjs-txethereumjs-commonethjs-unitethjs-utilevent-target-shimethereum-enseventemitter3exit-on-epipeevp_bytestokeyethereumjs-utilextendextsprintfextexpressfast-levenshteinfast-globfast-deep-equalfinalhandlerfast-json-stable-stringifyfill-rangefind-replacefastqfind-upflatfollow-redirectsfor-eachforever-agentfind-yarn-workspace-rootforeachfreshfp-tsforwardedform-datafs-extrafs-minipassfseventsfs.realpathfunction-bindfunctional-red-black-treeget-caller-fileget-func-nameganache-cliget-streamganache-coregetpassget-intrinsicget-symbol-descriptionghost-testrpcglob-parentglobalglobal-prefixglobglobal-modulesgrowlgraceful-fsglobbygothar-schemahar-validatorhashas-flaghas-symbol-support-xhandlebarshas-to-string-tag-xhas-bigintshash-basehas-symbolshas-tostringtaghehash.jshosted-git-infohighlightjs-solidityhtmlparser2highlight.jshttp-httpshmac-drbghttp-cache-semanticshttp-errorsiconv-liteidna-uts46-hxhttp-signaturehttps-proxy-agentimmutableieee754immediateignoreinflightinheritsiniinternal-slotinvert-kvio-tsinterpretipaddr.jsis-arrayishis-argumentsis-binary-pathis-bigintis-boolean-objectis-callableis-date-objectis-ciis-bufferis-extglobis-fullwidth-code-pointis-dockeris-globis-functionis-generator-functionis-number-objectis-hex-prefixedis-numberis-negative-zerois-plain-objis-regexis-retry-allowedis-objectis-stringis-typed-arrayis-typedarrayis-urlis-streamis-utf8is-symbolisexeisurlisstreamiso-urlis-wsljs-sha3jsbnjson-bufferjs-yamljson-schema-traversejson-stringify-safejsprimjsonschemajson-schemajsonfilejson-text-sequenceklawkeccaklcidkind-ofkeyvlevel-concat-iteratorklaw-synclevel-errorslcov-parselevel-codeclevel-iterator-streamlevel-supportslevel-memlevel-packagerlevnlevel-wslocate-pathlodash.assignload-json-fileleveluplodash.clonedeeplodash.escaperegexplodash.mergelodashlodash.partitionlodash.sumlog-symbolsltgtlog-driverlowercase-keyslru_maplru-cachemedia-typermemorystreammerge-descriptorsmemdownmd5.jsmcl-wasmmerkle-patricia-treemethodsmerge2micromatchmimemiller-rabinmimic-responsemin-documentminimalistic-assertmime-typesmin-indentminimalistic-crypto-utilsminimatchminipassmime-dbminimistminizlibmkdirp-promisemnemonistmsmock-fsmkdirpmultihashesmultibasenegotiatormulticodecnano-json-stream-parsernext-ticknice-trynode-environment-flagsneo-asyncnode-fetchnode-addon-apinode-emojinode-gyp-buildnoptnormalize-package-datanofilternormalize-pathnumber-is-nannumber-to-bnoauth-signnormalize-urlnth-checkobject.assignobject-assignobject-inspectobject-keysoboeon-finishedobject.getownpropertydescriptorsobliteratoronceos-localep-finallyoptionatoropenos-tmpdirp-cancelablep-locatep-timeoutp-limitp-tryparse-asn1parse-jsonpakoparseurlparse5-htmlparser2-tree-adapterpath-existsparse-headerspath-is-absoluteparse5path-keypath-browserifypath-to-regexppatch-packagepath-parseperformance-nowpathvalpbkdf2path-typepinkiepifypinkie-promiseprelude-lspicomatchprepend-httpprintjprettierprrpostinstall-postinstallprocesspublic-encryptpumpproxy-addrpunycodequery-stringquerystringpslrandomfillrange-parserrandombytesread-pkgqueue-microtaskread-pkg-upqsraw-bodyrecursive-readdirrequire-directoryreadable-streamreaddirprequire-main-filenamerequire-from-stringrechoirresponselikeresolverequestrimrafreusifyripemd160rlprun-parallelsafer-bufferrustbn.jssafe-buffersemaphore-async-awaitscrypt-jssendsc-istanbulset-blockingserve-staticsemversecp256k1servifysetprototypeofsetimmediateshebang-commandsha.jsshebang-regexside-channelsimple-getslashshelljssimple-concatsolcspdx-correctsource-map-supportspdx-expression-parsespdx-license-idsspdx-exceptionssource-mapsprintf-jsstatusessshpkstring-widthstacktrace-parserstrict-uri-encodestring.prototype.trimstartstring.prototype.trimendstrip-ansistrip-bomstrip-indentstring_decodersuper-splitstrip-hex-prefixstrip-json-commentssupports-colortest-valueswarm-jstartmptimed-outtestrpctoidentifiertough-cookieto-readable-streamto-regex-rangets-essentialstrue-case-pathtunnel-agenttslibtsortts-generatortweetnacl-utiltype-checktweetnacltype-istypetype-detecttypedarray-to-buffertypechaintype-festultrontypicalunbox-primitiveunpipetypescriptuniversalifyunderscoreuglify-jsurl-parse-laxurl-set-queryurlurl-to-optionsutf-8-validateutils-mergeuri-jsvalidate-npm-package-licenseutil-deprecateutf8varyutilutil.promisifyvarintuuidverrorweb3web3-bzzweb3-coreweb3-core-helpersweb3-core-promieventweb3-core-methodweb3-core-subscriptionsweb3-core-requestmanagerweb3-eth-abiweb3-ethweb3-eth-ibanweb3-eth-accountsweb3-netweb3-eth-personalweb3-eth-contractweb3-providers-httpweb3-providers-wsweb3-shhweb3-providers-ipcweb3-eth-ensweb3-utilswhich-modulewhichwide-alignwebsocketwindow-sizewordwrapwhich-boxed-primitivewrap-ansiwhich-typed-arrayword-wrapwrappyxhr-requestwsxhrxtendxhr-request-promisexhr2-cookiesxmlhttprequestyaetiy18nyargs-parseryallistyargs-unparseryargs
1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago