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

chore: Store vested per period in memory before iterating #70

Merged
merged 1 commit into from
Nov 23, 2022

Conversation

fzavalia
Copy link
Contributor

@fzavalia fzavalia commented Nov 22, 2022

Saves a bunch of gas

@fzavalia fzavalia merged commit a7a5c16 into feat/token-vesting-v2 Nov 23, 2022
@fzavalia fzavalia deleted the feat/memory-vested-per-period branch November 23, 2022 11:52
fzavalia added a commit that referenced this pull request Nov 29, 2022
* chore: Use lockfile v2 (#29)

* feat: Add hardhat (#30)

* chore: Add hardhat toolbox

* chore: Add hardhat

* chore: Add hardhat config

* feat: contractsOld folder

* feat: Add test contract

* chore: Add artifacts and cache to gitignore

* chore: Use hardhat toolbox in config

* chore: Test

* chore: EOL

* feat: Create PeriodicTokenVesting contract (#32)

* chore: Install OZ libs

* feat: Delete test files

* feat: Add PeriodicTokenVesting contract and tests

* feat: Add parameters to initialize function (#33)

* chore: Install hardhat network helpers

* feat: Add MockToken

* feat: Add init variables and getters

* feat: Add more initialize tests

* feat: Add validations and comments

* chore: Add more initialize tests

* feat: Set beneficiary (#35)

* feat: Add setBeneficiary function

* chore: Add tests for setBeneficiary

* feat: Add release function (#36)

* feat: Add _getVested and release functions

* fix: Fix tests

* feat: Add getReleased and update release function

* feat: Test release function

* chore: Enable gas reporter

* chore: Ignore coverage

* chore: Add comments

* feat: Update to elapsedPeriods > vestedPerPeriodLength

* chore: Test revert when vesting has not started

* feat: Add getReleasable and getVested functions

* feat: Change _setBeneficiary accessor

* chore: EOL

* feat: Revoke function (#37)

* feat: Add revoked function

* feat: Add revoke tests

* chore: Add release test when revoked

* chore: Add release test for the currently elapsed periods

* feat: Release foreign token function (#38)

* feat: Add releaseForeignToken function

* chore: Test release foreign token

* feat: Add and test ReleasedForeign event

* feat: Index the _token param in ReleasedForeign event

* feat: Release surplus (#39)

* feat: Add releaseSurplus function

* chore: Add releaseSurplus tests

* feat: Misc (#40)

* chore: Test missing events

* chore: Update comments

* feat: Update events

* feat: Release all foreign tokens

* feat: Release to beneficiary and release to arbitrary receiver functions

* feat: More config for releaseForeignToken

* chore: Remove ethers trainwreck

* feat: Unique release function with receiver and amount

* feat: Add receiver and amount to releaseSurplus

* feat: Change error message

* chore: Change argument name

* chore: Add various comments

* feat: Add getTotal function to obtain the total amount of tokens that will be vested by the contract

* chore: Update comment

* feat: Deploy PeriodicTokenVesting implementation script (#43)

* chore: Add hardhat etherscan and dotenv libs

* chore: Add env example file

* chore: Add .env to ignore files

* chore: Update lock file

* chore: Update hardhat config

* feat: Add deploy periodic token vesting implementation script

* feat: Validate period duration and vested per period values

* feat: Use SafeERC20 and safeTransfer were transfer is used (#48)

* feat: Implement OZ PausableUpgradeable (#50)

* feat: Add pause and unpause

* feat: Pause and unpause only callable when not revoked

* chore: Test pause and unpause events

* chore: Define optimizer runs in HH config

* feat: Add getIsPaused function

* chore: Move getIsPaused func

* chore: Add comment to getIsPaused function

* feat: Rename to stopTimestamp and set it with pause

* chore: Move require up

* chore: Add comments to modifiers

* chore: Change require > 0 to != 0

* feat: Remove getIsPaused function

* feat: Add isPausable variable

* fix: Release surplus on pause (#51)

* chore: Update comments

* fix: Release surplus allow the owner to release non surplus tokens when paused

* chore: Update comment

* chore: Test releaseSurplus on revoke

* chore: Tests

* feat: Have an isRevoked variable to simplify logic

* chore: Update comments

* feat: Linear vesting (#52)

* feat: Support linear vesting

* chore: Test release foreign token when token is the same as the vested one

* chore: Test release surplus when the contract does not have surplus funds

* chore: Test release when more than the defined periods have elapsed

* chore: Add various getVested functions

* chore: Add test for released variable though getReleased

* chore: Update comment

* chore: Ignore .vscode

* chore: Test init and release with many vested per period elements

* chore: Compile and Test contracts on github CI

* feat: Codecov (#54)

* chore: Add codecov action to ci

* chore: Update test to coverage in CI

* chore: Update job name

* chore: Add npm cache to CI

* chore: Add coverage badge to readme

* chore: Comment tests to view difference in coverage

* chore: Uncomment tests

* feat: isLinear + cliffDuration (#57)

* feat: Add linear struct to determine if tokens are vested between periods

* feat: Add set linear function with extra validations

* chore: Update tests

* chore: Update tests

* chore: Update tests

* chore: Optimize for loops

* chore: Add comment

* chore: Add comment

* feat: isLinear and cliffDuration

* chore: Fix tests

* chore: Update comment

* chore: Update tests

* chore: Update README

* fix: Linear vesting calculation when cliff is longer than the period … (#59)

* fix: Linear vesting calculation when cliff is longer than the period duration

* feat: Remove unnecessary if condition

* chore: Update comments

* chore: Add more tests to check cliff

* chore: Update readme

* feat: Rename variables

* chore: Remove private setters only used in initialize (#60)

* fix: Don't update stop timestamp when revoked after pause (#63)

* fix: Don't update stop timestamp when revoked after pause

* chore: Update test

* feat: Downgrade and lock to 0.8.2 (#65)

* feat: Validate start is not 0 (#69)

* feat: OwnableBatchVestings (#68)

* feat: Add OwnableBatchVestings contract

* feat: Lock OwnableBatchVestings version

* chore: Add tests for ownable batch vestings

* chore: Add dot to README

* chore: Remove dot from README

* feat: Make owner immutable

* chore: Store vested per period in memory before iterating (#70)

* chore: Add 256 to uint (#71)

* feat: Add script to deploy OwnableBatchVestings

* feat: Support deployment of new contract through the UI (#61)

* chore: Fix compilation errors

* feat: Add react router dom

* feat: WIP CreateSingle and CreateBatch v2 components

* chore: Reorder imports

* feat: Add contracts in goerli for original ui

* feat: Deploy new vesting contract in /v2/batch

* fix: How data is formed for transaction

* chore: Remove unused chains from configs

* chore: Update single deploy UI to support new contract

* feat: Add batch vesting address field to change the contract

* fix: Hook

* chore: add margin to batch contract field

* fix: Use batch vesting address when sending the transaction

* feat: New deployments will be under / and /batch

* chore: Add dot to README

* feat: Move old components to v1 and rename

* feat: Install ethers

* feat: Add message regarding old deployer

* feat: Add message regarding old deployer

* feat: Update implementation address for v2

* feat: Remove empty lines from csv

* feat: Add ethereum to v2 ui

* feat: Show error

* feat: Update vesting impl address for mainnet (#73)

* feat: Deploy to Mainnet (#72)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants