-
Notifications
You must be signed in to change notification settings - Fork 0
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
ALL CHANGES #1
Closed
ALL CHANGES #1
Changes from 2 commits
Commits
Show all changes
555 commits
Select commit
Hold shift + click to select a range
8590f28
external claim
gaetbout ff9b8dc
fix re-entrant
gaetbout 241f4a4
claim internal done
gaetbout 666714d
working pausable
gaetbout 8dc113d
poc using library calls
sgc-code f042e67
fix escrow account validation
sgc-code 3558e03
factory tests
gaetbout f32091d
upgrade and gift_status
Leonard-Pat 5250246
clean
gaetbout 739617f
remove upgrade fn
Leonard-Pat d05f50f
fixing upgrade periods
gaetbout 560ffa1
Merge pull request #35 from argentlabs/fix-escrow-account-validation
sgc-code f5761a1
Merge branch 'develop' into test/events
sgc-code 3c5974b
Merge branch 'develop' into upgrade/fix-period-csts
sgc-code 84a10d5
Merge pull request #37 from argentlabs/upgrade/fix-period-csts
sgc-code b2bcec2
Merge branch 'develop' into test/events
Leonard-Pat e64515d
remove comment and name last arg of event
Leonard-Pat 55ef2bf
Merge pull request #33 from argentlabs/test/events
Leonard-Pat e59c9a7
genericAccount => devnetAccount
gaetbout 8bad2bb
gas price devnet testnet
gaetbout 4b070f2
format
gaetbout 78c40a9
Merge branch 'develop' into testnet-test
gaetbout c7ee4c7
Merge branch 'develop' into poc-library-calls
sgc-code 8530439
fix succeeded instead of accepted on l2
gaetbout b319b0a
fixing 'Not possible to claim more via reentrancy' test
gaetbout 9ae3a32
returning receipt instead of response
gaetbout 1928abd
using executtion_status from receipt
gaetbout 2f5ffd5
more features moved to account impl
sgc-code a854012
example for outside execution
sgc-code 7d66afa
Merge branch 'develop' into test/missing-tests
Leonard-Pat 33eec92
fix time
Leonard-Pat 934c810
new upgrade changes
Leonard-Pat cf2b021
more upgrade tests - remove status
Leonard-Pat d6d2900
upgrade tessts
Leonard-Pat 99b7352
update fixtures
Leonard-Pat 2717336
update comment
Leonard-Pat ea80833
getMaxGift => getGiftAmount
gaetbout 9bba7f4
batman
gaetbout 960cbed
revert expecteation file
gaetbout 8b8ee60
format
gaetbout a1e399c
Merge pull request #38 from argentlabs/small-fixes
Leonard-Pat eaaec76
fix all tests
Leonard-Pat 3db615b
remove top comments
gaetbout f1edb6c
add class hash to deposit function
Leonard-Pat ba24148
updated deposit function to use claimAccountClassHash
Leonard-Pat d532e29
deposit tests
Leonard-Pat 3d1623e
remove ds store
Leonard-Pat b5a1ce8
gitignore
Leonard-Pat 72e9acd
Update src/contracts/timelock_upgrade.cairo
Leonard-Pat e47ae9e
basic scripts
Leonard-Pat 1c892ea
scripts
Leonard-Pat a27dbc4
pr comments
Leonard-Pat 87944cf
Update scripts/claim-dust.ts
Leonard-Pat e8559d1
fix linting errors
Leonard-Pat 8ab92bc
update tests
Leonard-Pat c7dd4a4
comment
Leonard-Pat 14b1258
update gas report for baseline
gaetbout d98ec5a
format + useTxV3
gaetbout 2ff0011
get dust + claim external using txv3
gaetbout a07d41e
format
gaetbout abae971
remove useless arg
gaetbout 8ba369b
use setDefaultTransactionVersionV3
gaetbout c8c09f0
update get dust to use tx version
gaetbout ab28b5a
format
gaetbout 1139cae
remove never used details
gaetbout 78440f4
account ternary operator
gaetbout 5e7bbf8
Merge pull request #30 from argentlabs/testnet-test
sgc-code 8de4399
Merge branch 'develop' into test/missing-tests
sgc-code 29528fe
merge
Leonard-Pat bb70299
review comments
sgc-code f0856f1
simplify
sgc-code 6aaa274
Merge branch 'develop' into poc-library-calls
sgc-code 9152ed5
rename
sgc-code 29513c8
format
sgc-code 681a2b1
simplify events
sgc-code b80c2c2
first draft
gaetbout 8ce144e
fix upgrade tests
Leonard-Pat aaf4b33
remove class hash
Leonard-Pat 72005f5
remove only
Leonard-Pat 13962d6
2 type deser
gaetbout 89e2ef8
full_deser + selector from calldata
gaetbout 1ebd55c
ILama => IExecutableAction
gaetbout 2b55c34
Merge pull request #39 from argentlabs/feat/class-hash-deposit
sgc-code 93712f0
Merge branch 'develop' into test/missing-tests
Leonard-Pat ddc6d93
fix most tests
sgc-code 30e9943
Merge branch 'develop' into poc-library-calls
sgc-code c98e97a
udpate gas report
sgc-code 7045f07
Merge branch 'poc-library-calls' into feat/action-safeguards
sgc-code d866177
execute_action update signature
gaetbout 3acaa3a
emtpy line
Leonard-Pat 56fb502
Update tests-integration/upgrade.test.ts
Leonard-Pat ea5ae6c
calc days
Leonard-Pat fcd8750
ignore
Leonard-Pat 14b457a
Update src/contracts/timelock_upgrade.cairo
Leonard-Pat ca1b08d
describe blocks
Leonard-Pat 3282203
Merge pull request #36 from argentlabs/test/missing-tests
Leonard-Pat d30e883
Merge branch 'develop' into poc-library-calls
sgc-code e3977f3
Update src/contracts/claim_account_impl.cairo
sgc-code 3dbce5a
style
sgc-code f3d33cd
Merge branch 'poc-library-calls' of https://github.com/argentlabs/arg…
sgc-code 1b81ebd
style
sgc-code a434e35
fixing tests
gaetbout c632e9f
Using Sergio's impl
gaetbout 90996fa
Update src/contracts/claim_account_impl.cairo
sgc-code c33481a
remove interface.cairo
sgc-code 2af66b8
Merge pull request #34 from argentlabs/poc-library-calls
sgc-code e9a3676
Merge branch 'develop' into package-by-feature
sgc-code 0d50cfa
formatter
sgc-code 7c128fa
merge w develop
gaetbout 688a23e
failing entrypoint not found
gaetbout 6a47463
exposing fns
gaetbout 11ce476
reverting some code'
gaetbout 9bdd790
merge w develop
gaetbout aaed507
Merge pull request #42 from argentlabs/feat/action-safeguards
sgc-code 520dbc8
no message
sgc-code 5f53272
Merge pull request #45 from argentlabs/package-by-feature
sgc-code 3ad8b6d
first pass
Leonard-Pat 527f7a6
second pass
Leonard-Pat efdabea
thrid pass
Leonard-Pat 2e12df0
forth pass
Leonard-Pat 112921b
fifth pass
Leonard-Pat 658a8aa
final test
Leonard-Pat 12f1026
rename library
Leonard-Pat 67f553e
Fix outside execution version
sgc-code 869f76c
rename all account --> escrow
Leonard-Pat c9a92a3
improve lib call syntax
sgc-code 611223d
Merge branch 'feat/grand-rename' into fix-outside-execution-version
sgc-code fbfba40
Merge branch 'feat/grand-rename' into improve-lib-call-syntax
sgc-code 38083bb
Update src/mocks/reentrant_erc20.cairo
Leonard-Pat 5826460
improve balance_of syntax
sgc-code dce2e8a
fix profiler
Leonard-Pat 7713a24
pr comments
Leonard-Pat 29fc3a4
library dispatcher
Leonard-Pat 75ceaca
Merge branch 'feat/grand-rename' into improve-balance_of-syntax
sgc-code 3e79807
Merge branch 'feat/grand-rename' into improve-lib-call-syntax
sgc-code 08b1de8
Merge branch 'feat/grand-rename' into fix-outside-execution-version
sgc-code d70200b
comments
Leonard-Pat 07d04ed
tweaks to upgrade
sgc-code 63ec58a
Merge pull request #46 from argentlabs/feat/grand-rename
sgc-code c3d380a
Merge branch 'feat/grand-rename' into improve-lib-call-syntax
sgc-code aeab5ca
Merge branch 'develop' into improve-lib-call-syntax
sgc-code b63ba14
Merge pull request #47 from argentlabs/fix-outside-execution-version
sgc-code 54e67f1
Merge branch 'develop' into improve-balance_of-syntax
sgc-code 0b67de7
Merge branch 'develop' into improve-lib-call-syntax
sgc-code ba09219
Merge branch 'develop' into tweaks-to-upgrade
sgc-code 0184c19
Merge pull request #48 from argentlabs/improve-lib-call-syntax
sgc-code 5111c0c
Merge pull request #49 from argentlabs/improve-balance_of-syntax
sgc-code 6be55b8
Merge branch 'develop' into tweaks-to-upgrade
sgc-code a5cec1d
update tests
sgc-code 31d2427
better is_zero
sgc-code a325e9c
first draft
gaetbout 3b52d8e
Default instead of Zero
sgc-code 2f3bab5
remove TODOs
sgc-code 1899509
save
gaetbout 3027145
remove not tested
gaetbout f25ed3d
remvoe extra comment
gaetbout 835e9b9
Test invalid selector on lib calls
sgc-code 37b55d5
fixing tests
gaetbout 8317ffd
revert
gaetbout 237b64b
Merge pull request #53 from argentlabs/test-invalid-selector-on-lib-c…
sgc-code 5f2a576
fixing tests
gaetbout 6d8b7c8
revert comment
gaetbout 664afc4
Merge branch 'develop' into remove-todos
Leonard-Pat 40b4f79
Merge pull request #51 from argentlabs/remove-todos
Leonard-Pat 6f12450
Merge branch 'develop' into align-error-message
Leonard-Pat cc94637
fixing tests
gaetbout cf1aea4
Merge pull request #52 from argentlabs/align-error-message
Leonard-Pat 78b769a
Merge branch 'develop' into tweaks-to-upgrade
sgc-code 8002326
address PR issues
sgc-code b5c67f5
use chai should
sgc-code b37d239
fix linter
sgc-code 50c52e7
Merge pull request #50 from argentlabs/tweaks-to-upgrade
sgc-code 897b124
update readme
sgc-code 3fccd11
Update README.md
sgc-code ff14bb7
Update README.md
sgc-code 6992b48
Update README.md
sgc-code 3875bf3
Update README.md
sgc-code 5d28fc5
update readme
sgc-code b9bcf07
Merge branch 'update-readme' of https://github.com/argentlabs/argent-…
sgc-code ff63b10
Merge branch 'develop' into update-readme
sgc-code cb47e93
Update README.md
sgc-code b2ceb81
Update README.md
sgc-code 545d964
more dots
sgc-code 87b66c3
Update README.md
sgc-code b16fede
Update README.md
sgc-code d63be19
Merge pull request #55 from argentlabs/update-readme
sgc-code 7a74bfe
fix tests
gaetbout fe6fdff
merge develop
gaetbout 277b3d2
adding all non tested mesgs
gaetbout 7d52520
merge w develop
gaetbout eec0a6c
format + update gas report
gaetbout b66de94
get dust for multiple claims
gaetbout ec2e32f
adding some tests lib acc
gaetbout bea8081
adding factory test
gaetbout 121b8ae
wrong address
gaetbout 9034a3e
invalid calldata
gaetbout f3e5f41
invalid calldata
gaetbout 4d5b22f
the long dong
gaetbout b44de8d
wrong signature
gaetbout 7c3384c
remove comments
gaetbout cc41f23
first draft
gaetbout 6ba61f0
update gas report
gaetbout a1c0f34
Merge branch 'develop' into feat/admin-scripts
Leonard-Pat e42c408
update scripts
Leonard-Pat 624857c
deployment
Leonard-Pat dd519e8
deployed with shared account
Leonard-Pat a07a009
fixing SGC remarks
gaetbout 1594ca4
remove owner
Leonard-Pat 10eeca5
update claim dust
Leonard-Pat 13c82b0
Merge pull request #57 from argentlabs/feat/deploy-sepolia
Leonard-Pat 84887c0
Merge branch 'develop' into feat/admin-scripts
Leonard-Pat 936ef28
rename file to snake
Leonard-Pat 570b9b9
import
Leonard-Pat d25f799
Merge pull request #41 from argentlabs/profile/dust
sgc-code eca7529
Merge pull request #40 from argentlabs/feat/admin-scripts
sgc-code e0c5196
Merge branch 'develop' into align-error-message-tests
sgc-code e422a9d
add diagrams
sgc-code f4d21a8
Merge pull request #54 from argentlabs/align-error-message-tests
sgc-code bcdc0b8
Merge branch 'develop' into add-diagrams
sgc-code 33e2656
first draft
gaetbout d214e1f
middle of fixing
Leonard-Pat 6322a58
Fixed reentrancy tests
Leonard-Pat 3292286
gift --> claim
Leonard-Pat ecbc964
adding factory deposit tests
gaetbout c57036d
use serialize
Leonard-Pat 7fe1446
format
Leonard-Pat b0f1afa
Merge pull request #59 from argentlabs/fix/reentrancy
sgc-code 012cd67
Merge pull request #60 from argentlabs/tests/failing-trasnfers
sgc-code e4ab499
Merge branch 'develop' into gas-report
sgc-code a61e5b4
Merge pull request #56 from argentlabs/gas-report
sgc-code 0f51eb8
Merge branch 'develop' into add-diagrams
sgc-code 4f75243
update diagrams
sgc-code 2d671cc
remove empty deployments file
sgc-code da52dcf
Merge pull request #58 from argentlabs/add-diagrams
sgc-code 436958c
more restrictions on validation
sgc-code 66efc04
fix error message
sgc-code 95850fb
Update src/contracts/escrow_account.cairo
sgc-code 20e0348
Merge pull request #61 from argentlabs/more-restrictions-on-validation
sgc-code 0cb7be8
consistent check for claimed or cancelled
sgc-code 86142ed
fix tests
sgc-code b2d62fb
Merge pull request #62 from argentlabs/consistent-check-for-claimed-o…
sgc-code 9a92001
no message
sgc-code 52b346f
improve upgrade mechanism
sgc-code 7a8466d
assert lock was reset
sgc-code fc1f40d
Merge pull request #63 from argentlabs/better-upgrade
sgc-code 83b9e35
add audit report
sgc-code 4170549
update deployments.txt
gaetbout aac358f
deploy on sepolia
gaetbout d14d871
deploy mainnet with argent.stark as owner
gaetbout 4ab474c
Merge pull request #64 from argentlabs/deploy
sgc-code File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,3 @@ | ||
RPC_URL=http://127.0.0.1:5050 | ||
ADDRESS=0x000000000000000000000000000000000000000000000000000000000000000 | ||
PRIVATE_KEY=0x000000000000000000000000000000000000000000000000000000000000000 |
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,12 @@ | ||
{ | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
"sourceType": "module" | ||
}, | ||
"extends": ["plugin:@typescript-eslint/recommended"], | ||
"env": { | ||
"node": true | ||
}, | ||
"ignorePatterns": ["dist", "cairo"] | ||
} |
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,26 @@ | ||
name: Cairo CI | ||
|
||
on: push | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Step 1 - Check out main branch | ||
uses: actions/checkout@v3 | ||
- name: Step 2 - Getting scarb | ||
uses: software-mansion/[email protected] | ||
- name: Step 3 - Setting up snfoundry | ||
uses: foundry-rs/setup-snfoundry@v3 | ||
- name: Step 4 - Running tests | ||
run: scarb test | ||
|
||
format: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Step 1 - Check out main branch | ||
uses: actions/checkout@v3 | ||
- name: Step 2 - Getting scarb | ||
uses: software-mansion/[email protected] | ||
- name: Step 3 - Checking format | ||
run: scarb fmt --check |
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,46 @@ | ||
name: Integration CI | ||
|
||
on: push | ||
|
||
jobs: | ||
integration-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out main branch | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Scarb | ||
uses: software-mansion/[email protected] | ||
|
||
- name: Install project | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Start devnet in background | ||
run: scarb run start-devnet | ||
|
||
- name: Run integration tests | ||
run: scarb --release build && tsc && yarn mocha tests-integration/*.test.ts --forbid-only --forbid-pending | ||
|
||
format: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Step 1 - Check out main branch | ||
uses: actions/checkout@v3 | ||
|
||
- name: Step 2 - Install project | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Step 3 - Check correct formatting | ||
run: yarn prettier --check . | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Step 1 - Check out main branch | ||
uses: actions/checkout@v3 | ||
|
||
- name: Step 2 - Install project | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Step 3 - Check correct linting | ||
run: yarn eslint . |
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,45 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules | ||
jspm_packages | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
.next | ||
|
||
# Cairo | ||
target | ||
.snfoundry_cache/ | ||
|
||
.env | ||
dist |
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,7 @@ | ||
{ | ||
"extensions": ["ts"], | ||
"test": ["tests/**.ts"], | ||
"node-option": ["loader=ts-node/esm"], | ||
"slow": 5000, | ||
"timeout": 300000 | ||
} |
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 @@ | ||
18 |
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,8 @@ | ||
cairo | ||
venv | ||
target | ||
deployments/artifacts | ||
dist | ||
.github | ||
tests-integration/fixtures | ||
starknet-devnet-rs |
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,9 @@ | ||
{ | ||
"arrowParens": "always", | ||
"useTabs": false, | ||
"trailingComma": "all", | ||
"singleQuote": false, | ||
"semi": true, | ||
"printWidth": 120, | ||
"plugins": ["prettier-plugin-organize-imports"] | ||
} |
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,2 @@ | ||
scarb 2.6.3 | ||
starknet-foundry 0.24.0 |
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,8 @@ | ||
# Use the base image | ||
FROM shardlabs/starknet-devnet-rs:c4185522228f61ba04619151eb5706d4610fb00f | ||
|
||
# Expose port 5050 | ||
EXPOSE 5050 | ||
|
||
# Set default command to run the container | ||
CMD ["--gas-price", "36000000000", "--data-gas-price", "1", "--timeout", "320", "--seed", "0"] |
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,53 @@ | ||
// TODO This is outdated | ||
|
||
# Starknet Gifting | ||
|
||
The protocol implemented in this repository can be used for gifting tokens to a recipient without giving custody of the tokens to a third party. But it can also be used to transfer tokens to a repicient identified by an email or a phone number. Both products are supported by the same smart-contract and depends solely on the client being built on top. | ||
|
||
## High level Flow | ||
|
||
- The sender creates a key pair `claim_key` locally and deposits the tokens to transfer to the escrow account together with a small amount of fee token (ETH or STRK) to cover the claim. He provides the public key `claim_key.pub` as an identifier for the transfer. | ||
- The sender shares the private key `claim_key.priv` with the recipient over an external channel such as email or phone. | ||
- The recipient claims the tokens by transferring them from the escrow to an account he controls using `claim_key.priv` to sign the transaction. | ||
|
||
## Fee | ||
|
||
Because the escrow is an account, it can pay for its own transactions and the recipient doesn't need to have funds to initiate the claim. This makes it great to onboard new users that can claim a gift to a newly created and undeployed account. | ||
|
||
The Escrow contract can operate in 2 modes depending on the value of the `use_fee` flag. | ||
|
||
When `use_fee = false` the sender doesn't need to cover the fee for the claim because the operator of the escrow sponsors the transfers by depositing sufficient ETH or STRK on the escrow contract. | ||
|
||
When `use_fee = true` the fee of the claim must be covered by the sender, and he is required to deposit some ETH or STRK together with the token being gifted. The amount of fee token he provides must be sufficient to cover the claim. The recipient of the claim can use up to that value as specified in the max fee of the claim transaction. | ||
|
||
If the max fee of the claim transaction is less than the max fee allocated to the claim, the difference is added to a counter and can be later retrieved by the operator of the escrow contract as a paiement for his operation of the protocol. However, the difference between the max fee of the claim transaction and the actual fee of the transaction cannot be acounted for in the contract and will be stuck. We can imagine using that dust later by setting `use_fee = true` and sponsoring gifts for a limited period. | ||
|
||
## Canceling Gifts | ||
|
||
Gifts can be canceled by the sender provided that they have not been claimed yet. If the gift covers the claim fee the sender can recover both the gift and the claim fee he provided. | ||
|
||
In the unlikely event that the recipient tried to claim a gift but the transaction failed in execution, some of the claim fee will have been used. The gift can no longer be claimed but can be canceled by the sender. Canceling the gift will only recover the gift but not the remaining claim fee. | ||
|
||
## Development | ||
|
||
### asdf | ||
|
||
Install asdf following [instructions](https://asdf-vm.com/guide/getting-started.html) and run this | ||
|
||
``` | ||
asdf plugin add scarb | ||
asdf plugin add starknet-foundry | ||
asdf install | ||
``` | ||
|
||
### Setup scarb and foundry | ||
|
||
Thanks to the [.tool-versions file](./.tool-versions), you don't need to install a specific scarb or starknet foundry version. The correct one will be automatically downloaded and installed. | ||
|
||
### Build the contracts | ||
|
||
`scarb build` | ||
|
||
### Test the contracts | ||
|
||
`snforge test` |
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,54 @@ | ||
# Code generated by scarb DO NOT EDIT. | ||
version = 1 | ||
|
||
[[package]] | ||
name = "alexandria_data_structures" | ||
version = "0.2.0" | ||
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=cairo-v2.6.0#946e6e2f9d390ad9f345882a352c0dd6f02ef3ad" | ||
dependencies = [ | ||
"alexandria_encoding", | ||
] | ||
|
||
[[package]] | ||
name = "alexandria_encoding" | ||
version = "0.1.0" | ||
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=cairo-v2.6.0#946e6e2f9d390ad9f345882a352c0dd6f02ef3ad" | ||
dependencies = [ | ||
"alexandria_math", | ||
"alexandria_numeric", | ||
] | ||
|
||
[[package]] | ||
name = "alexandria_math" | ||
version = "0.2.0" | ||
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=cairo-v2.6.0#946e6e2f9d390ad9f345882a352c0dd6f02ef3ad" | ||
dependencies = [ | ||
"alexandria_data_structures", | ||
] | ||
|
||
[[package]] | ||
name = "alexandria_numeric" | ||
version = "0.1.0" | ||
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=cairo-v2.6.0#946e6e2f9d390ad9f345882a352c0dd6f02ef3ad" | ||
dependencies = [ | ||
"alexandria_math", | ||
] | ||
|
||
[[package]] | ||
name = "openzeppelin" | ||
version = "0.13.0" | ||
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.13.0#978b4e75209da355667d8954d2450e32bd71fe49" | ||
|
||
[[package]] | ||
name = "snforge_std" | ||
version = "0.24.0" | ||
source = "git+https://github.com/foundry-rs/starknet-foundry?tag=v0.24.0#95e9fb09cb91b3c05295915179ee1b55bf923653" | ||
|
||
[[package]] | ||
name = "starknet_gifting" | ||
version = "0.1.0" | ||
dependencies = [ | ||
"alexandria_math", | ||
"openzeppelin", | ||
"snforge_std", | ||
] |
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,27 @@ | ||
[package] | ||
name = "starknet_gifting" | ||
version = "0.1.0" | ||
edition = "2023_10" | ||
|
||
|
||
[dependencies] | ||
starknet = "2.6.3" | ||
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.24.0" } | ||
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.13.0" } | ||
alexandria_math = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "cairo-v2.6.0" } | ||
|
||
[[target.starknet-contract]] | ||
sierra = true | ||
casm = true | ||
|
||
[tool.fmt] | ||
max-line-length = 120 | ||
sort-module-level-items = true | ||
|
||
[scripts] | ||
test = "snforge test" | ||
start-devnet = "docker build -t devnet . && docker run -d -p 127.0.0.1:5050:5050 devnet" | ||
kill-devnet = "docker ps -q --filter 'ancestor=devnet' | xargs docker stop" | ||
test-ts = "scarb --profile release build && yarn tsc && yarn mocha tests-integration/*.test.ts" | ||
profile = "scarb --profile release build && node --loader ts-node/esm scripts/profile.ts" | ||
format = "scarb fmt && yarn prettier --write ." |
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,4 @@ | ||
## Sepolia | ||
|
||
classhash: 0x5908a9e0785fe551d52413f2289c5c1436a8a7086d569829d0ff10443bf790 | ||
Escrow: 0x1748e6a718e66dd6602be9424fc206988cf8ff807d0a5922bbc2ad4253a2a2f |
This file was deleted.
Oops, something went wrong.
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,18 @@ | ||
Summary: | ||
┌───────────────────────┬─────────────────────┬─────────┬────────────────┬────────────────┬─────────────────┬───────────┬──────────────┬──────────────────────────────┬───────────────┬────────┬─────────┐ | ||
│ (index) │ Actual fee │ Fee usd │ Fee without DA │ Gas without DA │ Computation gas │ Event gas │ Calldata gas │ Max computation per Category │ Storage diffs │ DA fee │ DA mode │ | ||
├───────────────────────┼─────────────────────┼─────────┼────────────────┼────────────────┼─────────────────┼───────────┼──────────────┼──────────────────────────────┼───────────────┼────────┼─────────┤ | ||
│ Deposit (txV3: false) │ '1.152.000.000.352' │ 0.0046 │ 1152000000000 │ 32 │ 31 │ 4 │ 1 │ 'steps' │ 4 │ 352 │ 'BLOB' │ | ||
│ Claim (txV3: false) │ '1.260.000.000.192' │ 0.005 │ 1260000000000 │ 35 │ 34 │ 2 │ 1 │ 'steps' │ 3 │ 192 │ 'BLOB' │ | ||
│ Deposit (txV3: true) │ '1.152.000.000.480' │ 0.0046 │ 1152000000000 │ 32 │ 31 │ 4 │ 1 │ 'steps' │ 5 │ 480 │ 'BLOB' │ | ||
│ Claim (txV3: true) │ '1.260.000.000.192' │ 0 │ 1260000000000 │ 35 │ 34 │ 2 │ 1 │ 'steps' │ 3 │ 192 │ 'BLOB' │ | ||
└───────────────────────┴─────────────────────┴─────────┴────────────────┴────────────────┴─────────────────┴───────────┴──────────────┴──────────────────────────────┴───────────────┴────────┴─────────┘ | ||
Resources: | ||
┌───────────────────────┬─────────┬───────┬───────┬────────┬──────────┬──────────┬─────────────┬───────┐ | ||
│ (index) │ bitwise │ ec_op │ ecdsa │ keccak │ pedersen │ poseidon │ range_check │ steps │ | ||
├───────────────────────┼─────────┼───────┼───────┼────────┼──────────┼──────────┼─────────────┼───────┤ | ||
│ Deposit (txV3: false) │ 0 │ 3 │ 0 │ 0 │ 38 │ 0 │ 277 │ 12098 │ | ||
│ Claim (txV3: false) │ 0 │ 3 │ 0 │ 0 │ 71 │ 0 │ 456 │ 13231 │ | ||
│ Deposit (txV3: true) │ 0 │ 3 │ 0 │ 0 │ 38 │ 0 │ 277 │ 12099 │ | ||
│ Claim (txV3: true) │ 0 │ 3 │ 0 │ 0 │ 71 │ 0 │ 490 │ 13429 │ | ||
└───────────────────────┴─────────┴───────┴───────┴────────┴──────────┴──────────┴─────────────┴───────┘ |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update