From d7860abc1be1562e1fac1009fbcad1771c2f41f0 Mon Sep 17 00:00:00 2001 From: SpaceFi <82010251+SpaceFinance@users.noreply.github.com> Date: Tue, 23 Jan 2024 12:07:31 +0800 Subject: [PATCH 1/8] Add SpaceFi blp --- src/strategies/spacefi-blp/index.ts | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/strategies/spacefi-blp/index.ts diff --git a/src/strategies/spacefi-blp/index.ts b/src/strategies/spacefi-blp/index.ts new file mode 100644 index 000000000..12f853950 --- /dev/null +++ b/src/strategies/spacefi-blp/index.ts @@ -0,0 +1,36 @@ +import { BigNumberish } from '@ethersproject/bignumber'; +import { formatUnits } from '@ethersproject/units'; +import { Multicaller } from '../../utils'; + +export const author = 'icepoint'; +export const version = '0.1.1'; + +const abi = [ + 'function userInfo(address account) external view returns (uint256,uint256,uint256)' +]; + +export async function strategy( + space, + network, + provider, + addresses, + options, + snapshot +) { + const blockTag = typeof snapshot === 'number' ? snapshot : 'latest'; + const { blpAddress, decimals } = options; + + const multi = new Multicaller(network, provider, abi, { blockTag }); + addresses.forEach((address) => + multi.call(address, blpAddress, 'userInfo', [address]) + ); + const result: Record = await multi.execute(); + + return Object.fromEntries( + Object.entries(result).map(([address, blp]) => [ + address, + (Number(formatUnits(blp[0], decimals)) + + Number(formatUnits(blp[2], decimals))) + ]) + ); +} From 2d4e3bb7d48de9e2fb2647e9411293af03a31909 Mon Sep 17 00:00:00 2001 From: SpaceFi <82010251+SpaceFinance@users.noreply.github.com> Date: Tue, 23 Jan 2024 12:09:30 +0800 Subject: [PATCH 2/8] Add files via upload --- src/strategies/spacefi-blp/examples.json | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/strategies/spacefi-blp/examples.json diff --git a/src/strategies/spacefi-blp/examples.json b/src/strategies/spacefi-blp/examples.json new file mode 100644 index 000000000..0b92e51a8 --- /dev/null +++ b/src/strategies/spacefi-blp/examples.json @@ -0,0 +1,25 @@ +[ + { + "name": "Example query", + "strategy": { + "name": "spacefi-blp", + "params": { + "address": "0x67B6c6E67F8f2CD1948ECD02221D141CBa3A4984", + "symbol": "blp", + "decimals": 18 + } + }, + "network": "324", + "addresses": [ + "0x8633500EF5c41CE955B4958AD5e61ca58A2B3cB6", + "0xAc2fbBC12cEe75158C38c5Ca34EfBb6343aFdcB3", + "0xb4B72F3843154B37580721ba9233fE86Da6e0416", + "0x89023d1284F565aF9Ad115ACDb2F512d35024723", + "0xEeC60E6a0Ca0F80Fa16e0E2267Ff4C2c1A46a447", + "0xfC87549072F3217140E7046d88D3873C8bF3B014", + "0xb6cE6Dd21598f24E840Bf2D43D8d4a1d57faEf4E", + "0x524E2631ceBFce2aF66FAcDBB160aC94A00751B3" + ], + "snapshot": 24739965 + } +] From 3b8bc21ee137583843d344347433b39dec0eed84 Mon Sep 17 00:00:00 2001 From: SpaceFi <82010251+SpaceFinance@users.noreply.github.com> Date: Tue, 23 Jan 2024 13:36:04 +0800 Subject: [PATCH 3/8] Add files via upload --- src/strategies/spacefi-blp/README.md | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/strategies/spacefi-blp/README.md diff --git a/src/strategies/spacefi-blp/README.md b/src/strategies/spacefi-blp/README.md new file mode 100644 index 000000000..aa032533d --- /dev/null +++ b/src/strategies/spacefi-blp/README.md @@ -0,0 +1,33 @@ +# spacefi-blp + +This strategy returns the assets of nft and xspace in spacefi, including staking and in the market + +Here is an example of parameters: + +```json +[ + { + "name": "Example query", + "strategy": { + "name": "spacefi-blp", + "params": { + "address": "0x67B6c6E67F8f2CD1948ECD02221D141CBa3A4984", + "symbol": "blp", + "decimals": 18 + } + }, + "network": "324", + "addresses": [ + "0x8633500EF5c41CE955B4958AD5e61ca58A2B3cB6", + "0xAc2fbBC12cEe75158C38c5Ca34EfBb6343aFdcB3", + "0xb4B72F3843154B37580721ba9233fE86Da6e0416", + "0x89023d1284F565aF9Ad115ACDb2F512d35024723", + "0xEeC60E6a0Ca0F80Fa16e0E2267Ff4C2c1A46a447", + "0xfC87549072F3217140E7046d88D3873C8bF3B014", + "0xb6cE6Dd21598f24E840Bf2D43D8d4a1d57faEf4E", + "0x524E2631ceBFce2aF66FAcDBB160aC94A00751B3" + ], + "snapshot": 24739965 + } +] +``` From facab50b4fc3d1ee176c14ac9b38a18255b1e8b0 Mon Sep 17 00:00:00 2001 From: SpaceFi <82010251+SpaceFinance@users.noreply.github.com> Date: Wed, 24 Jan 2024 09:56:43 +0800 Subject: [PATCH 4/8] Update src/strategies/spacefi-blp/index.ts Co-authored-by: Chaitanya --- src/strategies/spacefi-blp/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/strategies/spacefi-blp/index.ts b/src/strategies/spacefi-blp/index.ts index 12f853950..b8d45f6c8 100644 --- a/src/strategies/spacefi-blp/index.ts +++ b/src/strategies/spacefi-blp/index.ts @@ -3,7 +3,7 @@ import { formatUnits } from '@ethersproject/units'; import { Multicaller } from '../../utils'; export const author = 'icepoint'; -export const version = '0.1.1'; +export const version = '0.1.0'; const abi = [ 'function userInfo(address account) external view returns (uint256,uint256,uint256)' From 99697ba5fb6b000ea11aacfa679f80b528fbbe74 Mon Sep 17 00:00:00 2001 From: SpaceFi <82010251+SpaceFinance@users.noreply.github.com> Date: Wed, 24 Jan 2024 09:57:19 +0800 Subject: [PATCH 5/8] Update src/strategies/spacefi-blp/index.ts Co-authored-by: Chaitanya --- src/strategies/spacefi-blp/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/strategies/spacefi-blp/index.ts b/src/strategies/spacefi-blp/index.ts index b8d45f6c8..f081f2008 100644 --- a/src/strategies/spacefi-blp/index.ts +++ b/src/strategies/spacefi-blp/index.ts @@ -2,7 +2,7 @@ import { BigNumberish } from '@ethersproject/bignumber'; import { formatUnits } from '@ethersproject/units'; import { Multicaller } from '../../utils'; -export const author = 'icepoint'; +export const author = 'SpaceFinance'; export const version = '0.1.0'; const abi = [ From 193978c40be73f6ee686c71268ad0abeab41f72f Mon Sep 17 00:00:00 2001 From: SpaceFi <82010251+SpaceFinance@users.noreply.github.com> Date: Wed, 24 Jan 2024 18:22:12 +0800 Subject: [PATCH 6/8] Update index.ts --- src/strategies/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/strategies/index.ts b/src/strategies/index.ts index 0c5e62541..6759234d2 100644 --- a/src/strategies/index.ts +++ b/src/strategies/index.ts @@ -243,6 +243,7 @@ import * as erc1155weighted from './erc1155-weighted-by-id'; import * as stakersAndHolders from './stakers-and-holders'; import * as banksyDao from './banksy-dao'; import * as spacey2025 from './spacey2025'; +import * as spacefiBlp from './spacefi-blp'; import * as sandmanDao from './sandman-dao'; import * as veBalanceOfAt from './ve-balance-of-at'; import * as veRibbon from './ve-ribbon'; @@ -663,6 +664,7 @@ const strategies = { 'stakers-and-holders': stakersAndHolders, 'banksy-dao': banksyDao, spacey2025: spacey2025, + 'spacefi-blp': spacefiBlp, 'sandman-dao': sandmanDao, 've-balance-of-at': veBalanceOfAt, 've-ribbon': veRibbon, From 6331bfa086a16a9a506b5a3648ef4eb8778cd196 Mon Sep 17 00:00:00 2001 From: SpaceFi <82010251+SpaceFinance@users.noreply.github.com> Date: Thu, 25 Jan 2024 15:46:29 +0800 Subject: [PATCH 7/8] Update examples.json --- src/strategies/spacefi-blp/examples.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/strategies/spacefi-blp/examples.json b/src/strategies/spacefi-blp/examples.json index 0b92e51a8..083f3ec61 100644 --- a/src/strategies/spacefi-blp/examples.json +++ b/src/strategies/spacefi-blp/examples.json @@ -4,7 +4,7 @@ "strategy": { "name": "spacefi-blp", "params": { - "address": "0x67B6c6E67F8f2CD1948ECD02221D141CBa3A4984", + "blpAddress": "0x67B6c6E67F8f2CD1948ECD02221D141CBa3A4984", "symbol": "blp", "decimals": 18 } From 35de67d8c7d793989c23caf841cf2d9b3da427ec Mon Sep 17 00:00:00 2001 From: SpaceFi <82010251+SpaceFinance@users.noreply.github.com> Date: Thu, 25 Jan 2024 15:46:48 +0800 Subject: [PATCH 8/8] Update README.md --- src/strategies/spacefi-blp/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/strategies/spacefi-blp/README.md b/src/strategies/spacefi-blp/README.md index aa032533d..d55676fbf 100644 --- a/src/strategies/spacefi-blp/README.md +++ b/src/strategies/spacefi-blp/README.md @@ -11,7 +11,7 @@ Here is an example of parameters: "strategy": { "name": "spacefi-blp", "params": { - "address": "0x67B6c6E67F8f2CD1948ECD02221D141CBa3A4984", + "blpAddress": "0x67B6c6E67F8f2CD1948ECD02221D141CBa3A4984", "symbol": "blp", "decimals": 18 }