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

[sablier-v1-deposit] refactor: rename Sablier V1 strategy #1240

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
35 changes: 0 additions & 35 deletions src/strategies/deposit-in-sablier-stream/examples.json

This file was deleted.

4 changes: 2 additions & 2 deletions src/strategies/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,6 @@ import * as safeVested from './safe-vested';
import * as riskharborUnderwriter from './riskharbor-underwriter';
import * as otterspaceBadges from './otterspace-badges';
import * as syntheticNounsClaimerOwner from './synthetic-nouns-with-claimer';
import * as depositInSablierStream from './deposit-in-sablier-stream';
import * as echelonWalletPrimeAndCachedKey from './echelon-wallet-prime-and-cached-key';
import * as nation3VotesWIthDelegations from './nation3-votes-with-delegations';
import * as nation3CoopPassportWithDelegations from './nation3-passport-coop-with-delegations';
Expand Down Expand Up @@ -452,6 +451,7 @@ import * as hatsProtocolSingleVotePerOrg from './hats-protocol-single-vote-per-o
import * as karmaDiscordRoles from './karma-discord-roles';
import * as seedifyHoldStakingFarming from './seedify-cumulative-voting-power-hodl-staking-farming';
import * as stakedMoreKudasai from './staked-morekudasai';
import * as sablierV1Deposit from './sablier-v1-deposit';
import * as sablierV2 from './sablier-v2';
import * as gelatoStaking from './gelato-staking';
import * as erc4626AssetsOf from './erc4626-assets-of';
Expand Down Expand Up @@ -865,7 +865,6 @@ const strategies = {
'riskharbor-underwriter': riskharborUnderwriter,
'otterspace-badges': otterspaceBadges,
'synthetic-nouns-with-claimer': syntheticNounsClaimerOwner,
'deposit-in-sablier-stream': depositInSablierStream,
'echelon-wallet-prime-and-cached-key': echelonWalletPrimeAndCachedKey,
'nation3-votes-with-delegations': nation3VotesWIthDelegations,
'nation3-passport-coop-with-delegations': nation3CoopPassportWithDelegations,
Expand Down Expand Up @@ -917,6 +916,7 @@ const strategies = {
'seedify-cumulative-voting-power-hodl-staking-farming':
seedifyHoldStakingFarming,
'staked-morekudasai': stakedMoreKudasai,
'sablier-v1-deposit': sablierV1Deposit,
'sablier-v2': sablierV2,
'gelato-staking': gelatoStaking,
'erc4626-assets-of': erc4626AssetsOf,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Deposit in Sablier Stream

This strategy returns the score for any voter as the sum of all deposits made by a sender towards the voters for a specific ERC20 token;
In Sablier V1, a stream creator locks up an amount of ERC-20 tokens in a contract that progressively allocates the funds to the designated
recipient. The tokens are released by the second, and the recipient can withdraw them at any time.

This strategy returns the score for any voter as the sum of all deposits made by a sender towards the voters for a specific ERC20 token.

Here is an example of parameters:

```JSON
```json
{
"sender": "0xC9F2D9adfa6C24ce0D5a999F2BA3c6b06E36F75E",
"token": "0x7f8F6E42C169B294A384F5667c303fd8Eedb3CF3"
Expand Down
36 changes: 36 additions & 0 deletions src/strategies/sablier-v1-deposit/examples.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[
{
"name": "Example query 0",
"strategy": {
"name": "sablier-v1-deposit",
"params": {
"sender": "0xcCe2CbDcD0eee72984c58A84678F0D49a95257ae",
"token": "0x97cb342Cf2F6EcF48c1285Fb8668f5a4237BF862"
}
},
"network": "5",
"addresses": [
"0x06255FA39EBD18796eCCCc17DB8153Ef58DBA0a8",
"0xf976aF93B0A5A9F55A7f285a3B5355B8575Eb5bc",
"0x5bCAc9fC8827231839c5861b719e0cAE57da3CfB"
],
"snapshot": 9515850
},
{
"name": "Example query 1",
"strategy": {
"name": "sablier-v1-deposit",
"params": {
"sender": "0xcCe2CbDcD0eee72984c58A84678F0D49a95257ae",
"token": "0x97cb342Cf2F6EcF48c1285Fb8668f5a4237BF862"
}
},
"network": "5",
"addresses": [
"0x06255FA39EBD18796eCCCc17DB8153Ef58DBA0a8",
"0xf976aF93B0A5A9F55A7f285a3B5355B8575Eb5bc",
"0x5bCAc9fC8827231839c5861b719e0cAE57da3CfB"
],
"snapshot": 9515900
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@ import { formatUnits } from '@ethersproject/units';
import { subgraphRequest } from '../../utils';

const SUBGRAPH_URL = {
'1': 'https://api.thegraph.com/subgraphs/name/sablierhq/sablier', // mainnet
'3': 'https://api.thegraph.com/subgraphs/name/sablierhq/sablier-ropsten', // ropsten
'4': 'https://api.thegraph.com/subgraphs/name/sablierhq/sablier-rinkeby', // rinkeby
'5': 'https://api.thegraph.com/subgraphs/name/sablierhq/sablier-goerli', // goerli
'10': 'https://api.thegraph.com/subgraphs/name/sablierhq/sablier-optimism', // optimism
'42': 'https://api.thegraph.com/subgraphs/name/sablierhq/sablier-kovan', // kovan
'56': 'https://api.thegraph.com/subgraphs/name/sablierhq/sablier-bsc', // bsc
'137': 'https://api.thegraph.com/subgraphs/name/sablierhq/sablier-matic', // polygon
'42161': 'https://api.thegraph.com/subgraphs/name/sablierhq/sablier-arbitrum', // arbitrum
'43114': 'https://api.thegraph.com/subgraphs/name/sablierhq/sablier-avalanche' // avalanche
'1': 'https://api.thegraph.com/subgraphs/name/sablier-labs/sablier', // mainnet
'3': 'https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-ropsten', // ropsten
'4': 'https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-rinkeby', // rinkeby
'5': 'https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-goerli', // goerli
'10': 'https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-optimism', // optimism
'42': 'https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-kovan', // kovan
'56': 'https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-bsc', // bsc
'137': 'https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-matic', // polygon
'42161':
'https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-arbitrum', // arbitrum
'43114':
'https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-avalanche' // avalanche
};

export const author = 'dan13ram';
export const author = 'sablier-labs';
export const version = '0.1.0';

export async function strategy(
Expand Down Expand Up @@ -48,10 +50,7 @@ export async function strategy(
// @ts-ignore
params.streams.__args.block = { number: snapshot };
}
const result = await subgraphRequest(
options.subGraphURL ? options.subGraphURL : SUBGRAPH_URL[network],
params
);
const result = await subgraphRequest(SUBGRAPH_URL[network], params);
const score = Object.fromEntries(
addresses.map((address) => [getAddress(address), 0])
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@
"pattern": "^0x[a-fA-F0-9]{40}$",
"minLength": 42,
"maxLength": 42
},
"subGraphURL": {
"type": "string",
"title": "Optional subgraph url",
"examples": ["e.g. 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984"]
}
},
"required": ["sender", "token"],
Expand Down
Loading