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

StreamEscrow #866

Open
wants to merge 106 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
018a92c
initial poc code from escrowed streams
davidbrai Sep 10, 2024
a50aa50
fix bug
davidbrai Sep 10, 2024
5a7aa57
add tests
davidbrai Sep 11, 2024
66f8ca9
first auction doesn't stream yet
davidbrai Sep 11, 2024
807fad7
immediately stream remainder
davidbrai Sep 11, 2024
dc55686
cant cancel finished stream
davidbrai Sep 12, 2024
1b39ffb
forward streams only if 24 hours passed
davidbrai Sep 12, 2024
36d29dc
add auction house setter
davidbrai Sep 12, 2024
89fa882
add a cancel multiple streams convenience function
davidbrai Sep 12, 2024
b29dd94
add event
davidbrai Sep 12, 2024
c2ac8cc
rename
davidbrai Oct 8, 2024
90460ab
rename auction house from v2 to v3
davidbrai Oct 8, 2024
4c5e222
update auction house upgrade fork test
davidbrai Oct 9, 2024
cea51ca
cleanup
davidbrai Oct 9, 2024
0bd01f3
change stream permissions
davidbrai Oct 21, 2024
cc80771
stream escrows: rename auctions to ticks
davidbrai Oct 21, 2024
0e7f233
send streamed eth to treasury immediately
davidbrai Oct 22, 2024
417153f
rename var
davidbrai Oct 25, 2024
226c9a6
rename var
davidbrai Oct 25, 2024
41c33c5
cleanup
davidbrai Oct 25, 2024
7dc3fe0
cleanup
davidbrai Oct 25, 2024
1e8607c
add ethRecipient and nounsRecipient addresses settable by daoExecutor
davidbrai Oct 25, 2024
bab1657
bugfix
davidbrai Nov 4, 2024
8c7ed73
refactor finish streams
davidbrai Nov 4, 2024
657ba6a
added fastForward function
davidbrai Nov 4, 2024
c24bf96
better require statements
davidbrai Nov 5, 2024
92d1a20
rename ticks to currentTick
davidbrai Nov 5, 2024
657dd70
create stream: must be whitelisted and noun owner or approved
davidbrai Nov 6, 2024
911bf00
add setAllowedToCreateStream
davidbrai Nov 6, 2024
7601506
remove todo
davidbrai Nov 6, 2024
5b6cb53
adding tests
davidbrai Nov 6, 2024
9149e62
add tests
davidbrai Nov 6, 2024
5cbda80
add test
davidbrai Nov 6, 2024
b57a9e7
add test
davidbrai Nov 7, 2024
9670bdf
add test
davidbrai Nov 7, 2024
a175286
tests
davidbrai Nov 7, 2024
700695a
small refactor
davidbrai Nov 7, 2024
8a284f0
add events
davidbrai Nov 7, 2024
e105c22
gas optimizations
davidbrai Nov 7, 2024
565fca7
gas optimizations
davidbrai Nov 7, 2024
955cef4
natspec
davidbrai Nov 7, 2024
c69432f
add tests
davidbrai Nov 8, 2024
5dc56f0
add events
davidbrai Nov 8, 2024
0d6bda8
fix test
davidbrai Nov 8, 2024
4b1093e
natspec
davidbrai Nov 8, 2024
45b8561
natspec
davidbrai Nov 8, 2024
b866c04
minor refactor
davidbrai Nov 11, 2024
a150478
minor refactor
davidbrai Nov 11, 2024
fca5a6e
natspec
davidbrai Nov 11, 2024
9b0f753
extract minimumTickDuration
davidbrai Nov 11, 2024
d205cd7
remove stale comment
davidbrai Nov 11, 2024
e8ed97c
fix natspec
davidbrai Nov 11, 2024
a2ab0a9
cleanup
davidbrai Nov 11, 2024
9a301cd
minor
davidbrai Nov 11, 2024
7899ded
natspec
davidbrai Nov 11, 2024
04c70a2
cleanup
davidbrai Nov 11, 2024
cd0f572
cleanup
davidbrai Nov 11, 2024
bb71819
add test
davidbrai Nov 11, 2024
7689e3b
minor rename
davidbrai Nov 11, 2024
e059817
add fork test
davidbrai Nov 11, 2024
37e3e44
add more fork tests
davidbrai Nov 11, 2024
a759003
natspec
davidbrai Nov 12, 2024
d82688b
add rescueTokens function
davidbrai Nov 12, 2024
bff9090
Merge remote-tracking branch 'origin/master' into verbs-stream-escrow…
davidbrai Nov 12, 2024
e385d78
modify stream escrow events
davidbrai Nov 14, 2024
bd2278d
add deploy scripts for stream escrow
davidbrai Nov 14, 2024
a87718e
hardhat script deploy with auction house v2
davidbrai Nov 14, 2024
d30f27b
improve event
davidbrai Nov 14, 2024
291f12e
subgraph: streamescrow events wiring
eladmallel Nov 18, 2024
6a9f602
subgraph: handling some streams events WIP
eladmallel Nov 18, 2024
17aea76
subgraph: stream escrow first tests WIP
eladmallel Nov 18, 2024
a46154c
subgraph: more tests WIP
eladmallel Nov 18, 2024
f4e472b
subgraph: support multiple streams per noun
eladmallel Nov 19, 2024
3634f28
subgraph: add stream escrow tests
eladmallel Nov 19, 2024
fca48d6
stream escrow: add events in constructor
eladmallel Nov 19, 2024
a3b8be2
ci fix attemp
davidbrai Nov 20, 2024
71ed6ce
stream escrow: improve events
davidbrai Nov 20, 2024
1fb7d84
add fastForwardMultipleStreams
davidbrai Nov 20, 2024
ed6dc7d
Revert "add fastForwardMultipleStreams"
davidbrai Nov 20, 2024
f2ee6d0
Merge branch 'verbs-stream-escrow-nouner-can-create-stream' into verb…
davidbrai Nov 20, 2024
79bb07f
add fastForwardMultipleStreams
davidbrai Nov 20, 2024
47394bd
subgraph: update stream escrow ABI and set stream start tick
eladmallel Nov 20, 2024
8395db0
subgraph: fix bug
eladmallel Nov 20, 2024
cf241d1
subgraph: update ethStreamedPerTick on more events
eladmallel Nov 20, 2024
7949033
Merge pull request #869 from nounsDAO/verbs-stream-escrow-subgraph
davidbrai Nov 21, 2024
eb6194b
subgraph: new sepolia config for stream escrow
eladmallel Nov 21, 2024
d789cf3
subgraph: fix missing stream per tick update
eladmallel Nov 21, 2024
09d5d0d
subgraph: fix past streams saving
eladmallel Nov 22, 2024
172db75
add unstreamedETHForNoun
davidbrai Dec 2, 2024
f1c4fdf
add test
davidbrai Dec 2, 2024
a1d38e3
don't allow nounsRecipient to be zero address
davidbrai Dec 3, 2024
8888e0d
add natspec
davidbrai Dec 3, 2024
eaab477
minor refactor and natspec
davidbrai Dec 3, 2024
41c3b43
Merge pull request #870 from nounsDAO/verbs-stream-escrow-unstreamed-…
davidbrai Dec 3, 2024
d9ec4b5
refactor to follow checks-effects-interactions
davidbrai Dec 4, 2024
4285edb
Merge remote-tracking branch 'origin/verbs-stream-escrow-fix-audit-is…
davidbrai Dec 11, 2024
8df901f
use safeTransfer when rescuing tokens
davidbrai Dec 11, 2024
adede58
Merge pull request #873 from nounsDAO/verbs-stream-escrow-audit-fixes
davidbrai Dec 12, 2024
90a5dcd
pin subgraph ci on ubuntu 22
davidbrai Dec 12, 2024
55e3892
add subgraph ci file to trigger ci
davidbrai Dec 12, 2024
eee11e5
Merge pull request #874 from nounsDAO/verbs-stream-escrow-fix-subgrap…
davidbrai Dec 12, 2024
aa116ec
add view function for ticksLeft in stream
davidbrai Dec 12, 2024
00edb18
cleanup
davidbrai Dec 12, 2024
308b52d
add sherlock audit for stream escrow
davidbrai Dec 12, 2024
575b15b
add deployment info
davidbrai Dec 12, 2024
c46406b
Merge pull request #875 from nounsDAO/verbs-stream-escrow-add-ticks-left
davidbrai Dec 12, 2024
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
5 changes: 3 additions & 2 deletions .github/workflows/subgraph-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ on:
paths:
- 'packages/nouns-contracts/abi/contracts/**'
- 'packages/nouns-subgraph/**'
- '.github/workflows/subgraph-test.yaml'
branches:
- '**'

