Skip to content

Commit

Permalink
Merge branch 'master' into semi-async-event-creation
Browse files Browse the repository at this point in the history
  • Loading branch information
0xTxbi authored Jan 22, 2025
2 parents 0f5d3f6 + 00979b3 commit d7b9d7d
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 70 deletions.
53 changes: 53 additions & 0 deletions governance/proposals/up/006-gamma-incentives-round-2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* Gamma Incentives Round 2
*/
const { ethers } = require('hardhat')

const rewarderAddress = '0xC168131217226cb863D620C0a575b84F7dFfB986'
const upTokenAddress = '0xaC27fa800955849d6D17cC8952Ba9dD6EAA66187'

const rewarderInterface = new ethers.Interface([
'function notifyRewardAmount(address, uint256)',
'function setRewardsDuration(address, uint256)',
])

const erc20Interface = new ethers.Interface([
'function approve(address spender, uint256 amount)',
])

const INCENTIVE_UP_AMOUNT = ethers.parseEther('2222222', 18) // 2,222,222 UP
const INCENTIVE_DURATION = 8 * 7 * 24 * 60 * 60 // 8 weeks in seconds

module.exports = async () => {
const calls = [
{
contractAddress: upTokenAddress,
calldata: erc20Interface.encodeFunctionData('approve', [
rewarderAddress,
INCENTIVE_UP_AMOUNT,
]),
},
{
contractAddress: rewarderAddress,
calldata: rewarderInterface.encodeFunctionData('setRewardsDuration', [
upTokenAddress,
INCENTIVE_DURATION,
]),
},
{
contractAddress: rewarderAddress,
calldata: rewarderInterface.encodeFunctionData('notifyRewardAmount', [
upTokenAddress,
INCENTIVE_UP_AMOUNT,
]),
},
]

const proposalName =
'LP Incentives Round 2\n\nThe goal of this proposal is to sustain the existing UP/ETH liquidity until more protocol-owned liquidity can be deployed.\n\n## Details\n\n- Uniswap UP/WETH Pool: https://app.uniswap.org/explore/pools/base/0x9EF81F4E2F2f15Ff1c0C3f8c9ECc636580025242\n- Gamma wide position: https://app.gamma.xyz/vault/uni/base/details/weth-up-3000-wide\n- Using an initial price of UP of $0.0072\n- Total 2,222,222 UP (0.22% of supply) for a two month period\n- Incentives will begin immediately upon execution of this proposal \n\n## Discussion\n\n- Discussion: See \\"DEX selection\\" thread in Discord\n\n## Smart Contract execution\n\nSteps:\n\n1. Approve the rewarder contract to spend 2,222,222 UP. \\`\\"approve(address,uint256)\\" 0xc168131217226cb863d620c0a575b84f7dffb986 2222222000000000000000000\\`\n2. Set the reward time to 8 weeks (in seconds). \\`\\"setRewardsDuration(address, uint256)\\" 0xaC27fa800955849d6D17cC8952Ba9dD6EAA66187 4838400\\`\n3. Call notifyRewardAmount to start incentives. \\`\\"notifyRewardAmount(address, uint256)\\" 0xaC27fa800955849d6D17cC8952Ba9dD6EAA66187 2222222000000000000000000\\`'

return {
proposalName,
calls,
}
}
2 changes: 1 addition & 1 deletion packages/crypto-icon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"tsup": "8.3.5",
"tsx": "4.19.2",
"typescript": "5.7.2",
"vite": "6.0.6",
"vite": "6.0.9",
"vite-plugin-svgr": "4.3.0",
"vite-tsconfig-paths": "4.3.2"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/paywall/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"eslint": "9.17.0",
"tsup": "8.3.5",
"typescript": "5.7.2",
"vite": "6.0.6",
"vite": "6.0.9",
"vite-plugin-css-injected-by-js": "3.5.2",
"vite-plugin-node-polyfills": "0.22.0",
"vitest": "2.1.8",
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"tsx": "4.19.2",
"typescript": "5.7.2",
"url-loader": "4.1.1",
"vite": "6.0.6",
"vite": "6.0.9",
"vite-plugin-node-polyfills": "0.22.0",
"vite-plugin-svgr": "4.3.0",
"vite-tsconfig-paths": "4.3.2"
Expand Down
1 change: 0 additions & 1 deletion packages/unlock-js/examples/subgraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ async function main() {
networks: [1, 5],
}
)
console.log(locks)

