-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#2 Added missing events #3 bump up compiler version to 0.5.12(same with DAI) #6 use enum to represent contract state #7 Added methods to prevent "approve" race condition
- Loading branch information
Showing
11 changed files
with
5,074 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
indent_style = space | ||
indent_size = 4 | ||
charset = utf-8 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.js] | ||
indent_size = 2 | ||
|
||
[{*.bat, *.ps1, *.ps2, Makefile, *.go}] | ||
indent_style = tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.sol linguist-language=Solidity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
### IDEs | ||
.idea | ||
.vscode | ||
|
||
### Temporary Files | ||
*.swp | ||
*.tmp | ||
*.log | ||
logs | ||
.DS_Store | ||
|
||
### Node.js | ||
node_modules | ||
|
||
### Buidler Files | ||
cache | ||
artifacts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
### IDEs | ||
.idea | ||
.vscode | ||
|
||
### Temporary Files | ||
*.swp | ||
*.tmp | ||
*.log | ||
logs | ||
.DS_Store | ||
|
||
### Node.js | ||
node_modules | ||
|
||
### Buidler Files | ||
cache | ||
artifacts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
usePlugin('@nomiclabs/buidler-truffle5') | ||
|
||
const { toEthString } = require('./utils') | ||
|
||
const accountBalance = async account => { | ||
const balance = await web3.eth.getBalance(account) | ||
return [account, `${balance} Wei`, `${toEthString(balance)} Eth`] | ||
} | ||
|
||
// https://buidler.dev/guides/create-task.html | ||
task('accounts', 'Prints the list of accounts with their balances', async () => { | ||
const accounts = await web3.eth.getAccounts() | ||
await Promise.all( | ||
accounts.map(async (account, index) => { | ||
console.log([index, ...(await accountBalance(account).catch(err => [account, err.message]))].join('\t')) | ||
}) | ||
) | ||
}) | ||
|
||
task('balance', 'Prints the balance in each account') | ||
.addVariadicPositionalParam('accounts', 'ETH address(es)', undefined, undefined, false) | ||
.setAction(async taskArgs => | ||
Promise.all( | ||
taskArgs.accounts.map(async (account, index) => { | ||
console.log([index, ...(await accountBalance(account).catch(err => [account, err.message]))].join('\t')) | ||
}) | ||
) | ||
) | ||
|
||
task('info', 'Prints current network info', async () => { | ||
const getters = { | ||
provider: async () => web3.currentProvider._provider._url, | ||
chainId: web3.eth.getChainId, | ||
networkType: web3.eth.net.getNetworkType, | ||
blockNumber: web3.eth.getBlockNumber, | ||
} | ||
|
||
await Promise.all( | ||
Object.entries(getters).map(async ([field, valueGetter]) => { | ||
console.log(`${field}: ${await valueGetter().catch(err => err.message)}`) | ||
}) | ||
) | ||
}) | ||
|
||
task('tx', 'Find and prints the transaction with given txid') | ||
.addPositionalParam('txid', 'Transaction ID', undefined, undefined, false) | ||
.setAction(async taskArgs => { | ||
console.log(await web3.eth.getTransaction(taskArgs.txid)) | ||
}) | ||
|
||
// You have to export an object to set up your config | ||
// This object can have the following optional entries: | ||
// defaultNetwork, networks, solc, and paths. | ||
// Go to https://buidler.dev/config/ to learn more | ||
module.exports = { | ||
defaultNetwork: 'buidlerevm', | ||
solc: { | ||
version: '0.5.12', | ||
optimizer: { enabled: true, runs: 200 }, | ||
}, | ||
// networks: { | ||
// ropsten: { | ||
// chainId: 3, | ||
// url: 'https://provider-url.somewhere.you.know', | ||
// gasMultiplier: 1.2, | ||
// accounts: { | ||
// mnemonic: 'some mnemonics here if you really want to do use slow ropsten testing', | ||
// path: `m/44'/60'/0'/0`, | ||
// initialIndex: 0, | ||
// count: 4, | ||
// }, | ||
// }, | ||
// }, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "ethereum-orbit-dai", | ||
"version": "1.0.0", | ||
"private": true, | ||
"description": "Ethereum Orbit Dai", | ||
"repository": "https://github.com/orbit-chain/ethereum-orbit-dai.git", | ||
"license": "UNLICENSED", | ||
"main": "index.js", | ||
"scripts": { | ||
"clean": "buidler clean", | ||
"compile": "buidler compile", | ||
"lint": "prettier -c **/*.js package.json", | ||
"lint:fix": "prettier **/*.js package.json --write", | ||
"test": "buidler test" | ||
}, | ||
"prettier": { | ||
"arrowParens": "avoid", | ||
"endOfLine": "lf", | ||
"printWidth": 120, | ||
"semi": false, | ||
"singleQuote": true, | ||
"tabWidth": 2, | ||
"trailingComma": "es5", | ||
"useTabs": false | ||
}, | ||
"dependencies": { | ||
"@nomiclabs/buidler": "^1.3.2", | ||
"@nomiclabs/buidler-truffle5": "^1.3.2", | ||
"@nomiclabs/buidler-web3": "^1.3.2", | ||
"prettier": "^2.0.5", | ||
"prettier-plugin-packagejson": "^2.2.3", | ||
"web3": "^1.2.7" | ||
} | ||
} |
Oops, something went wrong.