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

Add Vesting #425

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Add Vesting #425

wants to merge 11 commits into from

Conversation

immrsd
Copy link
Contributor

@immrsd immrsd commented Dec 24, 2024

No description provided.

@immrsd immrsd self-assigned this Dec 24, 2024
Copy link

socket-security bot commented Dec 24, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@nomicfoundation/hardhat-toolbox@5.0.0 environment Transitive: eval, filesystem, network, shell, unsafe +775 226 MB kanej
npm/@openzeppelin/hardhat-upgrades@3.6.0 filesystem Transitive: environment, eval, network, unsafe +78 17.8 MB ericglau
npm/hardhat@2.22.16 environment, filesystem, network, shell Transitive: eval, unsafe +386 243 MB kanej

🚮 Removed packages: npm/@rollup/plugin-alias@5.1.1, npm/@rollup/plugin-commonjs@28.0.2, npm/@rollup/plugin-json@6.1.0, npm/@rollup/plugin-node-resolve@15.3.1, npm/@rollup/plugin-replace@5.0.7, npm/@rollup/plugin-typescript@11.1.6, npm/@types/file-saver@2.0.7, npm/@types/istanbul-lib-coverage@2.0.6, npm/@types/istanbul-lib-report@3.0.3, npm/@types/istanbul-reports@1.1.2, npm/@types/node@18.19.68, npm/@types/resize-observer-browser@0.1.11, npm/@types/semver@7.5.8, npm/@types/yargs-parser@21.0.3, npm/@types/yargs@13.0.12, npm/ansi-regex@4.1.1, npm/array.prototype.flat@1.3.3, npm/array.prototype.flatmap@1.3.3, npm/autoprefixer@10.4.20, npm/ava@6.2.0, npm/bluebird@3.7.2, npm/camelcase@5.3.1, npm/cliui@5.0.0, npm/cross-spawn@6.0.6, npm/decamelize@1.2.0, npm/emoji-regex@7.0.3, npm/end-of-stream@1.4.4, npm/ethereum-cryptography@3.0.0, npm/execa@1.0.0, npm/file-saver@2.0.5, npm/find-up@3.0.0, npm/get-stream@4.1.0, npm/hardhat@2.22.17, npm/highlight.js@11.11.0, npm/highlightjs-cairo@0.4.0, npm/highlightjs-solidity@2.0.6, npm/is-stream@1.1.0, npm/jest-changed-files@24.9.0, npm/jszip@3.10.1, npm/locate-path@3.0.0, npm/nice-try@1.0.5, npm/npm-run-path@2.0.2, npm/p-finally@1.0.0, npm/p-limit@2.3.0, npm/p-locate@3.0.0, npm/p-try@2.2.0, npm/path-browserify@1.0.1, npm/path-exists@3.0.0, npm/postcss-load-config@6.0.1, npm/postcss@8.4.49, npm/pump@3.0.2, npm/require-main-filename@2.0.0, npm/rimraf@5.0.10, npm/rollup-plugin-livereload@2.0.5, npm/rollup-plugin-styles@4.0.0, npm/rollup-plugin-svelte@7.2.2, npm/rollup-plugin-terser@7.0.2, npm/rollup@4.29.1, npm/set-blocking@2.0.0, npm/shebang-command@1.2.0, npm/shebang-regex@1.0.0, npm/signal-exit@3.0.7, npm/sirv-cli@2.0.2, npm/solidity-ast@0.4.59, npm/split@1.0.1, npm/string-width@3.1.0, npm/strip-eof@1.0.0, npm/svelte-check@3.8.6, npm/svelte-preprocess@5.1.4, npm/svelte@3.59.2, npm/tailwindcss@3.4.17, npm/through@2.3.8, npm/tippy.js@6.3.7, npm/typescript@4.9.5, npm/util@0.12.5, npm/which-module@2.0.1, npm/wrap-ansi@5.1.0, npm/wsrun@5.2.4, npm/y18n@4.0.3, npm/yargs-parser@13.1.2, npm/yargs@13.3.2

View full report↗︎

Copy link

socket-security bot commented Dec 24, 2024

🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎

To accept the risk, merge this PR and you will not be notified again.

Alert Package NoteSourceCI
High CVE npm/ws@7.4.6 🚫

View full report↗︎

Next steps

What is a CVE?

Contains a high severity Common Vulnerability and Exposure (CVE).

Remove or replace dependencies that include known high severity CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/foo@1.0.0 or ignore all packages with @SocketSecurity ignore-all

  • @SocketSecurity ignore npm/ws@7.4.6

Copy link
Contributor

@andrew-fleming andrew-fleming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice PR, @immrsd! I left a few questions and comments

import { durationToTimestamp } from './utils/duration';
import { toUint, validateUint } from './utils/convert-strings';

export type VestingSchedule = 'linear' | 'custom';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we already have the "steps" schedule implemented as a mock and as an example in "Usage", do you think it's worth adding the option here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I don't reckon it's worth it. The steps schedule is mostly for demonstration purposes, it's kinda naive and I expect it to be used almost never or very rarely

Comment on lines +54 to +63
<HelpTooltip link="https://docs.openzeppelin.com/contracts-cairo/access#ownership_and_ownable">
Simple mechanism with a single account authorized for all privileged actions.
</HelpTooltip>
</label>
<label class:checked={opts.schedule === "custom"}>
<input type="radio" bind:group={opts.schedule} value="custom">
Custom
<HelpTooltip link="https://docs.openzeppelin.com/contracts-cairo/access#role_based_accesscontrol">
Flexible mechanism with a separate role for each privileged action. A role can have many authorized accounts.
</HelpTooltip>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tooltips need to be fixed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't want to include the steps vesting option, I think we can at least direct users to it as an example when hovering the Custom tooltip

if (!match) {
if (!match || match.length < 2) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there cases where a happy match also has match.length < 2?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, since later on we access the 1st and the 2nd items of the match array in unsafe manner. Either way it'll result in a runtime exception, but it's better to have a straightforward error than index-out-of-bounds one

image

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