Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT Improvement/gas optimization #9

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
ec2c68a
WIP: Improve the code
hging Sep 10, 2020
a975432
add erc721 token refund
hging Sep 11, 2020
08efa61
remove unused code
hging Sep 11, 2020
ed35516
fix compile error
hging Sep 15, 2020
82f7117
Refactor the code
yisiliu Sep 17, 2020
c275d21
Remove the cache
yisiliu Sep 17, 2020
17c630d
Remove the unused creation function
yisiliu Sep 18, 2020
27e452a
Optimize at storage level
yisiliu Sep 27, 2020
e785d50
Compress the variables into 32-byte blocks
yisiliu Sep 28, 2020
09f2140
Add box and unbox to make the code simpler
yisiliu Oct 10, 2020
ff20131
Change a lot of code for fix test error
hging Oct 11, 2020
e2798f0
fix refund
hging Oct 12, 2020
de0beca
Fix refund(); Add gas_refund operations
yisiliu Oct 13, 2020
96c150e
Update the gas_refund
yisiliu Oct 13, 2020
81f8533
fix erc721_token_ids gas_refund
hging Oct 14, 2020
229db2b
Modify the code according to the preliminary report
yisiliu Oct 19, 2020
bc0381e
Merge branch 'improvement/gas_optimization' of github.com:yisiliu/Red…
yisiliu Oct 19, 2020
636418a
Fix the loop
yisiliu Oct 21, 2020
a995e68
Fix a minor error
yisiliu Oct 21, 2020
501f82d
Remove unused appove during redpacket creation
yisiliu Nov 30, 2020
7fba9c0
Remove the fallback function
yisiliu Nov 30, 2020
6f56123
Add check for 0 balance in refund
yisiliu Dec 8, 2020
14e1ea6
Add the missing semicolon;
yisiliu Dec 15, 2020
091fa81
Refine the error code
yisiliu Dec 15, 2020
df41f08
Rearrange the directory structure
yisiliu Jan 18, 2021
54239ea
Add test coverage
zhouhanseng Jan 20, 2021
f00f232
Add prettier for test
zhouhanseng Jan 20, 2021
8761082
Use chai expect
zhouhanseng Jan 20, 2021
856988b
Add test
zhouhanseng Jan 20, 2021
b0f9257
Merge pull request #11 from yisiliu/improvement/gas_optimization_test
yisiliu Jan 24, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
RedPacket.json
HappyRedPacket.json
Migration.json
node_modules/
build/
coverage/
coverage.json
.coverage_artifacts
.coverage_contracts
167 changes: 167 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
.github/
package.json
package-lock.json

# VSCode personal settings
.vscode/launch.json
.vscode/tasks.json

# JetBrain personal settings
.idea

# testing
/reports
/junit.xml

# Build out
dist/*
/build
/storybook-static
/Maskbook.*.zip

# Environment files
.env.local
.env.development.local
.env.test.local
.env.production.local

# Block-chain contract files
/contracts

# E2E tests
/.env/e2e-test
/.env/e2e-development
/.env/e2e-production
/.pptr-alice
/.pptr-bob
/screenshots
/.env
/.pptr-*

# Temp profiles
.firefox
.chrome

# Following content is copied from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# Rush temporary files
common/deploy/
common/temp/
common/autoinstallers/*/.npmrc
**/.rush/temp/
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"trailingComma": "all",
"printWidth": 120,
"semi": false,
"singleQuote": true,
"jsxBracketSameLine": true
}
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
# RedPacket

test dir is a truffle project.
## Introduction

## Overview

## Getting Started

This is a standard truffle project.
To install:
```
npm i
```
To build the project:
```
truffle build
```

To test the project:
```
npm install chai ganache-cli
truffle run coverage
```

To debug:
```
truffle debug [TX_ID]
```

2 changes: 1 addition & 1 deletion test/contracts/Migrations.sol → contracts/Migrations.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity >=0.4.21 <0.6.0;
pragma solidity >=0.4.21;

contract Migrations {
address public owner;
Expand Down
Loading