From 498d1ceaaf5fabae7b271c312224b4e2699d7298 Mon Sep 17 00:00:00 2001 From: brostiko <101353299+brostiko@users.noreply.github.com> Date: Sat, 3 Aug 2024 15:33:35 +0100 Subject: [PATCH 1/3] Create node.js.yml Signed-off-by: brostiko <101353299+brostiko@users.noreply.github.com> --- .github/workflows/node.js.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/node.js.yml diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..093a954 --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,31 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: Node.js CI + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x, 20.x, 22.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: npm run build --if-present + - run: npm test From 7365095fb7210de2aa83f62817da96394649dc24 Mon Sep 17 00:00:00 2001 From: brostiko <101353299+brostiko@users.noreply.github.com> Date: Sun, 11 Aug 2024 19:40:52 +0100 Subject: [PATCH 2/3] Update issue templates pragma solidity ^0.5.8; interface ITRC20 { function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external returns (bool); function transferFrom(address from, address to, uint256 value) external returns (bool); function totalSupply() external view returns (uint256); function balanceOf(address who) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, errorMessage); return c; } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } } contract BTT is ITRC20 { using SafeMath for uint256; string constant public name = "BitTorrent"; string constant public symbol = "BTT"; uint8 constant public decimals = 18; uint256 private totalSupply_; mapping(address => uint256) private balanceOf_; mapping(address => mapping(address => uint256)) private allowance_; constructor(address fund) public { totalSupply_ = 9900 * 1e8 * 1e18 * 1e3; balanceOf_[fund] = totalSupply_; emit Transfer(address(0x00), fund, totalSupply_); } function totalSupply() public view returns (uint256) { return totalSupply_; } function balanceOf(address guy) public view returns (uint256){ return balanceOf_[guy]; } function allowance(address src, address guy) public view returns (uint256){ return allowance_[src][guy]; } function approve(address guy, uint256 sad) public returns (bool) { allowance_[msg.sender][guy] = sad; emit Approval(msg.sender, guy, sad); return true; } function transfer(address dst, uint256 sad) public returns (bool) { return transferFrom(msg.sender, dst, sad); } function transferFrom(address src, address dst, uint256 sad) public returns (bool) { require(balanceOf_[src] >= sad, "src balance not enough"); if (src != msg.sender && allowance_[src][msg.sender] != uint256(-1)) { require(allowance_[src][msg.sender] >= sad, "src allowance is not enough"); allowance_[src][msg.sender] = allowance_[src][msg.sender].sub(sad, "allowance subtraction overflow") ; } balanceOf_[src] = balanceOf_[src].sub(sad, "from balance subtraction overflow"); balanceOf_[dst] = balanceOf_[dst].add(sad, "to balance addition overflow") ; emit Transfer(src, dst, sad); return true; } function increaseAllowance(address guy, uint256 addedValue) public returns (bool) { require(guy != address(0)); allowance_[msg.sender][guy] = allowance_[msg.sender][guy].add(addedValue, "allowance addition overflow") ; emit Approval(msg.sender, guy, allowance_[msg.sender][guy]); return true; } function decreaseAllowance(address guy, uint256 subtractedValue) public returns (bool) { require(guy != address(0)); allowance_[msg.sender][guy] = allowance_[msg.sender][guy].sub(subtractedValue, "allowance subtraction overflow") ; emit Approval(msg.sender, guy, allowance_[msg.sender][guy]); return true; } } --- .github/ISSUE_TEMPLATE/bug_report.md | 38 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/custom.md | 10 ++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 ++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/custom.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..dd84ea7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/custom.md b/.github/ISSUE_TEMPLATE/custom.md new file mode 100644 index 0000000..48d5f81 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/custom.md @@ -0,0 +1,10 @@ +--- +name: Custom issue template +about: Describe this issue template's purpose here. +title: '' +labels: '' +assignees: '' + +--- + + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..bbcbbe7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. From 3eb06650000d7bb3853e4efd2c714be4ad138c3f Mon Sep 17 00:00:00 2001 From: brostiko <101353299+brostiko@users.noreply.github.com> Date: Sun, 11 Aug 2024 19:59:19 +0100 Subject: [PATCH 3/3] Create contract address 608060405234801561001057600080fd5b50d3801561001d57600080fd5b50d2801561002a57600080fd5b50604051610a0f380380610a0f8339818101604052602081101561004d57600080fd5b50516d30cf8e866d7078300fe38000000060008181556001600160a01b03831680825260016020908152604080842085905580519485525191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35061094d806100c26000396000f3fe608060405234801561001057600080fd5b50d3801561001d57600080fd5b50d2801561002a57600080fd5b50600436106100c35760003560e01c8063395093511161008b57806339509351146101f357806370a082311461021f57806395d89b4114610245578063a457c2d71461024d578063a9059cbb14610279578063dd62ed3e146102a5576100c3565b806306fdde03146100c8578063095ea7b31461014557806318160ddd1461018557806323b872dd1461019f578063313ce567146101d5575b600080fd5b6100d06102d3565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561010a5781810151838201526020016100f2565b50505050905090810190601f1680156101375780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101716004803603604081101561015b57600080fd5b506001600160a01b0381351690602001356102f9565b604080519115158252519081900360200190f35b61018d61035f565b60408051918252519081900360200190f35b610171600480360360608110156101b557600080fd5b506001600160a01b03813581169160208101359091169060400135610365565b6101dd610624565b6040805160ff9092168252519081900360200190f35b6101716004803603604081101561020957600080fd5b506001600160a01b038135169060200135610629565b61018d6004803603602081101561023557600080fd5b50356001600160a01b031661070c565b6100d0610727565b6101716004803603604081101561026357600080fd5b506001600160a01b038135169060200135610746565b6101716004803603604081101561028f57600080fd5b506001600160a01b0381351690602001356107c4565b61018d600480360360408110156102bb57600080fd5b506001600160a01b03813581169160200135166107d8565b6040518060400160405280600a815260200169109a5d151bdc9c995b9d60b21b81525081565b3360008181526002602090815260408083206001600160a01b038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60005490565b6001600160a01b0383166000908152600160205260408120548211156103cb576040805162461bcd60e51b81526020600482015260166024820152750e6e4c640c4c2d8c2dcc6ca40dcdee840cadcdeeaced60531b604482015290519081900360640190fd5b6001600160a01b038416331480159061040957506001600160a01b038416600090815260026020908152604080832033845290915290205460001914155b15610514576001600160a01b0384166000908152600260209081526040808320338452909152902054821115610486576040805162461bcd60e51b815260206004820152601b60248201527f73726320616c6c6f77616e6365206973206e6f7420656e6f7567680000000000604482015290519081900360640190fd5b604080518082018252601e81527f616c6c6f77616e6365207375627472616374696f6e206f766572666c6f7700006020808301919091526001600160a01b03871660009081526002825283812033825290915291909120546104ef91849063ffffffff61080316565b6001600160a01b03851660009081526002602090815260408083203384529091529020555b610557826040518060600160405280602181526020016108f9602191396001600160a01b038716600090815260016020526040902054919063ffffffff61080316565b6001600160a01b0380861660009081526001602081815260408084209590955584518086018652601c81527f746f2062616c616e6365206164646974696f6e206f766572666c6f77000000008183015293881683525291909120546105c391849063ffffffff61089a16565b6001600160a01b0380851660008181526001602090815260409182902094909455805186815290519193928816927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35060019392505050565b601281565b60006001600160a01b03831661063e57600080fd5b604080518082018252601b81527f616c6c6f77616e6365206164646974696f6e206f766572666c6f770000000000602080830191909152336000908152600282528381206001600160a01b038816825290915291909120546106a791849063ffffffff61089a16565b3360008181526002602090815260408083206001600160a01b0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b6001600160a01b031660009081526001602052604090205490565b6040518060400160405280600381526020016210951560ea1b81525081565b60006001600160a01b03831661075b57600080fd5b604080518082018252601e81527f616c6c6f77616e6365207375627472616374696f6e206f766572666c6f770000602080830191909152336000908152600282528381206001600160a01b038816825290915291909120546106a791849063ffffffff61080316565b60006107d1338484610365565b9392505050565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b600081848411156108925760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561085757818101518382015260200161083f565b50505050905090810190601f1680156108845780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600083830182858210156108ef5760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561085757818101518382015260200161083f565b5094935050505056fe66726f6d2062616c616e6365207375627472616374696f6e206f766572666c6f77a26474726f6e58200b19d6f1b623efc370df5874c29ce6ab9005aebcb067acd94be71eaec1df3f9364736f6c63430005120031000000000000000000000000cf649401692e5eea5fd28000f452e7f35acc720b Signed-off-by: brostiko <101353299+brostiko@users.noreply.github.com> --- contract address | 103 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 contract address diff --git a/contract address b/contract address new file mode 100644 index 0000000..e868c20 --- /dev/null +++ b/contract address @@ -0,0 +1,103 @@ +pragma solidity ^0.5.8; + +interface ITRC20 { + function transfer(address to, uint256 value) external returns (bool); + function approve(address spender, uint256 value) external returns (bool); + function transferFrom(address from, address to, uint256 value) external returns (bool); + function totalSupply() external view returns (uint256); + function balanceOf(address who) external view returns (uint256); + function allowance(address owner, address spender) external view returns (uint256); + event Transfer(address indexed from, address indexed to, uint256 value); + event Approval(address indexed owner, address indexed spender, uint256 value); +} + +library SafeMath { + + function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { + uint256 c = a + b; + require(c >= a, errorMessage); + + return c; + } + + function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { + require(b <= a, errorMessage); + uint256 c = a - b; + + return c; + } + +} + +contract BTT is ITRC20 { + using SafeMath for uint256; + string constant public name = "BitTorrent"; + string constant public symbol = "BTT"; + uint8 constant public decimals = 18; + + uint256 private totalSupply_; + mapping(address => uint256) private balanceOf_; + mapping(address => mapping(address => uint256)) private allowance_; + + constructor(address fund) public { + totalSupply_ = 9900 * 1e8 * 1e18 * 1e3; + balanceOf_[fund] = totalSupply_; + emit Transfer(address(0x00), fund, totalSupply_); + } + + function totalSupply() public view returns (uint256) { + return totalSupply_; + } + + function balanceOf(address guy) public view returns (uint256){ + return balanceOf_[guy]; + } + + function allowance(address src, address guy) public view returns (uint256){ + return allowance_[src][guy]; + } + + function approve(address guy, uint256 sad) public returns (bool) { + allowance_[msg.sender][guy] = sad; + emit Approval(msg.sender, guy, sad); + return true; + } + + function transfer(address dst, uint256 sad) public returns (bool) { + return transferFrom(msg.sender, dst, sad); + } + + function transferFrom(address src, address dst, uint256 sad) + public returns (bool) + { + require(balanceOf_[src] >= sad, "src balance not enough"); + + if (src != msg.sender && allowance_[src][msg.sender] != uint256(-1)) { + require(allowance_[src][msg.sender] >= sad, "src allowance is not enough"); + allowance_[src][msg.sender] = allowance_[src][msg.sender].sub(sad, "allowance subtraction overflow") ; + } + balanceOf_[src] = balanceOf_[src].sub(sad, "from balance subtraction overflow"); + balanceOf_[dst] = balanceOf_[dst].add(sad, "to balance addition overflow") ; + + emit Transfer(src, dst, sad); + return true; + } + + function increaseAllowance(address guy, uint256 addedValue) public returns (bool) { + require(guy != address(0)); + + allowance_[msg.sender][guy] = allowance_[msg.sender][guy].add(addedValue, "allowance addition overflow") ; + emit Approval(msg.sender, guy, allowance_[msg.sender][guy]); + return true; + } + + function decreaseAllowance(address guy, uint256 subtractedValue) public returns (bool) { + require(guy != address(0)); + + allowance_[msg.sender][guy] = allowance_[msg.sender][guy].sub(subtractedValue, "allowance subtraction overflow") ; + emit Approval(msg.sender, guy, allowance_[msg.sender][guy]); + return true; + } +} + +