jobs:
build_and_test:
name: Build and Test
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -30,7 +31,7 @@ jobs:
- name: Prepare subgraph yaml
run: |
cd packages/nouns-subgraph
yarn prepare:rinkeby
yarn prepare:sepolia
- name: Generate code
run: |
cd packages/nouns-subgraph
Expand Down
323 changes: 323 additions & 0 deletions packages/nouns-contracts/abi/contracts/StreamEscrow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,323 @@
[
{
"type": "constructor",
"inputs": [
{ "name": "daoExecutor_", "type": "address", "internalType": "address" },
{ "name": "ethRecipient_", "type": "address", "internalType": "address" },
{ "name": "nounsRecipient_", "type": "address", "internalType": "address" },
{ "name": "nounsToken_", "type": "address", "internalType": "address" },
{ "name": "streamCreator_", "type": "address", "internalType": "address" },
{ "name": "minimumTickDuration_", "type": "uint32", "internalType": "uint32" }
],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "allowedToCreateStream",
"inputs": [{ "name": "", "type": "address", "internalType": "address" }],
"outputs": [{ "name": "", "type": "bool", "internalType": "bool" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "cancelStream",
"inputs": [{ "name": "nounId", "type": "uint256", "internalType": "uint256" }],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "cancelStreams",
"inputs": [{ "name": "nounIds", "type": "uint256[]", "internalType": "uint256[]" }],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "createStream",
"inputs": [
{ "name": "nounId", "type": "uint256", "internalType": "uint256" },
{ "name": "streamLengthInTicks", "type": "uint16", "internalType": "uint16" }
],
"outputs": [],
"stateMutability": "payable"
},
{
"type": "function",
"name": "currentTick",
"inputs": [],
"outputs": [{ "name": "", "type": "uint32", "internalType": "uint32" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "daoExecutor",
"inputs": [],
"outputs": [{ "name": "", "type": "address", "internalType": "address" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "ethRecipient",
"inputs": [],
"outputs": [{ "name": "", "type": "address", "internalType": "address" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "ethStreamEndingAtTick",
"inputs": [{ "name": "tick", "type": "uint256", "internalType": "uint256" }],
"outputs": [{ "name": "ethPerTick", "type": "uint128", "internalType": "uint128" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "ethStreamedPerTick",
"inputs": [],
"outputs": [{ "name": "", "type": "uint128", "internalType": "uint128" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "fastForwardStream",
"inputs": [
{ "name": "nounId", "type": "uint256", "internalType": "uint256" },
{ "name": "ticksToForward", "type": "uint32", "internalType": "uint32" }
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "forwardAll",
"inputs": [],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "forwardAllAndCreateStream",
"inputs": [
{ "name": "nounId", "type": "uint256", "internalType": "uint256" },
{ "name": "streamLengthInTicks", "type": "uint16", "internalType": "uint16" }
],
"outputs": [],
"stateMutability": "payable"
},
{
"type": "function",
"name": "getStream",
"inputs": [{ "name": "nounId", "type": "uint256", "internalType": "uint256" }],
"outputs": [
{
"name": "",
"type": "tuple",
"internalType": "struct IStreamEscrow.Stream",
"components": [
{ "name": "ethPerTick", "type": "uint128", "internalType": "uint128" },
{ "name": "canceled", "type": "bool", "internalType": "bool" },
{ "name": "lastTick", "type": "uint32", "internalType": "uint32" }
]
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "isStreamActive",
"inputs": [{ "name": "nounId", "type": "uint256", "internalType": "uint256" }],
"outputs": [{ "name": "", "type": "bool", "internalType": "bool" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "lastForwardTimestamp",
"inputs": [],
"outputs": [{ "name": "", "type": "uint48", "internalType": "uint48" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "minimumTickDuration",
"inputs": [],
"outputs": [{ "name": "", "type": "uint32", "internalType": "uint32" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "nounsRecipient",
"inputs": [],
"outputs": [{ "name": "", "type": "address", "internalType": "address" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "nounsToken",
"inputs": [],
"outputs": [{ "name": "", "type": "address", "internalType": "contract INounsToken" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "rescueToken",
"inputs": [
{ "name": "token", "type": "address", "internalType": "address" },
{ "name": "to", "type": "address", "internalType": "address" },
{ "name": "amount", "type": "uint256", "internalType": "uint256" }
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "setAllowedToCreateStream",
"inputs": [
{ "name": "address_", "type": "address", "internalType": "address" },
{ "name": "allowed", "type": "bool", "internalType": "bool" }
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "setDAOExecutorAddress",
"inputs": [{ "name": "newAddress", "type": "address", "internalType": "address" }],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "setETHRecipient",
"inputs": [{ "name": "newAddress", "type": "address", "internalType": "address" }],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "setNounsRecipient",
"inputs": [{ "name": "newAddress", "type": "address", "internalType": "address" }],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "event",
"name": "AllowedToCreateStreamChanged",
"inputs": [
{ "name": "address_", "type": "address", "indexed": false, "internalType": "address" },
{ "name": "allowed", "type": "bool", "indexed": false, "internalType": "bool" }
],
"anonymous": false
},
{
"type": "event",
"name": "DAOExecutorAddressSet",
"inputs": [
{ "name": "newAddress", "type": "address", "indexed": false, "internalType": "address" }
],
"anonymous": false
},
{
"type": "event",
"name": "ETHRecipientSet",
"inputs": [
{ "name": "newAddress", "type": "address", "indexed": false, "internalType": "address" }
],
"anonymous": false
},
{
"type": "event",
"name": "ETHStreamedToDAO",
"inputs": [
{ "name": "amount", "type": "uint256", "indexed": false, "internalType": "uint256" }
],
"anonymous": false
},
{
"type": "event",
"name": "NounsRecipientSet",
"inputs": [
{ "name": "newAddress", "type": "address", "indexed": false, "internalType": "address" }
],
"anonymous": false
},
{
"type": "event",
"name": "StreamCanceled",
"inputs": [
{ "name": "nounId", "type": "uint256", "indexed": true, "internalType": "uint256" },
{ "name": "amountToRefund", "type": "uint256", "indexed": false, "internalType": "uint256" },
{
"name": "ethStreamedPerTick",
"type": "uint128",
"indexed": false,
"internalType": "uint128"
}
],
"anonymous": false
},
{
"type": "event",
"name": "StreamCreated",
"inputs": [
{ "name": "nounId", "type": "uint256", "indexed": true, "internalType": "uint256" },
{ "name": "totalAmount", "type": "uint256", "indexed": false, "internalType": "uint256" },
{
"name": "streamLengthInTicks",
"type": "uint16",
"indexed": false,
"internalType": "uint16"
},
{ "name": "ethPerTick", "type": "uint256", "indexed": false, "internalType": "uint256" },
{
"name": "newEthStreamedPerTick",
"type": "uint128",
"indexed": false,
"internalType": "uint128"
},
{ "name": "lastTick", "type": "uint32", "indexed": false, "internalType": "uint32" }
],
"anonymous": false
},
{
"type": "event",
"name": "StreamFastForwarded",
"inputs": [
{ "name": "nounId", "type": "uint256", "indexed": true, "internalType": "uint256" },
{ "name": "ticksToForward", "type": "uint256", "indexed": false, "internalType": "uint256" },
{ "name": "newLastTick", "type": "uint256", "indexed": false, "internalType": "uint256" },
{
"name": "ethStreamedPerTick",
"type": "uint128",
"indexed": false,
"internalType": "uint128"
}
],
"anonymous": false
},
{
"type": "event",
"name": "StreamsForwarded",
"inputs": [
{ "name": "currentTick", "type": "uint256", "indexed": false, "internalType": "uint256" },
{
"name": "ethPerTickStreamEnded",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
},
{
"name": "nextEthStreamedPerTick",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
},
{
"name": "lastForwardTimestamp",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
}
],
"anonymous": false
}
]
Binary file not shown.

Large diffs are not rendered by default.

Loading
Loading