Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.

Commit 115ca7a

Browse files
authored
feat(eden-online): add configurable voting weight for niji ai agents (#1779)
* feat(eden-online): add configurable voting weight for niji ai agents * feat(eden-online): lint
1 parent 19afafd commit 115ca7a

4 files changed

Lines changed: 13 additions & 6 deletions

File tree

src/strategies/eden-online-override/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Niji Warriors are NFTs that can vote on behalf of their owner. Each NFT has its own private key.
44

55
At any time, Niji Warrior NFTs can vote on edenonline.eth Snapshot Proposals.
6-
The Niji Warrior's voting power equals 1 per default.
6+
The Niji Warrior's voting power equals `votingWeight` as defined in the strategy parameters (usually 0.1 to 1).
77

88
When voting directly on Snapshot, the player's vote overrides the Niji Warrior's vote.
99
The player's voting power is the square root of the sum of NFTs owned by the player.

src/strategies/eden-online-override/examples.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"symbol": "UBINIJI",
88
"address": "0x66efaf92df6456c3cb810012b2de3fb223c25d0d",
99
"decimals": 0,
10-
"addressUrl": "https://maroon-absent-panther-103.mypinata.cloud/ipfs/bafybeicd55sbss2vnxpqaicg7dqmlyjbkqpscqy357idinpyhwgvh53jii"
10+
"addressUrl": "https://ipfs.io/ipfs/bafybeicd55sbss2vnxpqaicg7dqmlyjbkqpscqy357idinpyhwgvh53jii",
11+
"votingWeight": 1
1112
}
1213
},
1314
"network": "42161",

src/strategies/eden-online-override/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export async function strategy(
3232
snapshot
3333
) {
3434
const addressUrl = options.addressUrl;
35+
const votingWeight = options.votingWeight;
3536
const blockTag = typeof snapshot === 'number' ? snapshot : 'latest';
3637

3738
// Fetch Niji Agent EOA addresses
@@ -107,10 +108,10 @@ export async function strategy(
107108
}
108109
} else {
109110
// This is a Niji Warrior agent address, find its tokenId to find its owner
110-
// If the owner has already voted, agent gets 0; else 1
111+
// If the owner has already voted, agent gets 0; else `votingWeight`
111112
const nijiId = eoaToNijiId[address];
112113
const owner = tokenOwners[nijiId];
113-
results[address] = owner && addressesSet.has(owner) ? 0 : 1;
114+
results[address] = owner && addressesSet.has(owner) ? 0 : votingWeight;
114115
}
115116
}
116117

src/strategies/eden-online-override/schema.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,16 @@
2929
"type": "string",
3030
"title": "URL of the document to fetch from IPFS",
3131
"examples": [
32-
"e.g. https://maroon-absent-panther-103.mypinata.cloud/ipfs/bafybeiellha74vduonid7k5qlrgyh5tnm4baauxggtynizarj426i537mm"
32+
"e.g. https://ipfs.io/ipfs/bafybeicd55sbss2vnxpqaicg7dqmlyjbkqpscqy357idinpyhwgvh53jii"
3333
]
34+
},
35+
"votingWeight": {
36+
"type": "number",
37+
"title": "Niji Voting Weight",
38+
"examples": ["e.g. 1"]
3439
}
3540
},
36-
"required": ["address", "decimals", "addressUrl"],
41+
"required": ["address", "decimals", "addressUrl", "votingWeight"],
3742
"additionalProperties": false
3843
}
3944
}

0 commit comments

Comments
 (0)