const keys = await service.locks(
{
Expand Down
119 changes: 62 additions & 57 deletions packages/unlock-js/src/subgraph/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,24 @@ export class SubgraphService {
const networks =
options?.networks?.map((item) => this.networks[item]) ||
Object.values(this.networks).filter((item) => item.id !== 31337)
const items = await Promise.all(
networks.map(async (config) => {
try {
const sdk = this.createSdk(config.id)
const results = await sdk.allLocks(variables)
return results.locks.map((item) => ({

const items = []
for (let i = 0; i < networks.length; i++) {
const network = networks[i]
try {
const sdk = this.createSdk(network.id)
const results = await sdk.allLocks(variables)
items.push(
...results.locks.map((item) => ({
...item,
network: config.id,
network: network.id,
}))
} catch (error) {
console.error(error)
return []
}
})
)
return items.flat()
)
} catch (error) {
console.error(error)
}
}
return items
}

/**
Expand All @@ -94,22 +96,24 @@ export class SubgraphService {
const networks =
options?.networks?.map((item) => this.networks[item]) ||
Object.values(this.networks).filter((item) => item.id !== 31337)
const items = await Promise.all(
networks.map(async (config) => {
try {
const sdk = this.createSdk(config.id)
const results = await sdk.allLocksWithKeys(variables)
return results.locks.map((item) => ({

const items = []
for (let i = 0; i < networks.length; i++) {
const network = networks[i]
try {
const sdk = this.createSdk(network.id)
const results = await sdk.allLocksWithKeys(variables)
items.push(
...results.locks.map((item) => ({
...item,
network: config.id,
network: network.id,
}))
} catch (error) {
console.error(error)
return []
}
})
)
return items.flat()
)
} catch (error) {
console.error(error)
}
}
return items
}

/**
Expand Down Expand Up @@ -139,23 +143,23 @@ export class SubgraphService {
options?.networks?.map((item) => this.networks[item]) ||
Object.values(this.networks).filter((item) => item.id !== 31337)

const items = await Promise.all(
networks.map(async (config) => {
try {
const sdk = this.createSdk(config.id)
const results = await sdk.AllKeys(variables)
return results.keys.map((item) => ({
const items = []
for (let i = 0; i < networks.length; i++) {
const network = networks[i]
try {
const sdk = this.createSdk(network.id)
const results = await sdk.AllKeys(variables)
items.push(
...results.keys.map((item) => ({
...item,
network: config.id,
network: network.id,
}))
} catch (error) {
console.error(error)
return []
}
})
)

return items.flat()
)
} catch (error) {
console.error(error)
}
}
return items
}

/**
Expand All @@ -175,22 +179,23 @@ export class SubgraphService {
options?.networks?.map((item) => this.networks[item]) ||
Object.values(this.networks).filter((item) => item.id !== 31337)

const items = await Promise.all(
networks.map(async (config) => {
try {
const sdk = this.createSdk(config.id)
const results = await sdk.AllReceipts(variables)
return results.receipts.map((item) => ({
const items = []
for (let i = 0; i < networks.length; i++) {
const network = networks[i]
try {
const sdk = this.createSdk(network.id)
const results = await sdk.AllReceipts(variables)
items.push(
...results.receipts.map((item) => ({
...item,
network: config.id,
network: network.id,
}))
} catch (error) {
console.error(error)
return []
}
})
)
return items.flat()
)
} catch (error) {
console.error(error)
}
}
return items
}

/** Get a single receipt for a specific network */
Expand Down
2 changes: 1 addition & 1 deletion paywall-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"eslint": "9.17.0",
"prettier": "3.4.2",
"typescript": "5.7.2",
"vite": "6.0.6"
"vite": "6.0.9"
},
"browserslist": [
"defaults",
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18725,7 +18725,7 @@ __metadata:
tsup: "npm:8.3.5"
tsx: "npm:4.19.2"
typescript: "npm:5.7.2"
vite: "npm:6.0.6"
vite: "npm:6.0.9"
vite-plugin-svgr: "npm:4.3.0"
vite-tsconfig-paths: "npm:4.3.2"
peerDependencies:
Expand Down Expand Up @@ -19017,7 +19017,7 @@ __metadata:
next: "npm:14.2.21"
prettier: "npm:3.4.2"
typescript: "npm:5.7.2"
vite: "npm:6.0.6"
vite: "npm:6.0.9"
vite-plugin-node-polyfills: "npm:0.22.0"
languageName: unknown
linkType: soft
Expand All @@ -19035,7 +19035,7 @@ __metadata:
postmate: "npm:1.5.2"
tsup: "npm:8.3.5"
typescript: "npm:5.7.2"
vite: "npm:6.0.6"
vite: "npm:6.0.9"
vite-plugin-css-injected-by-js: "npm:3.5.2"
vite-plugin-node-polyfills: "npm:0.22.0"
vitest: "npm:2.1.8"
Expand Down Expand Up @@ -19158,7 +19158,7 @@ __metadata:
tsx: "npm:4.19.2"
typescript: "npm:5.7.2"
url-loader: "npm:4.1.1"
vite: "npm:6.0.6"
vite: "npm:6.0.9"
vite-plugin-node-polyfills: "npm:0.22.0"
vite-plugin-svgr: "npm:4.3.0"
vite-tsconfig-paths: "npm:4.3.2"
Expand Down Expand Up @@ -52747,9 +52747,9 @@ __metadata:
languageName: node
linkType: hard

"vite@npm:6.0.6":
version: 6.0.6
resolution: "vite@npm:6.0.6"
"vite@npm:6.0.9":
version: 6.0.9
resolution: "vite@npm:6.0.9"
dependencies:
esbuild: "npm:^0.24.2"
fsevents: "npm:~2.3.3"
Expand Down Expand Up @@ -52795,7 +52795,7 @@ __metadata:
optional: true
bin:
vite: bin/vite.js
checksum: 10/c37edc18d3dccddcab7da333dacfcb5550db436eec0f89ffb14691dbb0e821b1319cc48f111e364ea4f68f0916bc84fc80cd21772a022681870b479133d3c95c
checksum: 10/6f4f27c602f997537df26cc9665763b402f5978a7381146f6c0b146888ee257484a7f140df79e495b922082ca608bd1f563b0be9e272d22c689aad2b1e1da440
languageName: node
linkType: hard

Expand Down

0 comments on commit d7b9d7d

Please sign in to comment.