├── web3js-example ├── public │ ├── robots.txt │ ├── favicon.ico │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ └── index.html ├── src │ ├── setupTests.js │ ├── index.css │ ├── index.js │ ├── App.css │ ├── logo.svg │ ├── ABIs │ │ ├── ERC20.json │ │ ├── PriceOracle.json │ │ ├── AddressProvider.json │ │ ├── AToken.json │ │ └── LendingPool.json │ ├── serviceWorker.js │ └── App.js ├── README.md ├── .gitignore └── package.json ├── README.md ├── .gitignore └── LICENSE /web3js-example/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AaveCodeExamples 2 | 3 | Repo for full code examples that are in the [Aave Documentation](http://docs.aave.com/) -------------------------------------------------------------------------------- /web3js-example/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrdavey/AaveCodeExamples/HEAD/web3js-example/public/favicon.ico -------------------------------------------------------------------------------- /web3js-example/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrdavey/AaveCodeExamples/HEAD/web3js-example/public/logo192.png -------------------------------------------------------------------------------- /web3js-example/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrdavey/AaveCodeExamples/HEAD/web3js-example/public/logo512.png -------------------------------------------------------------------------------- /web3js-example/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom/extend-expect'; 6 | -------------------------------------------------------------------------------- /web3js-example/README.md: -------------------------------------------------------------------------------- 1 | # Aave Code Examples: JavaScript 2 | 3 | Vanilla implementation of Aave functions in JS. 4 | 5 | This repo demonstrates how you should make calls for deposit and borrow. 6 | 7 | Your code style should, of course, be more organised. 8 | 9 | ## To run 10 | ``` 11 | npm install 12 | npm run start 13 | ``` -------------------------------------------------------------------------------- /web3js-example/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /web3js-example/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /web3js-example/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import * as serviceWorker from './serviceWorker'; 6 | 7 | ReactDOM.render( 8 | 9 | 10 | , 11 | document.getElementById('root') 12 | ); 13 | 14 | // If you want your app to work offline and load faster, you can change 15 | // unregister() to register() below. Note this comes with some pitfalls. 16 | // Learn more about service workers: https://bit.ly/CRA-PWA 17 | serviceWorker.unregister(); 18 | -------------------------------------------------------------------------------- /web3js-example/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /web3js-example/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | height: 20vmin; 7 | pointer-events: none; 8 | } 9 | 10 | @media (prefers-reduced-motion: no-preference) { 11 | .App-logo { 12 | animation: App-logo-spin infinite 20s linear; 13 | } 14 | } 15 | 16 | .App-header { 17 | background-color: #282c34; 18 | min-height: 100vh; 19 | display: flex; 20 | flex-direction: column; 21 | align-items: center; 22 | justify-content: center; 23 | font-size: calc(10px + 1vmin); 24 | color: white; 25 | } 26 | 27 | .App-link { 28 | color: #61dafb; 29 | } 30 | 31 | .App-button { 32 | height: 5vmin; 33 | font-size: large; 34 | margin: 10px; 35 | } 36 | 37 | @keyframes App-logo-spin { 38 | from { 39 | transform: rotate(0deg); 40 | } 41 | to { 42 | transform: rotate(360deg); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /web3js-example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aave-web3js-code-examples", 3 | "description": "Aave code examples", 4 | "version": "1.0.0", 5 | "license": "AGPLv3", 6 | "author": "Aave", 7 | "contributors": [ 8 | "David Truong " 9 | ], 10 | "repository": "https://github.com/aave/AaveCodeExamples", 11 | "private": true, 12 | "dependencies": { 13 | "@testing-library/jest-dom": "^4.2.4", 14 | "@testing-library/react": "^9.3.2", 15 | "@testing-library/user-event": "^7.1.2", 16 | "react": "^16.13.1", 17 | "react-dom": "^16.13.1", 18 | "react-scripts": "3.4.1", 19 | "web3": "^1.2.7" 20 | }, 21 | "scripts": { 22 | "start": "react-scripts start", 23 | "build": "react-scripts build", 24 | "test": "react-scripts test", 25 | "eject": "react-scripts eject" 26 | }, 27 | "eslintConfig": { 28 | "extends": "react-app" 29 | }, 30 | "browserslist": { 31 | "production": [ 32 | ">0.2%", 33 | "not dead", 34 | "not op_mini all" 35 | ], 36 | "development": [ 37 | "last 1 chrome version", 38 | "last 1 firefox version", 39 | "last 1 safari version" 40 | ] 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /web3js-example/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | Aave JS code samples 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /web3js-example/src/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # TypeScript v1 declaration files 45 | typings/ 46 | 47 | # TypeScript cache 48 | *.tsbuildinfo 49 | 50 | # Optional npm cache directory 51 | .npm 52 | 53 | # Optional eslint cache 54 | .eslintcache 55 | 56 | # Microbundle cache 57 | .rpt2_cache/ 58 | .rts2_cache_cjs/ 59 | .rts2_cache_es/ 60 | .rts2_cache_umd/ 61 | 62 | # Optional REPL history 63 | .node_repl_history 64 | 65 | # Output of 'npm pack' 66 | *.tgz 67 | 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | 71 | # dotenv environment variables file 72 | .env 73 | .env.test 74 | 75 | # parcel-bundler cache (https://parceljs.org/) 76 | .cache 77 | 78 | # Next.js build output 79 | .next 80 | 81 | # Nuxt.js build / generate output 82 | .nuxt 83 | dist 84 | 85 | # Gatsby files 86 | .cache/ 87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js 88 | # https://nextjs.org/blog/next-9-1#public-directory-support 89 | # public 90 | 91 | # vuepress build output 92 | .vuepress/dist 93 | 94 | # Serverless directories 95 | .serverless/ 96 | 97 | # FuseBox cache 98 | .fusebox/ 99 | 100 | # DynamoDB Local files 101 | .dynamodb/ 102 | 103 | # TernJS port file 104 | .tern-port 105 | -------------------------------------------------------------------------------- /web3js-example/src/ABIs/ERC20.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "constant": true, 4 | "inputs": [], 5 | "name": "name", 6 | "outputs": [ 7 | { 8 | "name": "", 9 | "type": "string" 10 | } 11 | ], 12 | "payable": false, 13 | "stateMutability": "view", 14 | "type": "function" 15 | }, 16 | { 17 | "constant": false, 18 | "inputs": [ 19 | { 20 | "name": "_spender", 21 | "type": "address" 22 | }, 23 | { 24 | "name": "_value", 25 | "type": "uint256" 26 | } 27 | ], 28 | "name": "approve", 29 | "outputs": [ 30 | { 31 | "name": "", 32 | "type": "bool" 33 | } 34 | ], 35 | "payable": false, 36 | "stateMutability": "nonpayable", 37 | "type": "function" 38 | }, 39 | { 40 | "constant": true, 41 | "inputs": [], 42 | "name": "totalSupply", 43 | "outputs": [ 44 | { 45 | "name": "", 46 | "type": "uint256" 47 | } 48 | ], 49 | "payable": false, 50 | "stateMutability": "view", 51 | "type": "function" 52 | }, 53 | { 54 | "constant": false, 55 | "inputs": [ 56 | { 57 | "name": "_from", 58 | "type": "address" 59 | }, 60 | { 61 | "name": "_to", 62 | "type": "address" 63 | }, 64 | { 65 | "name": "_value", 66 | "type": "uint256" 67 | } 68 | ], 69 | "name": "transferFrom", 70 | "outputs": [ 71 | { 72 | "name": "", 73 | "type": "bool" 74 | } 75 | ], 76 | "payable": false, 77 | "stateMutability": "nonpayable", 78 | "type": "function" 79 | }, 80 | { 81 | "constant": true, 82 | "inputs": [], 83 | "name": "decimals", 84 | "outputs": [ 85 | { 86 | "name": "", 87 | "type": "uint8" 88 | } 89 | ], 90 | "payable": false, 91 | "stateMutability": "view", 92 | "type": "function" 93 | }, 94 | { 95 | "constant": true, 96 | "inputs": [ 97 | { 98 | "name": "_owner", 99 | "type": "address" 100 | } 101 | ], 102 | "name": "balanceOf", 103 | "outputs": [ 104 | { 105 | "name": "balance", 106 | "type": "uint256" 107 | } 108 | ], 109 | "payable": false, 110 | "stateMutability": "view", 111 | "type": "function" 112 | }, 113 | { 114 | "constant": true, 115 | "inputs": [], 116 | "name": "symbol", 117 | "outputs": [ 118 | { 119 | "name": "", 120 | "type": "string" 121 | } 122 | ], 123 | "payable": false, 124 | "stateMutability": "view", 125 | "type": "function" 126 | }, 127 | { 128 | "constant": false, 129 | "inputs": [ 130 | { 131 | "name": "_to", 132 | "type": "address" 133 | }, 134 | { 135 | "name": "_value", 136 | "type": "uint256" 137 | } 138 | ], 139 | "name": "transfer", 140 | "outputs": [ 141 | { 142 | "name": "", 143 | "type": "bool" 144 | } 145 | ], 146 | "payable": false, 147 | "stateMutability": "nonpayable", 148 | "type": "function" 149 | }, 150 | { 151 | "constant": true, 152 | "inputs": [ 153 | { 154 | "name": "_owner", 155 | "type": "address" 156 | }, 157 | { 158 | "name": "_spender", 159 | "type": "address" 160 | } 161 | ], 162 | "name": "allowance", 163 | "outputs": [ 164 | { 165 | "name": "", 166 | "type": "uint256" 167 | } 168 | ], 169 | "payable": false, 170 | "stateMutability": "view", 171 | "type": "function" 172 | }, 173 | { 174 | "payable": true, 175 | "stateMutability": "payable", 176 | "type": "fallback" 177 | }, 178 | { 179 | "anonymous": false, 180 | "inputs": [ 181 | { 182 | "indexed": true, 183 | "name": "owner", 184 | "type": "address" 185 | }, 186 | { 187 | "indexed": true, 188 | "name": "spender", 189 | "type": "address" 190 | }, 191 | { 192 | "indexed": false, 193 | "name": "value", 194 | "type": "uint256" 195 | } 196 | ], 197 | "name": "Approval", 198 | "type": "event" 199 | }, 200 | { 201 | "anonymous": false, 202 | "inputs": [ 203 | { 204 | "indexed": true, 205 | "name": "from", 206 | "type": "address" 207 | }, 208 | { 209 | "indexed": true, 210 | "name": "to", 211 | "type": "address" 212 | }, 213 | { 214 | "indexed": false, 215 | "name": "value", 216 | "type": "uint256" 217 | } 218 | ], 219 | "name": "Transfer", 220 | "type": "event" 221 | } 222 | ] 223 | -------------------------------------------------------------------------------- /web3js-example/src/ABIs/PriceOracle.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address[]", 6 | "name": "_assets", 7 | "type": "address[]" 8 | }, 9 | { 10 | "internalType": "address[]", 11 | "name": "_sources", 12 | "type": "address[]" 13 | }, 14 | { 15 | "internalType": "address", 16 | "name": "_fallbackOracle", 17 | "type": "address" 18 | } 19 | ], 20 | "payable": false, 21 | "stateMutability": "nonpayable", 22 | "type": "constructor" 23 | }, 24 | { 25 | "anonymous": false, 26 | "inputs": [ 27 | { 28 | "indexed": true, 29 | "internalType": "address", 30 | "name": "asset", 31 | "type": "address" 32 | }, 33 | { 34 | "indexed": true, 35 | "internalType": "address", 36 | "name": "source", 37 | "type": "address" 38 | } 39 | ], 40 | "name": "AssetSourceUpdated", 41 | "type": "event" 42 | }, 43 | { 44 | "anonymous": false, 45 | "inputs": [ 46 | { 47 | "indexed": true, 48 | "internalType": "address", 49 | "name": "fallbackOracle", 50 | "type": "address" 51 | } 52 | ], 53 | "name": "FallbackOracleUpdated", 54 | "type": "event" 55 | }, 56 | { 57 | "anonymous": false, 58 | "inputs": [ 59 | { 60 | "indexed": true, 61 | "internalType": "address", 62 | "name": "previousOwner", 63 | "type": "address" 64 | }, 65 | { 66 | "indexed": true, 67 | "internalType": "address", 68 | "name": "newOwner", 69 | "type": "address" 70 | } 71 | ], 72 | "name": "OwnershipTransferred", 73 | "type": "event" 74 | }, 75 | { 76 | "constant": true, 77 | "inputs": [], 78 | "name": "isOwner", 79 | "outputs": [ 80 | { 81 | "internalType": "bool", 82 | "name": "", 83 | "type": "bool" 84 | } 85 | ], 86 | "payable": false, 87 | "stateMutability": "view", 88 | "type": "function" 89 | }, 90 | { 91 | "constant": true, 92 | "inputs": [], 93 | "name": "owner", 94 | "outputs": [ 95 | { 96 | "internalType": "address", 97 | "name": "", 98 | "type": "address" 99 | } 100 | ], 101 | "payable": false, 102 | "stateMutability": "view", 103 | "type": "function" 104 | }, 105 | { 106 | "constant": false, 107 | "inputs": [], 108 | "name": "renounceOwnership", 109 | "outputs": [], 110 | "payable": false, 111 | "stateMutability": "nonpayable", 112 | "type": "function" 113 | }, 114 | { 115 | "constant": false, 116 | "inputs": [ 117 | { 118 | "internalType": "address", 119 | "name": "newOwner", 120 | "type": "address" 121 | } 122 | ], 123 | "name": "transferOwnership", 124 | "outputs": [], 125 | "payable": false, 126 | "stateMutability": "nonpayable", 127 | "type": "function" 128 | }, 129 | { 130 | "constant": false, 131 | "inputs": [ 132 | { 133 | "internalType": "address[]", 134 | "name": "_assets", 135 | "type": "address[]" 136 | }, 137 | { 138 | "internalType": "address[]", 139 | "name": "_sources", 140 | "type": "address[]" 141 | } 142 | ], 143 | "name": "setAssetSources", 144 | "outputs": [], 145 | "payable": false, 146 | "stateMutability": "nonpayable", 147 | "type": "function" 148 | }, 149 | { 150 | "constant": false, 151 | "inputs": [ 152 | { 153 | "internalType": "address", 154 | "name": "_fallbackOracle", 155 | "type": "address" 156 | } 157 | ], 158 | "name": "setFallbackOracle", 159 | "outputs": [], 160 | "payable": false, 161 | "stateMutability": "nonpayable", 162 | "type": "function" 163 | }, 164 | { 165 | "constant": true, 166 | "inputs": [ 167 | { 168 | "internalType": "address", 169 | "name": "_asset", 170 | "type": "address" 171 | } 172 | ], 173 | "name": "getAssetPrice", 174 | "outputs": [ 175 | { 176 | "internalType": "uint256", 177 | "name": "", 178 | "type": "uint256" 179 | } 180 | ], 181 | "payable": false, 182 | "stateMutability": "view", 183 | "type": "function" 184 | }, 185 | { 186 | "constant": true, 187 | "inputs": [ 188 | { 189 | "internalType": "address[]", 190 | "name": "_assets", 191 | "type": "address[]" 192 | } 193 | ], 194 | "name": "getAssetsPrices", 195 | "outputs": [ 196 | { 197 | "internalType": "uint256[]", 198 | "name": "", 199 | "type": "uint256[]" 200 | } 201 | ], 202 | "payable": false, 203 | "stateMutability": "view", 204 | "type": "function" 205 | }, 206 | { 207 | "constant": true, 208 | "inputs": [ 209 | { 210 | "internalType": "address", 211 | "name": "_asset", 212 | "type": "address" 213 | } 214 | ], 215 | "name": "getSourceOfAsset", 216 | "outputs": [ 217 | { 218 | "internalType": "address", 219 | "name": "", 220 | "type": "address" 221 | } 222 | ], 223 | "payable": false, 224 | "stateMutability": "view", 225 | "type": "function" 226 | }, 227 | { 228 | "constant": true, 229 | "inputs": [], 230 | "name": "getFallbackOracle", 231 | "outputs": [ 232 | { 233 | "internalType": "address", 234 | "name": "", 235 | "type": "address" 236 | } 237 | ], 238 | "payable": false, 239 | "stateMutability": "view", 240 | "type": "function" 241 | } 242 | ] 243 | -------------------------------------------------------------------------------- /web3js-example/src/serviceWorker.js: -------------------------------------------------------------------------------- 1 | // This optional code is used to register a service worker. 2 | // register() is not called by default. 3 | 4 | // This lets the app load faster on subsequent visits in production, and gives 5 | // it offline capabilities. However, it also means that developers (and users) 6 | // will only see deployed updates on subsequent visits to a page, after all the 7 | // existing tabs open on the page have been closed, since previously cached 8 | // resources are updated in the background. 9 | 10 | // To learn more about the benefits of this model and instructions on how to 11 | // opt-in, read https://bit.ly/CRA-PWA 12 | 13 | const isLocalhost = Boolean( 14 | window.location.hostname === 'localhost' || 15 | // [::1] is the IPv6 localhost address. 16 | window.location.hostname === '[::1]' || 17 | // 127.0.0.0/8 are considered localhost for IPv4. 18 | window.location.hostname.match( 19 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ 20 | ) 21 | ); 22 | 23 | export function register(config) { 24 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { 25 | // The URL constructor is available in all browsers that support SW. 26 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); 27 | if (publicUrl.origin !== window.location.origin) { 28 | // Our service worker won't work if PUBLIC_URL is on a different origin 29 | // from what our page is served on. This might happen if a CDN is used to 30 | // serve assets; see https://github.com/facebook/create-react-app/issues/2374 31 | return; 32 | } 33 | 34 | window.addEventListener('load', () => { 35 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; 36 | 37 | if (isLocalhost) { 38 | // This is running on localhost. Let's check if a service worker still exists or not. 39 | checkValidServiceWorker(swUrl, config); 40 | 41 | // Add some additional logging to localhost, pointing developers to the 42 | // service worker/PWA documentation. 43 | navigator.serviceWorker.ready.then(() => { 44 | console.log( 45 | 'This web app is being served cache-first by a service ' + 46 | 'worker. To learn more, visit https://bit.ly/CRA-PWA' 47 | ); 48 | }); 49 | } else { 50 | // Is not localhost. Just register service worker 51 | registerValidSW(swUrl, config); 52 | } 53 | }); 54 | } 55 | } 56 | 57 | function registerValidSW(swUrl, config) { 58 | navigator.serviceWorker 59 | .register(swUrl) 60 | .then(registration => { 61 | registration.onupdatefound = () => { 62 | const installingWorker = registration.installing; 63 | if (installingWorker == null) { 64 | return; 65 | } 66 | installingWorker.onstatechange = () => { 67 | if (installingWorker.state === 'installed') { 68 | if (navigator.serviceWorker.controller) { 69 | // At this point, the updated precached content has been fetched, 70 | // but the previous service worker will still serve the older 71 | // content until all client tabs are closed. 72 | console.log( 73 | 'New content is available and will be used when all ' + 74 | 'tabs for this page are closed. See https://bit.ly/CRA-PWA.' 75 | ); 76 | 77 | // Execute callback 78 | if (config && config.onUpdate) { 79 | config.onUpdate(registration); 80 | } 81 | } else { 82 | // At this point, everything has been precached. 83 | // It's the perfect time to display a 84 | // "Content is cached for offline use." message. 85 | console.log('Content is cached for offline use.'); 86 | 87 | // Execute callback 88 | if (config && config.onSuccess) { 89 | config.onSuccess(registration); 90 | } 91 | } 92 | } 93 | }; 94 | }; 95 | }) 96 | .catch(error => { 97 | console.error('Error during service worker registration:', error); 98 | }); 99 | } 100 | 101 | function checkValidServiceWorker(swUrl, config) { 102 | // Check if the service worker can be found. If it can't reload the page. 103 | fetch(swUrl, { 104 | headers: { 'Service-Worker': 'script' }, 105 | }) 106 | .then(response => { 107 | // Ensure service worker exists, and that we really are getting a JS file. 108 | const contentType = response.headers.get('content-type'); 109 | if ( 110 | response.status === 404 || 111 | (contentType != null && contentType.indexOf('javascript') === -1) 112 | ) { 113 | // No service worker found. Probably a different app. Reload the page. 114 | navigator.serviceWorker.ready.then(registration => { 115 | registration.unregister().then(() => { 116 | window.location.reload(); 117 | }); 118 | }); 119 | } else { 120 | // Service worker found. Proceed as normal. 121 | registerValidSW(swUrl, config); 122 | } 123 | }) 124 | .catch(() => { 125 | console.log( 126 | 'No internet connection found. App is running in offline mode.' 127 | ); 128 | }); 129 | } 130 | 131 | export function unregister() { 132 | if ('serviceWorker' in navigator) { 133 | navigator.serviceWorker.ready 134 | .then(registration => { 135 | registration.unregister(); 136 | }) 137 | .catch(error => { 138 | console.error(error.message); 139 | }); 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /web3js-example/src/App.js: -------------------------------------------------------------------------------- 1 | import React, { useEffect, useState } from 'react'; 2 | import Web3 from "web3" 3 | import logo from "./logo.svg" 4 | 5 | import './App.css'; 6 | 7 | // ABI imports 8 | import ERC20ABI from './ABIs/ERC20.json' 9 | import LendingPoolAddressProviderABI from './ABIs/AddressProvider.json' 10 | import LendingPoolABI from './ABIs/LendingPool.json' 11 | 12 | function App() { 13 | const [web3, setWeb3] = useState(null) 14 | const [myAddress, setMyAddress] = useState(null) 15 | 16 | useEffect(() => { 17 | async function getAccount() { 18 | const getWeb3 = new Web3(window.ethereum) 19 | window.ethereum.enable() 20 | window.web3 = getWeb3 21 | 22 | setWeb3(getWeb3) 23 | const address = (await getWeb3.eth.getAccounts())[0] 24 | console.log("Wallet address: ", address) 25 | setMyAddress(address) 26 | } 27 | 28 | getAccount() 29 | }, []) 30 | 31 | // Create the LendingPoolAddressProvider contract instance 32 | function getLendingPoolAddressProviderContract() { 33 | const lpAddressProviderAddress = "0x24a42fD28C976A61Df5D00D0599C34c4f90748c8" // mainnet address, for other addresses: https://docs.aave.com/developers/developing-on-aave/deployed-contract-instances 34 | const lpAddressProviderContract = new web3.eth.Contract(LendingPoolAddressProviderABI, lpAddressProviderAddress) 35 | return lpAddressProviderContract 36 | } 37 | 38 | // Get the latest LendingPoolCore address 39 | async function getLendingPoolCoreAddress() { 40 | const lpCoreAddress = await getLendingPoolAddressProviderContract() 41 | .methods.getLendingPoolCore() 42 | .call() 43 | .catch((e) => { 44 | throw Error(`Error getting lendingPool address: ${e.message}`) 45 | }) 46 | 47 | console.log("LendingPoolCore address: ", lpCoreAddress) 48 | return lpCoreAddress 49 | } 50 | 51 | // Get the latest LendingPool address 52 | async function getLendingPoolAddress() { 53 | const lpAddress = await getLendingPoolAddressProviderContract().methods 54 | .getLendingPool() 55 | .call() 56 | .catch((e) => { 57 | throw Error(`Error getting lendingPool address: ${e.message}`) 58 | }) 59 | console.log("LendingPool address: ", lpAddress) 60 | return lpAddress 61 | } 62 | 63 | /** 64 | * Deposit DAI into Aave to receive the equivalent aDAI 65 | * Note: User must have DAI already in their wallet! 66 | */ 67 | async function deposit() { 68 | const daiAmountinWei = web3.utils.toWei("1000", "ether").toString() 69 | const daiAddress = "0x6B175474E89094C44Da98b954EedeAC495271d0F" // mainnet DAI 70 | const referralCode = "0" 71 | 72 | try { 73 | const lpCoreAddress = await getLendingPoolCoreAddress() 74 | 75 | // Approve the LendingPoolCore address with the DAI contract 76 | const daiContract = new web3.eth.Contract(ERC20ABI, daiAddress) 77 | await daiContract.methods 78 | .approve(lpCoreAddress, daiAmountinWei) 79 | .send({ from: myAddress }) 80 | .catch((e) => { 81 | throw Error(`Error approving DAI allowance: ${e.message}`) 82 | }) 83 | 84 | // Make the deposit transaction via LendingPool contract 85 | const lpAddress = await getLendingPoolAddress() 86 | const lpContract = new web3.eth.Contract(LendingPoolABI, lpAddress) 87 | await lpContract.methods 88 | .deposit(daiAddress, daiAmountinWei, referralCode) 89 | .send({ from: myAddress }) 90 | .catch((e) => { 91 | throw Error(`Error depositing to the LendingPool contract: ${e.message}`) 92 | }) 93 | } catch (e) { 94 | alert(e.message) 95 | console.log(e.message) 96 | } 97 | } 98 | 99 | /** 100 | * Borrow DAI from Aave 101 | * Note: User must have already deposited some collateral to borrow 102 | */ 103 | async function borrow() { 104 | const daiAmountinWei = web3.utils.toWei("1000", "ether").toString() 105 | const daiAddress = "0x6B175474E89094C44Da98b954EedeAC495271d0F" // mainnet DAI 106 | const interestRateMode = 2 // variable rate 107 | const referralCode = "0" 108 | 109 | try { 110 | // Make the borrow transaction via LendingPool contract 111 | const lpAddress = await getLendingPoolAddress() 112 | const lpContract = new web3.eth.Contract(LendingPoolABI, lpAddress) 113 | await lpContract.methods 114 | .borrow(daiAddress, daiAmountinWei, interestRateMode, referralCode) 115 | .send({ from: myAddress }) 116 | .catch((e) => { 117 | throw Error(`Error borrowing from the LendingPool contract: ${e.message}`) 118 | }) 119 | } catch (e) { 120 | alert(e.message) 121 | console.log(e.message) 122 | } 123 | } 124 | 125 | /** 126 | * Repay an outstanding borrow with DAI 127 | * Note: User must have borrowed DAI 128 | */ 129 | async function Repay() { 130 | const daiAmountinWei = web3.utils.toWei("1000", "ether").toString() 131 | const daiAddress = "0x6B175474E89094C44Da98b954EedeAC495271d0F" // mainnet DAI 132 | 133 | try { 134 | // Repay via LendingPool contract 135 | const lpAddress = await getLendingPoolAddress() 136 | const lpContract = new web3.eth.Contract(LendingPoolABI, lpAddress) 137 | await lpContract.methods 138 | .repay(daiAddress, daiAmountinWei, myAddress) 139 | .send({ from: myAddress }) 140 | .catch((e) => { 141 | throw Error(`Error repaying in the LendingPool contract: ${e.message}`) 142 | }) 143 | } catch (e) { 144 | alert(e.message) 145 | console.log(e.message) 146 | } 147 | } 148 | 149 | return ( 150 |
151 |
152 | logo 153 |

154 | See our{" "} 155 | 156 | official developer docs 157 | {" "} 158 | for more 159 |

160 | Web3 connected successfully with address: 161 |
162 | {myAddress} 163 |

164 |

165 | 168 | 171 |

172 |
173 |
174 | ) 175 | } 176 | 177 | export default App; 178 | -------------------------------------------------------------------------------- /web3js-example/src/ABIs/AddressProvider.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "newAddress", 9 | "type": "address" 10 | } 11 | ], 12 | "name": "EthereumAddressUpdated", 13 | "type": "event" 14 | }, 15 | { 16 | "anonymous": false, 17 | "inputs": [ 18 | { 19 | "indexed": true, 20 | "internalType": "address", 21 | "name": "newAddress", 22 | "type": "address" 23 | } 24 | ], 25 | "name": "FeeProviderUpdated", 26 | "type": "event" 27 | }, 28 | { 29 | "anonymous": false, 30 | "inputs": [ 31 | { 32 | "indexed": true, 33 | "internalType": "address", 34 | "name": "newAddress", 35 | "type": "address" 36 | } 37 | ], 38 | "name": "LendingPoolConfiguratorUpdated", 39 | "type": "event" 40 | }, 41 | { 42 | "anonymous": false, 43 | "inputs": [ 44 | { 45 | "indexed": true, 46 | "internalType": "address", 47 | "name": "newAddress", 48 | "type": "address" 49 | } 50 | ], 51 | "name": "LendingPoolCoreUpdated", 52 | "type": "event" 53 | }, 54 | { 55 | "anonymous": false, 56 | "inputs": [ 57 | { 58 | "indexed": true, 59 | "internalType": "address", 60 | "name": "newAddress", 61 | "type": "address" 62 | } 63 | ], 64 | "name": "LendingPoolDataProviderUpdated", 65 | "type": "event" 66 | }, 67 | { 68 | "anonymous": false, 69 | "inputs": [ 70 | { 71 | "indexed": true, 72 | "internalType": "address", 73 | "name": "newAddress", 74 | "type": "address" 75 | } 76 | ], 77 | "name": "LendingPoolLiquidationManagerUpdated", 78 | "type": "event" 79 | }, 80 | { 81 | "anonymous": false, 82 | "inputs": [ 83 | { 84 | "indexed": true, 85 | "internalType": "address", 86 | "name": "newAddress", 87 | "type": "address" 88 | } 89 | ], 90 | "name": "LendingPoolManagerUpdated", 91 | "type": "event" 92 | }, 93 | { 94 | "anonymous": false, 95 | "inputs": [ 96 | { 97 | "indexed": true, 98 | "internalType": "address", 99 | "name": "newAddress", 100 | "type": "address" 101 | } 102 | ], 103 | "name": "LendingPoolParametersProviderUpdated", 104 | "type": "event" 105 | }, 106 | { 107 | "anonymous": false, 108 | "inputs": [ 109 | { 110 | "indexed": true, 111 | "internalType": "address", 112 | "name": "newAddress", 113 | "type": "address" 114 | } 115 | ], 116 | "name": "LendingPoolUpdated", 117 | "type": "event" 118 | }, 119 | { 120 | "anonymous": false, 121 | "inputs": [ 122 | { 123 | "indexed": true, 124 | "internalType": "address", 125 | "name": "newAddress", 126 | "type": "address" 127 | } 128 | ], 129 | "name": "LendingRateOracleUpdated", 130 | "type": "event" 131 | }, 132 | { 133 | "anonymous": false, 134 | "inputs": [ 135 | { 136 | "indexed": true, 137 | "internalType": "address", 138 | "name": "previousOwner", 139 | "type": "address" 140 | }, 141 | { 142 | "indexed": true, 143 | "internalType": "address", 144 | "name": "newOwner", 145 | "type": "address" 146 | } 147 | ], 148 | "name": "OwnershipTransferred", 149 | "type": "event" 150 | }, 151 | { 152 | "anonymous": false, 153 | "inputs": [ 154 | { 155 | "indexed": true, 156 | "internalType": "address", 157 | "name": "newAddress", 158 | "type": "address" 159 | } 160 | ], 161 | "name": "PriceOracleUpdated", 162 | "type": "event" 163 | }, 164 | { 165 | "anonymous": false, 166 | "inputs": [ 167 | { 168 | "indexed": false, 169 | "internalType": "bytes32", 170 | "name": "id", 171 | "type": "bytes32" 172 | }, 173 | { 174 | "indexed": true, 175 | "internalType": "address", 176 | "name": "newAddress", 177 | "type": "address" 178 | } 179 | ], 180 | "name": "ProxyCreated", 181 | "type": "event" 182 | }, 183 | { 184 | "anonymous": false, 185 | "inputs": [ 186 | { 187 | "indexed": true, 188 | "internalType": "address", 189 | "name": "newAddress", 190 | "type": "address" 191 | } 192 | ], 193 | "name": "TokenDistributorUpdated", 194 | "type": "event" 195 | }, 196 | { 197 | "constant": true, 198 | "inputs": [ 199 | { 200 | "internalType": "bytes32", 201 | "name": "_key", 202 | "type": "bytes32" 203 | } 204 | ], 205 | "name": "getAddress", 206 | "outputs": [ 207 | { 208 | "internalType": "address", 209 | "name": "", 210 | "type": "address" 211 | } 212 | ], 213 | "payable": false, 214 | "stateMutability": "view", 215 | "type": "function" 216 | }, 217 | { 218 | "constant": true, 219 | "inputs": [], 220 | "name": "isOwner", 221 | "outputs": [ 222 | { 223 | "internalType": "bool", 224 | "name": "", 225 | "type": "bool" 226 | } 227 | ], 228 | "payable": false, 229 | "stateMutability": "view", 230 | "type": "function" 231 | }, 232 | { 233 | "constant": true, 234 | "inputs": [], 235 | "name": "owner", 236 | "outputs": [ 237 | { 238 | "internalType": "address", 239 | "name": "", 240 | "type": "address" 241 | } 242 | ], 243 | "payable": false, 244 | "stateMutability": "view", 245 | "type": "function" 246 | }, 247 | { 248 | "constant": false, 249 | "inputs": [], 250 | "name": "renounceOwnership", 251 | "outputs": [], 252 | "payable": false, 253 | "stateMutability": "nonpayable", 254 | "type": "function" 255 | }, 256 | { 257 | "constant": false, 258 | "inputs": [ 259 | { 260 | "internalType": "address", 261 | "name": "newOwner", 262 | "type": "address" 263 | } 264 | ], 265 | "name": "transferOwnership", 266 | "outputs": [], 267 | "payable": false, 268 | "stateMutability": "nonpayable", 269 | "type": "function" 270 | }, 271 | { 272 | "constant": true, 273 | "inputs": [], 274 | "name": "getLendingPool", 275 | "outputs": [ 276 | { 277 | "internalType": "address", 278 | "name": "", 279 | "type": "address" 280 | } 281 | ], 282 | "payable": false, 283 | "stateMutability": "view", 284 | "type": "function" 285 | }, 286 | { 287 | "constant": false, 288 | "inputs": [ 289 | { 290 | "internalType": "address", 291 | "name": "_pool", 292 | "type": "address" 293 | } 294 | ], 295 | "name": "setLendingPoolImpl", 296 | "outputs": [], 297 | "payable": false, 298 | "stateMutability": "nonpayable", 299 | "type": "function" 300 | }, 301 | { 302 | "constant": true, 303 | "inputs": [], 304 | "name": "getLendingPoolCore", 305 | "outputs": [ 306 | { 307 | "internalType": "address payable", 308 | "name": "", 309 | "type": "address" 310 | } 311 | ], 312 | "payable": false, 313 | "stateMutability": "view", 314 | "type": "function" 315 | }, 316 | { 317 | "constant": false, 318 | "inputs": [ 319 | { 320 | "internalType": "address", 321 | "name": "_lendingPoolCore", 322 | "type": "address" 323 | } 324 | ], 325 | "name": "setLendingPoolCoreImpl", 326 | "outputs": [], 327 | "payable": false, 328 | "stateMutability": "nonpayable", 329 | "type": "function" 330 | }, 331 | { 332 | "constant": true, 333 | "inputs": [], 334 | "name": "getLendingPoolConfigurator", 335 | "outputs": [ 336 | { 337 | "internalType": "address", 338 | "name": "", 339 | "type": "address" 340 | } 341 | ], 342 | "payable": false, 343 | "stateMutability": "view", 344 | "type": "function" 345 | }, 346 | { 347 | "constant": false, 348 | "inputs": [ 349 | { 350 | "internalType": "address", 351 | "name": "_configurator", 352 | "type": "address" 353 | } 354 | ], 355 | "name": "setLendingPoolConfiguratorImpl", 356 | "outputs": [], 357 | "payable": false, 358 | "stateMutability": "nonpayable", 359 | "type": "function" 360 | }, 361 | { 362 | "constant": true, 363 | "inputs": [], 364 | "name": "getLendingPoolDataProvider", 365 | "outputs": [ 366 | { 367 | "internalType": "address", 368 | "name": "", 369 | "type": "address" 370 | } 371 | ], 372 | "payable": false, 373 | "stateMutability": "view", 374 | "type": "function" 375 | }, 376 | { 377 | "constant": false, 378 | "inputs": [ 379 | { 380 | "internalType": "address", 381 | "name": "_provider", 382 | "type": "address" 383 | } 384 | ], 385 | "name": "setLendingPoolDataProviderImpl", 386 | "outputs": [], 387 | "payable": false, 388 | "stateMutability": "nonpayable", 389 | "type": "function" 390 | }, 391 | { 392 | "constant": true, 393 | "inputs": [], 394 | "name": "getLendingPoolParametersProvider", 395 | "outputs": [ 396 | { 397 | "internalType": "address", 398 | "name": "", 399 | "type": "address" 400 | } 401 | ], 402 | "payable": false, 403 | "stateMutability": "view", 404 | "type": "function" 405 | }, 406 | { 407 | "constant": false, 408 | "inputs": [ 409 | { 410 | "internalType": "address", 411 | "name": "_parametersProvider", 412 | "type": "address" 413 | } 414 | ], 415 | "name": "setLendingPoolParametersProviderImpl", 416 | "outputs": [], 417 | "payable": false, 418 | "stateMutability": "nonpayable", 419 | "type": "function" 420 | }, 421 | { 422 | "constant": true, 423 | "inputs": [], 424 | "name": "getFeeProvider", 425 | "outputs": [ 426 | { 427 | "internalType": "address", 428 | "name": "", 429 | "type": "address" 430 | } 431 | ], 432 | "payable": false, 433 | "stateMutability": "view", 434 | "type": "function" 435 | }, 436 | { 437 | "constant": false, 438 | "inputs": [ 439 | { 440 | "internalType": "address", 441 | "name": "_feeProvider", 442 | "type": "address" 443 | } 444 | ], 445 | "name": "setFeeProviderImpl", 446 | "outputs": [], 447 | "payable": false, 448 | "stateMutability": "nonpayable", 449 | "type": "function" 450 | }, 451 | { 452 | "constant": true, 453 | "inputs": [], 454 | "name": "getLendingPoolLiquidationManager", 455 | "outputs": [ 456 | { 457 | "internalType": "address", 458 | "name": "", 459 | "type": "address" 460 | } 461 | ], 462 | "payable": false, 463 | "stateMutability": "view", 464 | "type": "function" 465 | }, 466 | { 467 | "constant": false, 468 | "inputs": [ 469 | { 470 | "internalType": "address", 471 | "name": "_manager", 472 | "type": "address" 473 | } 474 | ], 475 | "name": "setLendingPoolLiquidationManager", 476 | "outputs": [], 477 | "payable": false, 478 | "stateMutability": "nonpayable", 479 | "type": "function" 480 | }, 481 | { 482 | "constant": true, 483 | "inputs": [], 484 | "name": "getLendingPoolManager", 485 | "outputs": [ 486 | { 487 | "internalType": "address", 488 | "name": "", 489 | "type": "address" 490 | } 491 | ], 492 | "payable": false, 493 | "stateMutability": "view", 494 | "type": "function" 495 | }, 496 | { 497 | "constant": false, 498 | "inputs": [ 499 | { 500 | "internalType": "address", 501 | "name": "_lendingPoolManager", 502 | "type": "address" 503 | } 504 | ], 505 | "name": "setLendingPoolManager", 506 | "outputs": [], 507 | "payable": false, 508 | "stateMutability": "nonpayable", 509 | "type": "function" 510 | }, 511 | { 512 | "constant": true, 513 | "inputs": [], 514 | "name": "getPriceOracle", 515 | "outputs": [ 516 | { 517 | "internalType": "address", 518 | "name": "", 519 | "type": "address" 520 | } 521 | ], 522 | "payable": false, 523 | "stateMutability": "view", 524 | "type": "function" 525 | }, 526 | { 527 | "constant": false, 528 | "inputs": [ 529 | { 530 | "internalType": "address", 531 | "name": "_priceOracle", 532 | "type": "address" 533 | } 534 | ], 535 | "name": "setPriceOracle", 536 | "outputs": [], 537 | "payable": false, 538 | "stateMutability": "nonpayable", 539 | "type": "function" 540 | }, 541 | { 542 | "constant": true, 543 | "inputs": [], 544 | "name": "getLendingRateOracle", 545 | "outputs": [ 546 | { 547 | "internalType": "address", 548 | "name": "", 549 | "type": "address" 550 | } 551 | ], 552 | "payable": false, 553 | "stateMutability": "view", 554 | "type": "function" 555 | }, 556 | { 557 | "constant": false, 558 | "inputs": [ 559 | { 560 | "internalType": "address", 561 | "name": "_lendingRateOracle", 562 | "type": "address" 563 | } 564 | ], 565 | "name": "setLendingRateOracle", 566 | "outputs": [], 567 | "payable": false, 568 | "stateMutability": "nonpayable", 569 | "type": "function" 570 | }, 571 | { 572 | "constant": true, 573 | "inputs": [], 574 | "name": "getTokenDistributor", 575 | "outputs": [ 576 | { 577 | "internalType": "address", 578 | "name": "", 579 | "type": "address" 580 | } 581 | ], 582 | "payable": false, 583 | "stateMutability": "view", 584 | "type": "function" 585 | }, 586 | { 587 | "constant": false, 588 | "inputs": [ 589 | { 590 | "internalType": "address", 591 | "name": "_tokenDistributor", 592 | "type": "address" 593 | } 594 | ], 595 | "name": "setTokenDistributor", 596 | "outputs": [], 597 | "payable": false, 598 | "stateMutability": "nonpayable", 599 | "type": "function" 600 | } 601 | ] 602 | -------------------------------------------------------------------------------- /web3js-example/src/ABIs/AToken.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "contract LendingPoolAddressesProvider", 6 | "name": "_addressesProvider", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "address", 11 | "name": "_underlyingAsset", 12 | "type": "address" 13 | }, 14 | { 15 | "internalType": "uint8", 16 | "name": "_underlyingAssetDecimals", 17 | "type": "uint8" 18 | }, 19 | { 20 | "internalType": "string", 21 | "name": "_name", 22 | "type": "string" 23 | }, 24 | { 25 | "internalType": "string", 26 | "name": "_symbol", 27 | "type": "string" 28 | } 29 | ], 30 | "payable": false, 31 | "stateMutability": "nonpayable", 32 | "type": "constructor" 33 | }, 34 | { 35 | "anonymous": false, 36 | "inputs": [ 37 | { 38 | "indexed": true, 39 | "internalType": "address", 40 | "name": "owner", 41 | "type": "address" 42 | }, 43 | { 44 | "indexed": true, 45 | "internalType": "address", 46 | "name": "spender", 47 | "type": "address" 48 | }, 49 | { 50 | "indexed": false, 51 | "internalType": "uint256", 52 | "name": "value", 53 | "type": "uint256" 54 | } 55 | ], 56 | "name": "Approval", 57 | "type": "event" 58 | }, 59 | { 60 | "anonymous": false, 61 | "inputs": [ 62 | { 63 | "indexed": true, 64 | "internalType": "address", 65 | "name": "_from", 66 | "type": "address" 67 | }, 68 | { 69 | "indexed": true, 70 | "internalType": "address", 71 | "name": "_to", 72 | "type": "address" 73 | }, 74 | { 75 | "indexed": false, 76 | "internalType": "uint256", 77 | "name": "_value", 78 | "type": "uint256" 79 | }, 80 | { 81 | "indexed": false, 82 | "internalType": "uint256", 83 | "name": "_fromBalanceIncrease", 84 | "type": "uint256" 85 | }, 86 | { 87 | "indexed": false, 88 | "internalType": "uint256", 89 | "name": "_toBalanceIncrease", 90 | "type": "uint256" 91 | }, 92 | { 93 | "indexed": false, 94 | "internalType": "uint256", 95 | "name": "_fromIndex", 96 | "type": "uint256" 97 | }, 98 | { 99 | "indexed": false, 100 | "internalType": "uint256", 101 | "name": "_toIndex", 102 | "type": "uint256" 103 | } 104 | ], 105 | "name": "BalanceTransfer", 106 | "type": "event" 107 | }, 108 | { 109 | "anonymous": false, 110 | "inputs": [ 111 | { 112 | "indexed": true, 113 | "internalType": "address", 114 | "name": "_from", 115 | "type": "address" 116 | }, 117 | { 118 | "indexed": false, 119 | "internalType": "uint256", 120 | "name": "_value", 121 | "type": "uint256" 122 | }, 123 | { 124 | "indexed": false, 125 | "internalType": "uint256", 126 | "name": "_fromBalanceIncrease", 127 | "type": "uint256" 128 | }, 129 | { 130 | "indexed": false, 131 | "internalType": "uint256", 132 | "name": "_fromIndex", 133 | "type": "uint256" 134 | } 135 | ], 136 | "name": "BurnOnLiquidation", 137 | "type": "event" 138 | }, 139 | { 140 | "anonymous": false, 141 | "inputs": [ 142 | { 143 | "indexed": true, 144 | "internalType": "address", 145 | "name": "_from", 146 | "type": "address" 147 | }, 148 | { 149 | "indexed": true, 150 | "internalType": "address", 151 | "name": "_to", 152 | "type": "address" 153 | } 154 | ], 155 | "name": "InterestRedirectionAllowanceChanged", 156 | "type": "event" 157 | }, 158 | { 159 | "anonymous": false, 160 | "inputs": [ 161 | { 162 | "indexed": true, 163 | "internalType": "address", 164 | "name": "_from", 165 | "type": "address" 166 | }, 167 | { 168 | "indexed": true, 169 | "internalType": "address", 170 | "name": "_to", 171 | "type": "address" 172 | }, 173 | { 174 | "indexed": false, 175 | "internalType": "uint256", 176 | "name": "_redirectedBalance", 177 | "type": "uint256" 178 | }, 179 | { 180 | "indexed": false, 181 | "internalType": "uint256", 182 | "name": "_fromBalanceIncrease", 183 | "type": "uint256" 184 | }, 185 | { 186 | "indexed": false, 187 | "internalType": "uint256", 188 | "name": "_fromIndex", 189 | "type": "uint256" 190 | } 191 | ], 192 | "name": "InterestStreamRedirected", 193 | "type": "event" 194 | }, 195 | { 196 | "anonymous": false, 197 | "inputs": [ 198 | { 199 | "indexed": true, 200 | "internalType": "address", 201 | "name": "_from", 202 | "type": "address" 203 | }, 204 | { 205 | "indexed": false, 206 | "internalType": "uint256", 207 | "name": "_value", 208 | "type": "uint256" 209 | }, 210 | { 211 | "indexed": false, 212 | "internalType": "uint256", 213 | "name": "_fromBalanceIncrease", 214 | "type": "uint256" 215 | }, 216 | { 217 | "indexed": false, 218 | "internalType": "uint256", 219 | "name": "_fromIndex", 220 | "type": "uint256" 221 | } 222 | ], 223 | "name": "MintOnDeposit", 224 | "type": "event" 225 | }, 226 | { 227 | "anonymous": false, 228 | "inputs": [ 229 | { 230 | "indexed": true, 231 | "internalType": "address", 232 | "name": "_from", 233 | "type": "address" 234 | }, 235 | { 236 | "indexed": false, 237 | "internalType": "uint256", 238 | "name": "_value", 239 | "type": "uint256" 240 | }, 241 | { 242 | "indexed": false, 243 | "internalType": "uint256", 244 | "name": "_fromBalanceIncrease", 245 | "type": "uint256" 246 | }, 247 | { 248 | "indexed": false, 249 | "internalType": "uint256", 250 | "name": "_fromIndex", 251 | "type": "uint256" 252 | } 253 | ], 254 | "name": "Redeem", 255 | "type": "event" 256 | }, 257 | { 258 | "anonymous": false, 259 | "inputs": [ 260 | { 261 | "indexed": true, 262 | "internalType": "address", 263 | "name": "_targetAddress", 264 | "type": "address" 265 | }, 266 | { 267 | "indexed": false, 268 | "internalType": "uint256", 269 | "name": "_targetBalanceIncrease", 270 | "type": "uint256" 271 | }, 272 | { 273 | "indexed": false, 274 | "internalType": "uint256", 275 | "name": "_targetIndex", 276 | "type": "uint256" 277 | }, 278 | { 279 | "indexed": false, 280 | "internalType": "uint256", 281 | "name": "_redirectedBalanceAdded", 282 | "type": "uint256" 283 | }, 284 | { 285 | "indexed": false, 286 | "internalType": "uint256", 287 | "name": "_redirectedBalanceRemoved", 288 | "type": "uint256" 289 | } 290 | ], 291 | "name": "RedirectedBalanceUpdated", 292 | "type": "event" 293 | }, 294 | { 295 | "anonymous": false, 296 | "inputs": [ 297 | { 298 | "indexed": true, 299 | "internalType": "address", 300 | "name": "from", 301 | "type": "address" 302 | }, 303 | { 304 | "indexed": true, 305 | "internalType": "address", 306 | "name": "to", 307 | "type": "address" 308 | }, 309 | { 310 | "indexed": false, 311 | "internalType": "uint256", 312 | "name": "value", 313 | "type": "uint256" 314 | } 315 | ], 316 | "name": "Transfer", 317 | "type": "event" 318 | }, 319 | { 320 | "constant": true, 321 | "inputs": [], 322 | "name": "UINT_MAX_VALUE", 323 | "outputs": [ 324 | { 325 | "internalType": "uint256", 326 | "name": "", 327 | "type": "uint256" 328 | } 329 | ], 330 | "payable": false, 331 | "stateMutability": "view", 332 | "type": "function" 333 | }, 334 | { 335 | "constant": true, 336 | "inputs": [ 337 | { 338 | "internalType": "address", 339 | "name": "owner", 340 | "type": "address" 341 | }, 342 | { 343 | "internalType": "address", 344 | "name": "spender", 345 | "type": "address" 346 | } 347 | ], 348 | "name": "allowance", 349 | "outputs": [ 350 | { 351 | "internalType": "uint256", 352 | "name": "", 353 | "type": "uint256" 354 | } 355 | ], 356 | "payable": false, 357 | "stateMutability": "view", 358 | "type": "function" 359 | }, 360 | { 361 | "constant": false, 362 | "inputs": [ 363 | { 364 | "internalType": "address", 365 | "name": "spender", 366 | "type": "address" 367 | }, 368 | { 369 | "internalType": "uint256", 370 | "name": "value", 371 | "type": "uint256" 372 | } 373 | ], 374 | "name": "approve", 375 | "outputs": [ 376 | { 377 | "internalType": "bool", 378 | "name": "", 379 | "type": "bool" 380 | } 381 | ], 382 | "payable": false, 383 | "stateMutability": "nonpayable", 384 | "type": "function" 385 | }, 386 | { 387 | "constant": true, 388 | "inputs": [], 389 | "name": "decimals", 390 | "outputs": [ 391 | { 392 | "internalType": "uint8", 393 | "name": "", 394 | "type": "uint8" 395 | } 396 | ], 397 | "payable": false, 398 | "stateMutability": "view", 399 | "type": "function" 400 | }, 401 | { 402 | "constant": false, 403 | "inputs": [ 404 | { 405 | "internalType": "address", 406 | "name": "spender", 407 | "type": "address" 408 | }, 409 | { 410 | "internalType": "uint256", 411 | "name": "subtractedValue", 412 | "type": "uint256" 413 | } 414 | ], 415 | "name": "decreaseAllowance", 416 | "outputs": [ 417 | { 418 | "internalType": "bool", 419 | "name": "", 420 | "type": "bool" 421 | } 422 | ], 423 | "payable": false, 424 | "stateMutability": "nonpayable", 425 | "type": "function" 426 | }, 427 | { 428 | "constant": false, 429 | "inputs": [ 430 | { 431 | "internalType": "address", 432 | "name": "spender", 433 | "type": "address" 434 | }, 435 | { 436 | "internalType": "uint256", 437 | "name": "addedValue", 438 | "type": "uint256" 439 | } 440 | ], 441 | "name": "increaseAllowance", 442 | "outputs": [ 443 | { 444 | "internalType": "bool", 445 | "name": "", 446 | "type": "bool" 447 | } 448 | ], 449 | "payable": false, 450 | "stateMutability": "nonpayable", 451 | "type": "function" 452 | }, 453 | { 454 | "constant": true, 455 | "inputs": [], 456 | "name": "name", 457 | "outputs": [ 458 | { 459 | "internalType": "string", 460 | "name": "", 461 | "type": "string" 462 | } 463 | ], 464 | "payable": false, 465 | "stateMutability": "view", 466 | "type": "function" 467 | }, 468 | { 469 | "constant": true, 470 | "inputs": [], 471 | "name": "symbol", 472 | "outputs": [ 473 | { 474 | "internalType": "string", 475 | "name": "", 476 | "type": "string" 477 | } 478 | ], 479 | "payable": false, 480 | "stateMutability": "view", 481 | "type": "function" 482 | }, 483 | { 484 | "constant": false, 485 | "inputs": [ 486 | { 487 | "internalType": "address", 488 | "name": "recipient", 489 | "type": "address" 490 | }, 491 | { 492 | "internalType": "uint256", 493 | "name": "amount", 494 | "type": "uint256" 495 | } 496 | ], 497 | "name": "transfer", 498 | "outputs": [ 499 | { 500 | "internalType": "bool", 501 | "name": "", 502 | "type": "bool" 503 | } 504 | ], 505 | "payable": false, 506 | "stateMutability": "nonpayable", 507 | "type": "function" 508 | }, 509 | { 510 | "constant": false, 511 | "inputs": [ 512 | { 513 | "internalType": "address", 514 | "name": "sender", 515 | "type": "address" 516 | }, 517 | { 518 | "internalType": "address", 519 | "name": "recipient", 520 | "type": "address" 521 | }, 522 | { 523 | "internalType": "uint256", 524 | "name": "amount", 525 | "type": "uint256" 526 | } 527 | ], 528 | "name": "transferFrom", 529 | "outputs": [ 530 | { 531 | "internalType": "bool", 532 | "name": "", 533 | "type": "bool" 534 | } 535 | ], 536 | "payable": false, 537 | "stateMutability": "nonpayable", 538 | "type": "function" 539 | }, 540 | { 541 | "constant": true, 542 | "inputs": [], 543 | "name": "underlyingAssetAddress", 544 | "outputs": [ 545 | { 546 | "internalType": "address", 547 | "name": "", 548 | "type": "address" 549 | } 550 | ], 551 | "payable": false, 552 | "stateMutability": "view", 553 | "type": "function" 554 | }, 555 | { 556 | "constant": false, 557 | "inputs": [ 558 | { 559 | "internalType": "address", 560 | "name": "_to", 561 | "type": "address" 562 | } 563 | ], 564 | "name": "redirectInterestStream", 565 | "outputs": [], 566 | "payable": false, 567 | "stateMutability": "nonpayable", 568 | "type": "function" 569 | }, 570 | { 571 | "constant": false, 572 | "inputs": [ 573 | { 574 | "internalType": "address", 575 | "name": "_from", 576 | "type": "address" 577 | }, 578 | { 579 | "internalType": "address", 580 | "name": "_to", 581 | "type": "address" 582 | } 583 | ], 584 | "name": "redirectInterestStreamOf", 585 | "outputs": [], 586 | "payable": false, 587 | "stateMutability": "nonpayable", 588 | "type": "function" 589 | }, 590 | { 591 | "constant": false, 592 | "inputs": [ 593 | { 594 | "internalType": "address", 595 | "name": "_to", 596 | "type": "address" 597 | } 598 | ], 599 | "name": "allowInterestRedirectionTo", 600 | "outputs": [], 601 | "payable": false, 602 | "stateMutability": "nonpayable", 603 | "type": "function" 604 | }, 605 | { 606 | "constant": false, 607 | "inputs": [ 608 | { 609 | "internalType": "uint256", 610 | "name": "_amount", 611 | "type": "uint256" 612 | } 613 | ], 614 | "name": "redeem", 615 | "outputs": [], 616 | "payable": false, 617 | "stateMutability": "nonpayable", 618 | "type": "function" 619 | }, 620 | { 621 | "constant": false, 622 | "inputs": [ 623 | { 624 | "internalType": "address", 625 | "name": "_account", 626 | "type": "address" 627 | }, 628 | { 629 | "internalType": "uint256", 630 | "name": "_amount", 631 | "type": "uint256" 632 | } 633 | ], 634 | "name": "mintOnDeposit", 635 | "outputs": [], 636 | "payable": false, 637 | "stateMutability": "nonpayable", 638 | "type": "function" 639 | }, 640 | { 641 | "constant": false, 642 | "inputs": [ 643 | { 644 | "internalType": "address", 645 | "name": "_account", 646 | "type": "address" 647 | }, 648 | { 649 | "internalType": "uint256", 650 | "name": "_value", 651 | "type": "uint256" 652 | } 653 | ], 654 | "name": "burnOnLiquidation", 655 | "outputs": [], 656 | "payable": false, 657 | "stateMutability": "nonpayable", 658 | "type": "function" 659 | }, 660 | { 661 | "constant": false, 662 | "inputs": [ 663 | { 664 | "internalType": "address", 665 | "name": "_from", 666 | "type": "address" 667 | }, 668 | { 669 | "internalType": "address", 670 | "name": "_to", 671 | "type": "address" 672 | }, 673 | { 674 | "internalType": "uint256", 675 | "name": "_value", 676 | "type": "uint256" 677 | } 678 | ], 679 | "name": "transferOnLiquidation", 680 | "outputs": [], 681 | "payable": false, 682 | "stateMutability": "nonpayable", 683 | "type": "function" 684 | }, 685 | { 686 | "constant": true, 687 | "inputs": [ 688 | { 689 | "internalType": "address", 690 | "name": "_user", 691 | "type": "address" 692 | } 693 | ], 694 | "name": "balanceOf", 695 | "outputs": [ 696 | { 697 | "internalType": "uint256", 698 | "name": "", 699 | "type": "uint256" 700 | } 701 | ], 702 | "payable": false, 703 | "stateMutability": "view", 704 | "type": "function" 705 | }, 706 | { 707 | "constant": true, 708 | "inputs": [ 709 | { 710 | "internalType": "address", 711 | "name": "_user", 712 | "type": "address" 713 | } 714 | ], 715 | "name": "principalBalanceOf", 716 | "outputs": [ 717 | { 718 | "internalType": "uint256", 719 | "name": "", 720 | "type": "uint256" 721 | } 722 | ], 723 | "payable": false, 724 | "stateMutability": "view", 725 | "type": "function" 726 | }, 727 | { 728 | "constant": true, 729 | "inputs": [], 730 | "name": "totalSupply", 731 | "outputs": [ 732 | { 733 | "internalType": "uint256", 734 | "name": "", 735 | "type": "uint256" 736 | } 737 | ], 738 | "payable": false, 739 | "stateMutability": "view", 740 | "type": "function" 741 | }, 742 | { 743 | "constant": true, 744 | "inputs": [ 745 | { 746 | "internalType": "address", 747 | "name": "_user", 748 | "type": "address" 749 | }, 750 | { 751 | "internalType": "uint256", 752 | "name": "_amount", 753 | "type": "uint256" 754 | } 755 | ], 756 | "name": "isTransferAllowed", 757 | "outputs": [ 758 | { 759 | "internalType": "bool", 760 | "name": "", 761 | "type": "bool" 762 | } 763 | ], 764 | "payable": false, 765 | "stateMutability": "view", 766 | "type": "function" 767 | }, 768 | { 769 | "constant": true, 770 | "inputs": [ 771 | { 772 | "internalType": "address", 773 | "name": "_user", 774 | "type": "address" 775 | } 776 | ], 777 | "name": "getUserIndex", 778 | "outputs": [ 779 | { 780 | "internalType": "uint256", 781 | "name": "", 782 | "type": "uint256" 783 | } 784 | ], 785 | "payable": false, 786 | "stateMutability": "view", 787 | "type": "function" 788 | }, 789 | { 790 | "constant": true, 791 | "inputs": [ 792 | { 793 | "internalType": "address", 794 | "name": "_user", 795 | "type": "address" 796 | } 797 | ], 798 | "name": "getInterestRedirectionAddress", 799 | "outputs": [ 800 | { 801 | "internalType": "address", 802 | "name": "", 803 | "type": "address" 804 | } 805 | ], 806 | "payable": false, 807 | "stateMutability": "view", 808 | "type": "function" 809 | }, 810 | { 811 | "constant": true, 812 | "inputs": [ 813 | { 814 | "internalType": "address", 815 | "name": "_user", 816 | "type": "address" 817 | } 818 | ], 819 | "name": "getRedirectedBalance", 820 | "outputs": [ 821 | { 822 | "internalType": "uint256", 823 | "name": "", 824 | "type": "uint256" 825 | } 826 | ], 827 | "payable": false, 828 | "stateMutability": "view", 829 | "type": "function" 830 | } 831 | ] 832 | -------------------------------------------------------------------------------- /web3js-example/src/ABIs/LendingPool.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "_reserve", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": true, 13 | "internalType": "address", 14 | "name": "_user", 15 | "type": "address" 16 | }, 17 | { 18 | "indexed": false, 19 | "internalType": "uint256", 20 | "name": "_amount", 21 | "type": "uint256" 22 | }, 23 | { 24 | "indexed": false, 25 | "internalType": "uint256", 26 | "name": "_borrowRateMode", 27 | "type": "uint256" 28 | }, 29 | { 30 | "indexed": false, 31 | "internalType": "uint256", 32 | "name": "_borrowRate", 33 | "type": "uint256" 34 | }, 35 | { 36 | "indexed": false, 37 | "internalType": "uint256", 38 | "name": "_originationFee", 39 | "type": "uint256" 40 | }, 41 | { 42 | "indexed": false, 43 | "internalType": "uint256", 44 | "name": "_borrowBalanceIncrease", 45 | "type": "uint256" 46 | }, 47 | { 48 | "indexed": true, 49 | "internalType": "uint16", 50 | "name": "_referral", 51 | "type": "uint16" 52 | }, 53 | { 54 | "indexed": false, 55 | "internalType": "uint256", 56 | "name": "_timestamp", 57 | "type": "uint256" 58 | } 59 | ], 60 | "name": "Borrow", 61 | "type": "event" 62 | }, 63 | { 64 | "anonymous": false, 65 | "inputs": [ 66 | { 67 | "indexed": true, 68 | "internalType": "address", 69 | "name": "_reserve", 70 | "type": "address" 71 | }, 72 | { 73 | "indexed": true, 74 | "internalType": "address", 75 | "name": "_user", 76 | "type": "address" 77 | }, 78 | { 79 | "indexed": false, 80 | "internalType": "uint256", 81 | "name": "_amount", 82 | "type": "uint256" 83 | }, 84 | { 85 | "indexed": true, 86 | "internalType": "uint16", 87 | "name": "_referral", 88 | "type": "uint16" 89 | }, 90 | { 91 | "indexed": false, 92 | "internalType": "uint256", 93 | "name": "_timestamp", 94 | "type": "uint256" 95 | } 96 | ], 97 | "name": "Deposit", 98 | "type": "event" 99 | }, 100 | { 101 | "anonymous": false, 102 | "inputs": [ 103 | { 104 | "indexed": true, 105 | "internalType": "address", 106 | "name": "_target", 107 | "type": "address" 108 | }, 109 | { 110 | "indexed": true, 111 | "internalType": "address", 112 | "name": "_reserve", 113 | "type": "address" 114 | }, 115 | { 116 | "indexed": false, 117 | "internalType": "uint256", 118 | "name": "_amount", 119 | "type": "uint256" 120 | }, 121 | { 122 | "indexed": false, 123 | "internalType": "uint256", 124 | "name": "_totalFee", 125 | "type": "uint256" 126 | }, 127 | { 128 | "indexed": false, 129 | "internalType": "uint256", 130 | "name": "_protocolFee", 131 | "type": "uint256" 132 | }, 133 | { 134 | "indexed": false, 135 | "internalType": "uint256", 136 | "name": "_timestamp", 137 | "type": "uint256" 138 | } 139 | ], 140 | "name": "FlashLoan", 141 | "type": "event" 142 | }, 143 | { 144 | "anonymous": false, 145 | "inputs": [ 146 | { 147 | "indexed": true, 148 | "internalType": "address", 149 | "name": "_collateral", 150 | "type": "address" 151 | }, 152 | { 153 | "indexed": true, 154 | "internalType": "address", 155 | "name": "_reserve", 156 | "type": "address" 157 | }, 158 | { 159 | "indexed": true, 160 | "internalType": "address", 161 | "name": "_user", 162 | "type": "address" 163 | }, 164 | { 165 | "indexed": false, 166 | "internalType": "uint256", 167 | "name": "_purchaseAmount", 168 | "type": "uint256" 169 | }, 170 | { 171 | "indexed": false, 172 | "internalType": "uint256", 173 | "name": "_liquidatedCollateralAmount", 174 | "type": "uint256" 175 | }, 176 | { 177 | "indexed": false, 178 | "internalType": "uint256", 179 | "name": "_accruedBorrowInterest", 180 | "type": "uint256" 181 | }, 182 | { 183 | "indexed": false, 184 | "internalType": "address", 185 | "name": "_liquidator", 186 | "type": "address" 187 | }, 188 | { 189 | "indexed": false, 190 | "internalType": "bool", 191 | "name": "_receiveAToken", 192 | "type": "bool" 193 | }, 194 | { 195 | "indexed": false, 196 | "internalType": "uint256", 197 | "name": "_timestamp", 198 | "type": "uint256" 199 | } 200 | ], 201 | "name": "LiquidationCall", 202 | "type": "event" 203 | }, 204 | { 205 | "anonymous": false, 206 | "inputs": [ 207 | { 208 | "indexed": true, 209 | "internalType": "address", 210 | "name": "_collateral", 211 | "type": "address" 212 | }, 213 | { 214 | "indexed": true, 215 | "internalType": "address", 216 | "name": "_reserve", 217 | "type": "address" 218 | }, 219 | { 220 | "indexed": true, 221 | "internalType": "address", 222 | "name": "_user", 223 | "type": "address" 224 | }, 225 | { 226 | "indexed": false, 227 | "internalType": "uint256", 228 | "name": "_feeLiquidated", 229 | "type": "uint256" 230 | }, 231 | { 232 | "indexed": false, 233 | "internalType": "uint256", 234 | "name": "_liquidatedCollateralForFee", 235 | "type": "uint256" 236 | }, 237 | { 238 | "indexed": false, 239 | "internalType": "uint256", 240 | "name": "_timestamp", 241 | "type": "uint256" 242 | } 243 | ], 244 | "name": "OriginationFeeLiquidated", 245 | "type": "event" 246 | }, 247 | { 248 | "anonymous": false, 249 | "inputs": [ 250 | { 251 | "indexed": true, 252 | "internalType": "address", 253 | "name": "_reserve", 254 | "type": "address" 255 | }, 256 | { 257 | "indexed": true, 258 | "internalType": "address", 259 | "name": "_user", 260 | "type": "address" 261 | }, 262 | { 263 | "indexed": false, 264 | "internalType": "uint256", 265 | "name": "_newStableRate", 266 | "type": "uint256" 267 | }, 268 | { 269 | "indexed": false, 270 | "internalType": "uint256", 271 | "name": "_borrowBalanceIncrease", 272 | "type": "uint256" 273 | }, 274 | { 275 | "indexed": false, 276 | "internalType": "uint256", 277 | "name": "_timestamp", 278 | "type": "uint256" 279 | } 280 | ], 281 | "name": "RebalanceStableBorrowRate", 282 | "type": "event" 283 | }, 284 | { 285 | "anonymous": false, 286 | "inputs": [ 287 | { 288 | "indexed": true, 289 | "internalType": "address", 290 | "name": "_reserve", 291 | "type": "address" 292 | }, 293 | { 294 | "indexed": true, 295 | "internalType": "address", 296 | "name": "_user", 297 | "type": "address" 298 | }, 299 | { 300 | "indexed": false, 301 | "internalType": "uint256", 302 | "name": "_amount", 303 | "type": "uint256" 304 | }, 305 | { 306 | "indexed": false, 307 | "internalType": "uint256", 308 | "name": "_timestamp", 309 | "type": "uint256" 310 | } 311 | ], 312 | "name": "RedeemUnderlying", 313 | "type": "event" 314 | }, 315 | { 316 | "anonymous": false, 317 | "inputs": [ 318 | { 319 | "indexed": true, 320 | "internalType": "address", 321 | "name": "_reserve", 322 | "type": "address" 323 | }, 324 | { 325 | "indexed": true, 326 | "internalType": "address", 327 | "name": "_user", 328 | "type": "address" 329 | }, 330 | { 331 | "indexed": true, 332 | "internalType": "address", 333 | "name": "_repayer", 334 | "type": "address" 335 | }, 336 | { 337 | "indexed": false, 338 | "internalType": "uint256", 339 | "name": "_amountMinusFees", 340 | "type": "uint256" 341 | }, 342 | { 343 | "indexed": false, 344 | "internalType": "uint256", 345 | "name": "_fees", 346 | "type": "uint256" 347 | }, 348 | { 349 | "indexed": false, 350 | "internalType": "uint256", 351 | "name": "_borrowBalanceIncrease", 352 | "type": "uint256" 353 | }, 354 | { 355 | "indexed": false, 356 | "internalType": "uint256", 357 | "name": "_timestamp", 358 | "type": "uint256" 359 | } 360 | ], 361 | "name": "Repay", 362 | "type": "event" 363 | }, 364 | { 365 | "anonymous": false, 366 | "inputs": [ 367 | { 368 | "indexed": true, 369 | "internalType": "address", 370 | "name": "_reserve", 371 | "type": "address" 372 | }, 373 | { 374 | "indexed": true, 375 | "internalType": "address", 376 | "name": "_user", 377 | "type": "address" 378 | } 379 | ], 380 | "name": "ReserveUsedAsCollateralDisabled", 381 | "type": "event" 382 | }, 383 | { 384 | "anonymous": false, 385 | "inputs": [ 386 | { 387 | "indexed": true, 388 | "internalType": "address", 389 | "name": "_reserve", 390 | "type": "address" 391 | }, 392 | { 393 | "indexed": true, 394 | "internalType": "address", 395 | "name": "_user", 396 | "type": "address" 397 | } 398 | ], 399 | "name": "ReserveUsedAsCollateralEnabled", 400 | "type": "event" 401 | }, 402 | { 403 | "anonymous": false, 404 | "inputs": [ 405 | { 406 | "indexed": true, 407 | "internalType": "address", 408 | "name": "_reserve", 409 | "type": "address" 410 | }, 411 | { 412 | "indexed": true, 413 | "internalType": "address", 414 | "name": "_user", 415 | "type": "address" 416 | }, 417 | { 418 | "indexed": false, 419 | "internalType": "uint256", 420 | "name": "_newRateMode", 421 | "type": "uint256" 422 | }, 423 | { 424 | "indexed": false, 425 | "internalType": "uint256", 426 | "name": "_newRate", 427 | "type": "uint256" 428 | }, 429 | { 430 | "indexed": false, 431 | "internalType": "uint256", 432 | "name": "_borrowBalanceIncrease", 433 | "type": "uint256" 434 | }, 435 | { 436 | "indexed": false, 437 | "internalType": "uint256", 438 | "name": "_timestamp", 439 | "type": "uint256" 440 | } 441 | ], 442 | "name": "Swap", 443 | "type": "event" 444 | }, 445 | { 446 | "constant": true, 447 | "inputs": [], 448 | "name": "LENDINGPOOL_REVISION", 449 | "outputs": [ 450 | { 451 | "internalType": "uint256", 452 | "name": "", 453 | "type": "uint256" 454 | } 455 | ], 456 | "payable": false, 457 | "stateMutability": "view", 458 | "type": "function" 459 | }, 460 | { 461 | "constant": true, 462 | "inputs": [], 463 | "name": "UINT_MAX_VALUE", 464 | "outputs": [ 465 | { 466 | "internalType": "uint256", 467 | "name": "", 468 | "type": "uint256" 469 | } 470 | ], 471 | "payable": false, 472 | "stateMutability": "view", 473 | "type": "function" 474 | }, 475 | { 476 | "constant": true, 477 | "inputs": [], 478 | "name": "addressesProvider", 479 | "outputs": [ 480 | { 481 | "internalType": "contract LendingPoolAddressesProvider", 482 | "name": "", 483 | "type": "address" 484 | } 485 | ], 486 | "payable": false, 487 | "stateMutability": "view", 488 | "type": "function" 489 | }, 490 | { 491 | "constant": true, 492 | "inputs": [], 493 | "name": "core", 494 | "outputs": [ 495 | { 496 | "internalType": "contract LendingPoolCore", 497 | "name": "", 498 | "type": "address" 499 | } 500 | ], 501 | "payable": false, 502 | "stateMutability": "view", 503 | "type": "function" 504 | }, 505 | { 506 | "constant": true, 507 | "inputs": [], 508 | "name": "dataProvider", 509 | "outputs": [ 510 | { 511 | "internalType": "contract LendingPoolDataProvider", 512 | "name": "", 513 | "type": "address" 514 | } 515 | ], 516 | "payable": false, 517 | "stateMutability": "view", 518 | "type": "function" 519 | }, 520 | { 521 | "constant": true, 522 | "inputs": [], 523 | "name": "parametersProvider", 524 | "outputs": [ 525 | { 526 | "internalType": "contract LendingPoolParametersProvider", 527 | "name": "", 528 | "type": "address" 529 | } 530 | ], 531 | "payable": false, 532 | "stateMutability": "view", 533 | "type": "function" 534 | }, 535 | { 536 | "constant": false, 537 | "inputs": [ 538 | { 539 | "internalType": "contract LendingPoolAddressesProvider", 540 | "name": "_addressesProvider", 541 | "type": "address" 542 | } 543 | ], 544 | "name": "initialize", 545 | "outputs": [], 546 | "payable": false, 547 | "stateMutability": "nonpayable", 548 | "type": "function" 549 | }, 550 | { 551 | "constant": false, 552 | "inputs": [ 553 | { 554 | "internalType": "address", 555 | "name": "_reserve", 556 | "type": "address" 557 | }, 558 | { 559 | "internalType": "uint256", 560 | "name": "_amount", 561 | "type": "uint256" 562 | }, 563 | { 564 | "internalType": "uint16", 565 | "name": "_referralCode", 566 | "type": "uint16" 567 | } 568 | ], 569 | "name": "deposit", 570 | "outputs": [], 571 | "payable": true, 572 | "stateMutability": "payable", 573 | "type": "function" 574 | }, 575 | { 576 | "constant": false, 577 | "inputs": [ 578 | { 579 | "internalType": "address", 580 | "name": "_reserve", 581 | "type": "address" 582 | }, 583 | { 584 | "internalType": "address payable", 585 | "name": "_user", 586 | "type": "address" 587 | }, 588 | { 589 | "internalType": "uint256", 590 | "name": "_amount", 591 | "type": "uint256" 592 | }, 593 | { 594 | "internalType": "uint256", 595 | "name": "_aTokenBalanceAfterRedeem", 596 | "type": "uint256" 597 | } 598 | ], 599 | "name": "redeemUnderlying", 600 | "outputs": [], 601 | "payable": false, 602 | "stateMutability": "nonpayable", 603 | "type": "function" 604 | }, 605 | { 606 | "constant": false, 607 | "inputs": [ 608 | { 609 | "internalType": "address", 610 | "name": "_reserve", 611 | "type": "address" 612 | }, 613 | { 614 | "internalType": "uint256", 615 | "name": "_amount", 616 | "type": "uint256" 617 | }, 618 | { 619 | "internalType": "uint256", 620 | "name": "_interestRateMode", 621 | "type": "uint256" 622 | }, 623 | { 624 | "internalType": "uint16", 625 | "name": "_referralCode", 626 | "type": "uint16" 627 | } 628 | ], 629 | "name": "borrow", 630 | "outputs": [], 631 | "payable": false, 632 | "stateMutability": "nonpayable", 633 | "type": "function" 634 | }, 635 | { 636 | "constant": false, 637 | "inputs": [ 638 | { 639 | "internalType": "address", 640 | "name": "_reserve", 641 | "type": "address" 642 | }, 643 | { 644 | "internalType": "uint256", 645 | "name": "_amount", 646 | "type": "uint256" 647 | }, 648 | { 649 | "internalType": "address payable", 650 | "name": "_onBehalfOf", 651 | "type": "address" 652 | } 653 | ], 654 | "name": "repay", 655 | "outputs": [], 656 | "payable": true, 657 | "stateMutability": "payable", 658 | "type": "function" 659 | }, 660 | { 661 | "constant": false, 662 | "inputs": [ 663 | { 664 | "internalType": "address", 665 | "name": "_reserve", 666 | "type": "address" 667 | } 668 | ], 669 | "name": "swapBorrowRateMode", 670 | "outputs": [], 671 | "payable": false, 672 | "stateMutability": "nonpayable", 673 | "type": "function" 674 | }, 675 | { 676 | "constant": false, 677 | "inputs": [ 678 | { 679 | "internalType": "address", 680 | "name": "_reserve", 681 | "type": "address" 682 | }, 683 | { 684 | "internalType": "address", 685 | "name": "_user", 686 | "type": "address" 687 | } 688 | ], 689 | "name": "rebalanceStableBorrowRate", 690 | "outputs": [], 691 | "payable": false, 692 | "stateMutability": "nonpayable", 693 | "type": "function" 694 | }, 695 | { 696 | "constant": false, 697 | "inputs": [ 698 | { 699 | "internalType": "address", 700 | "name": "_reserve", 701 | "type": "address" 702 | }, 703 | { 704 | "internalType": "bool", 705 | "name": "_useAsCollateral", 706 | "type": "bool" 707 | } 708 | ], 709 | "name": "setUserUseReserveAsCollateral", 710 | "outputs": [], 711 | "payable": false, 712 | "stateMutability": "nonpayable", 713 | "type": "function" 714 | }, 715 | { 716 | "constant": false, 717 | "inputs": [ 718 | { 719 | "internalType": "address", 720 | "name": "_collateral", 721 | "type": "address" 722 | }, 723 | { 724 | "internalType": "address", 725 | "name": "_reserve", 726 | "type": "address" 727 | }, 728 | { 729 | "internalType": "address", 730 | "name": "_user", 731 | "type": "address" 732 | }, 733 | { 734 | "internalType": "uint256", 735 | "name": "_purchaseAmount", 736 | "type": "uint256" 737 | }, 738 | { 739 | "internalType": "bool", 740 | "name": "_receiveAToken", 741 | "type": "bool" 742 | } 743 | ], 744 | "name": "liquidationCall", 745 | "outputs": [], 746 | "payable": true, 747 | "stateMutability": "payable", 748 | "type": "function" 749 | }, 750 | { 751 | "constant": false, 752 | "inputs": [ 753 | { 754 | "internalType": "address", 755 | "name": "_receiver", 756 | "type": "address" 757 | }, 758 | { 759 | "internalType": "address", 760 | "name": "_reserve", 761 | "type": "address" 762 | }, 763 | { 764 | "internalType": "uint256", 765 | "name": "_amount", 766 | "type": "uint256" 767 | }, 768 | { 769 | "internalType": "bytes", 770 | "name": "_params", 771 | "type": "bytes" 772 | } 773 | ], 774 | "name": "flashLoan", 775 | "outputs": [], 776 | "payable": false, 777 | "stateMutability": "nonpayable", 778 | "type": "function" 779 | }, 780 | { 781 | "constant": true, 782 | "inputs": [ 783 | { 784 | "internalType": "address", 785 | "name": "_reserve", 786 | "type": "address" 787 | } 788 | ], 789 | "name": "getReserveConfigurationData", 790 | "outputs": [ 791 | { 792 | "internalType": "uint256", 793 | "name": "ltv", 794 | "type": "uint256" 795 | }, 796 | { 797 | "internalType": "uint256", 798 | "name": "liquidationThreshold", 799 | "type": "uint256" 800 | }, 801 | { 802 | "internalType": "uint256", 803 | "name": "liquidationBonus", 804 | "type": "uint256" 805 | }, 806 | { 807 | "internalType": "address", 808 | "name": "interestRateStrategyAddress", 809 | "type": "address" 810 | }, 811 | { 812 | "internalType": "bool", 813 | "name": "usageAsCollateralEnabled", 814 | "type": "bool" 815 | }, 816 | { 817 | "internalType": "bool", 818 | "name": "borrowingEnabled", 819 | "type": "bool" 820 | }, 821 | { 822 | "internalType": "bool", 823 | "name": "stableBorrowRateEnabled", 824 | "type": "bool" 825 | }, 826 | { 827 | "internalType": "bool", 828 | "name": "isActive", 829 | "type": "bool" 830 | } 831 | ], 832 | "payable": false, 833 | "stateMutability": "view", 834 | "type": "function" 835 | }, 836 | { 837 | "constant": true, 838 | "inputs": [ 839 | { 840 | "internalType": "address", 841 | "name": "_reserve", 842 | "type": "address" 843 | } 844 | ], 845 | "name": "getReserveData", 846 | "outputs": [ 847 | { 848 | "internalType": "uint256", 849 | "name": "totalLiquidity", 850 | "type": "uint256" 851 | }, 852 | { 853 | "internalType": "uint256", 854 | "name": "availableLiquidity", 855 | "type": "uint256" 856 | }, 857 | { 858 | "internalType": "uint256", 859 | "name": "totalBorrowsStable", 860 | "type": "uint256" 861 | }, 862 | { 863 | "internalType": "uint256", 864 | "name": "totalBorrowsVariable", 865 | "type": "uint256" 866 | }, 867 | { 868 | "internalType": "uint256", 869 | "name": "liquidityRate", 870 | "type": "uint256" 871 | }, 872 | { 873 | "internalType": "uint256", 874 | "name": "variableBorrowRate", 875 | "type": "uint256" 876 | }, 877 | { 878 | "internalType": "uint256", 879 | "name": "stableBorrowRate", 880 | "type": "uint256" 881 | }, 882 | { 883 | "internalType": "uint256", 884 | "name": "averageStableBorrowRate", 885 | "type": "uint256" 886 | }, 887 | { 888 | "internalType": "uint256", 889 | "name": "utilizationRate", 890 | "type": "uint256" 891 | }, 892 | { 893 | "internalType": "uint256", 894 | "name": "liquidityIndex", 895 | "type": "uint256" 896 | }, 897 | { 898 | "internalType": "uint256", 899 | "name": "variableBorrowIndex", 900 | "type": "uint256" 901 | }, 902 | { 903 | "internalType": "address", 904 | "name": "aTokenAddress", 905 | "type": "address" 906 | }, 907 | { 908 | "internalType": "uint40", 909 | "name": "lastUpdateTimestamp", 910 | "type": "uint40" 911 | } 912 | ], 913 | "payable": false, 914 | "stateMutability": "view", 915 | "type": "function" 916 | }, 917 | { 918 | "constant": true, 919 | "inputs": [ 920 | { 921 | "internalType": "address", 922 | "name": "_user", 923 | "type": "address" 924 | } 925 | ], 926 | "name": "getUserAccountData", 927 | "outputs": [ 928 | { 929 | "internalType": "uint256", 930 | "name": "totalLiquidityETH", 931 | "type": "uint256" 932 | }, 933 | { 934 | "internalType": "uint256", 935 | "name": "totalCollateralETH", 936 | "type": "uint256" 937 | }, 938 | { 939 | "internalType": "uint256", 940 | "name": "totalBorrowsETH", 941 | "type": "uint256" 942 | }, 943 | { 944 | "internalType": "uint256", 945 | "name": "totalFeesETH", 946 | "type": "uint256" 947 | }, 948 | { 949 | "internalType": "uint256", 950 | "name": "availableBorrowsETH", 951 | "type": "uint256" 952 | }, 953 | { 954 | "internalType": "uint256", 955 | "name": "currentLiquidationThreshold", 956 | "type": "uint256" 957 | }, 958 | { 959 | "internalType": "uint256", 960 | "name": "ltv", 961 | "type": "uint256" 962 | }, 963 | { 964 | "internalType": "uint256", 965 | "name": "healthFactor", 966 | "type": "uint256" 967 | } 968 | ], 969 | "payable": false, 970 | "stateMutability": "view", 971 | "type": "function" 972 | }, 973 | { 974 | "constant": true, 975 | "inputs": [ 976 | { 977 | "internalType": "address", 978 | "name": "_reserve", 979 | "type": "address" 980 | }, 981 | { 982 | "internalType": "address", 983 | "name": "_user", 984 | "type": "address" 985 | } 986 | ], 987 | "name": "getUserReserveData", 988 | "outputs": [ 989 | { 990 | "internalType": "uint256", 991 | "name": "currentATokenBalance", 992 | "type": "uint256" 993 | }, 994 | { 995 | "internalType": "uint256", 996 | "name": "currentBorrowBalance", 997 | "type": "uint256" 998 | }, 999 | { 1000 | "internalType": "uint256", 1001 | "name": "principalBorrowBalance", 1002 | "type": "uint256" 1003 | }, 1004 | { 1005 | "internalType": "uint256", 1006 | "name": "borrowRateMode", 1007 | "type": "uint256" 1008 | }, 1009 | { 1010 | "internalType": "uint256", 1011 | "name": "borrowRate", 1012 | "type": "uint256" 1013 | }, 1014 | { 1015 | "internalType": "uint256", 1016 | "name": "liquidityRate", 1017 | "type": "uint256" 1018 | }, 1019 | { 1020 | "internalType": "uint256", 1021 | "name": "originationFee", 1022 | "type": "uint256" 1023 | }, 1024 | { 1025 | "internalType": "uint256", 1026 | "name": "variableBorrowIndex", 1027 | "type": "uint256" 1028 | }, 1029 | { 1030 | "internalType": "uint256", 1031 | "name": "lastUpdateTimestamp", 1032 | "type": "uint256" 1033 | }, 1034 | { 1035 | "internalType": "bool", 1036 | "name": "usageAsCollateralEnabled", 1037 | "type": "bool" 1038 | } 1039 | ], 1040 | "payable": false, 1041 | "stateMutability": "view", 1042 | "type": "function" 1043 | }, 1044 | { 1045 | "constant": true, 1046 | "inputs": [], 1047 | "name": "getReserves", 1048 | "outputs": [ 1049 | { 1050 | "internalType": "address[]", 1051 | "name": "", 1052 | "type": "address[]" 1053 | } 1054 | ], 1055 | "payable": false, 1056 | "stateMutability": "view", 1057 | "type": "function" 1058 | } 1059 | ] -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | --------------------------------------------------------------------------------