-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Absorb reward manager code from everstake - Use PDA for verified_messages account atticlab/audius-reward-manager#10
- Loading branch information
1 parent
30e33ef
commit c060ac6
Showing
35 changed files
with
4,484 additions
and
14 deletions.
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
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
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
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,35 @@ | ||
# JetBrains | ||
.idea/ | ||
|
||
# VSCode | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
*.code-workspace | ||
|
||
# Local History for Visual Studio Code | ||
.history/ | ||
|
||
# Misc | ||
.DS_Store | ||
._* | ||
.Spotlight-V100 | ||
.Trashes | ||
|
||
# ESLint | ||
.eslintcache | ||
|
||
# Build and test | ||
dist/ | ||
build/ | ||
coverage/ | ||
target/ | ||
|
||
# Cache | ||
.cache/ | ||
|
||
# Env | ||
*keypair.json | ||
*.so |
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,5 @@ | ||
[workspace] | ||
members = [ | ||
"program", | ||
"cli", | ||
] |
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,13 @@ | ||
# About | ||
|
||
Audius Reward Manager will be a program which allows trusted node operators (identified by their Ethereum Addresses) to distribute rewards to the users. | ||
|
||
# Operation | ||
|
||
Node operators (or senders) will be using their own business logic to identify which users need to be rewarded with tokens. Each reward can be sent to the user only once, so there will be a unique identifier (called `specifier`) ensuring just a single payout. Also the reward payout can happen only if several senders agree on it (3 for example). | ||
|
||
There is also a separate type of the sender called `bot oracle`. This will be a sender operated by the Audius and while any 3 senders can sign the reward transfer, all transfers also require a signature by the `bot oracle` and messages from the senders also should specify the same `bot oracle` address. | ||
|
||
After signatures from 3 senders and `bot oracle` are verified the tokens are transferred and we create and maintain a `transfer` record which will store an account in the blockchain derived from the `specifier` ensuring no other transfer with the same ID happens again. | ||
|
||
All the signatures are verified using secp256k1 instruction (several of them for several signatures). |
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,31 @@ | ||
# Commands | ||
### Init market | ||
``` | ||
spl-token create-token t1_keypair.json && \ | ||
cargo run init --keypair locnet_keypair.json --token-mint CV3A2AbeKc4CoRRcyWwe96LkPktpaPnUAgnzqJVy6wKf --min-votes 3 | ||
``` | ||
### Create senders | ||
``` | ||
cargo run create-sender --reward-manager 4P2WtU2RayKhRc1pfjJP5M9JmVVWZQi91za2ugJvHumG --eth-sender-address 0xd63cF911A8F8991cA8eFa9De7cCA3d1d370ec60C --eth-operator-address 0xf3a628104B0124b82E3c956Efd6271595E1407e0 && \ | ||
cargo run create-sender --reward-manager 4P2WtU2RayKhRc1pfjJP5M9JmVVWZQi91za2ugJvHumG --eth-sender-address 0xdD4B7F49d6392b53b5f1a43Ba4FbFd4617E5016E --eth-operator-address 0xF0BA54Ca13cD89e62Ec2a6B908388A7Ab6C44Ab9 && \ | ||
cargo run create-sender --reward-manager 4P2WtU2RayKhRc1pfjJP5M9JmVVWZQi91za2ugJvHumG --eth-sender-address 0x5AB13DCAF366D582FA72322A485BCbc410a8C1e7 --eth-operator-address 0x808a8d9B6D9b28FF0b9b2cfe3fEC47655bEd4463 && \ | ||
cargo run create-sender --reward-manager 4P2WtU2RayKhRc1pfjJP5M9JmVVWZQi91za2ugJvHumG --eth-sender-address 0x3cc097d8552B555d93aD9a0f07c1D9922dfa2d70 --eth-operator-address 0x2892e8b9adCd2538e31bF692dB98facfC112178c | ||
``` | ||
### Creating bot message | ||
``` | ||
cargo run verify-transfer-signature --reward-manager 4P2WtU2RayKhRc1pfjJP5M9JmVVWZQi91za2ugJvHumG --keypair locnet_verify_keypair.json --address 464fNyy1Pc7ovcsmGJynLWU4dxyT7GfyXXhuvrRJSbUB --secret f11081e12549e5f7faddfee0313fb44077fb4a9723a912bbb9fd8a04591d45f0 --transfer-id abc123 --recipient 0xaDf719618118224508c1fC1ef36ca45234B354E6 --amount 0.5 | ||
``` | ||
### Creating sender messages | ||
``` | ||
cargo run verify-transfer-signature --reward-manager 4P2WtU2RayKhRc1pfjJP5M9JmVVWZQi91za2ugJvHumG --pubkey CH3iDZ9jB7T7bXUR2d6u969JV9p9s7BVcAV3baKVaCM8 --address HhiAcsMvXbrxgSMDRQqKFtNgqT3LVEFNgsrQchwJz7tS --secret 9b4f73069739bc1d3f8e5ac54ff814dbad791c04a00762d559bf508d7cb8903b --transfer-id abc123 --recipient 0xaDf719618118224508c1fC1ef36ca45234B354E6 --amount 0.5 --bot-oracle 464fNyy1Pc7ovcsmGJynLWU4dxyT7GfyXXhuvrRJSbUB && \ | ||
cargo run verify-transfer-signature --reward-manager 4P2WtU2RayKhRc1pfjJP5M9JmVVWZQi91za2ugJvHumG --pubkey CH3iDZ9jB7T7bXUR2d6u969JV9p9s7BVcAV3baKVaCM8 --address CpWrZv62RFkAH5s9EvWYiNhVnhYxBZHrCQ6TM29hA5NM --secret df41e24a223c51dcaaa28199473fff3c7eabf6e7150b9e242c078f5772a36bf8 --transfer-id abc123 --recipient 0xaDf719618118224508c1fC1ef36ca45234B354E6 --amount 0.5 --bot-oracle 464fNyy1Pc7ovcsmGJynLWU4dxyT7GfyXXhuvrRJSbUB && \ | ||
cargo run verify-transfer-signature --reward-manager 4P2WtU2RayKhRc1pfjJP5M9JmVVWZQi91za2ugJvHumG --pubkey CH3iDZ9jB7T7bXUR2d6u969JV9p9s7BVcAV3baKVaCM8 --address FmDEPVLbmCPMLzhkwivsg2r3aGeWJWjaaBht3Ymd8Hhd --secret 5a8cb969f93f541bbe3ed34dfcc4a74cb13a9a07ad4b23be29d266edae12afa0 --transfer-id abc123 --recipient 0xaDf719618118224508c1fC1ef36ca45234B354E6 --amount 0.5 --bot-oracle 464fNyy1Pc7ovcsmGJynLWU4dxyT7GfyXXhuvrRJSbUB | ||
``` | ||
### Mint | ||
``` | ||
spl-token mint CV3A2AbeKc4CoRRcyWwe96LkPktpaPnUAgnzqJVy6wKf 100000000 7EtBB4PYBvvRvRDXXXfEEYrJNkU47m1o8B7XNw6Sw5dP | ||
``` | ||
### Complete transfer | ||
``` | ||
cargo run transfer --reward-manager 4P2WtU2RayKhRc1pfjJP5M9JmVVWZQi91za2ugJvHumG --verified-messages CH3iDZ9jB7T7bXUR2d6u969JV9p9s7BVcAV3baKVaCM8 --transfer-id abc123 --recipient 0xaDf719618118224508c1fC1ef36ca45234B354E6 --amount 0.5 --bot-oracle 464fNyy1Pc7ovcsmGJynLWU4dxyT7GfyXXhuvrRJSbUB | ||
``` |
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,32 @@ | ||
[package] | ||
name = "audius-cli" | ||
version = "0.1.0" | ||
edition = "2018" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
clap = "2.33.3" | ||
serde_json = "1.0.61" | ||
solana-account-decoder = "1.7.3" | ||
solana-clap-utils = "1.7.3" | ||
solana-cli-config = "1.7.3" | ||
solana-client = "1.7.3" | ||
solana-logger = "1.7.3" | ||
solana-sdk = "1.7.3" | ||
solana-program = "1.7.3" | ||
borsh = "0.8.2" | ||
regex = "1.5.4" | ||
bincode = "1.3.1" | ||
serde = "1.0.55" | ||
csv = "1.1.6" | ||
hex = "0.4.3" | ||
sha3 = "0.9.1" | ||
libsecp256k1 = "0.5.0" | ||
audius-reward-manager = { path="../program", features = [ "no-entrypoint" ] } | ||
spl-token = { git = "https://github.com/solana-labs/solana-program-library.git", features = [ "no-entrypoint" ] } | ||
claimable-tokens = { path = "../../claimable-tokens/program", features = [ "no-entrypoint" ] } | ||
|
||
[[bin]] | ||
name = "audius-cli" | ||
path = "src/main.rs" |
Oops, something went wrong.