-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
164 additions
and
301 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# for deployment | ||
MNEMONIC= | ||
# for verification | ||
CELOSCAN_KEY= |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,28 @@ | ||
import hre, { ethers } from 'hardhat'; | ||
import fetch from 'node-fetch'; | ||
const main = async () => { | ||
const contract = await hre.deployments.get('DirectPaymentsFactory'); | ||
const poolImpl = await hre.deployments.get('DirectPaymentsPool'); | ||
const factory = await ethers.getContractAt('DirectPaymentsFactory', contract.address); | ||
|
||
//verify beacon which is internal to the factory | ||
const beacon = await factory.impl(); | ||
const verifyBecon = hre.run('verify', { | ||
address: beacon, | ||
constructorArgsParams: [poolImpl.address], | ||
contract: '@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol:UpgradeableBeacon', | ||
}); | ||
await Promise.all([verifyBecon, hre.run('sourcify'), hre.run('etherscan-verify')]); | ||
|
||
//copy beacon to sourcify | ||
const res = await fetch('https://sourcify.dev/server/session/verify/etherscan', { | ||
method: 'POST', | ||
body: JSON.stringify({ address: beacon, chainId: String(hre.network.config.chainId) }), | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
}); | ||
console.log('sourcify beacon copy result', res.statusText); | ||
}; | ||
|
||
main().catch((e) => console.log(e)); |
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 |
---|---|---|
@@ -1 +1,4 @@ | ||
# nft.storage key for createpool.ts script/tests | ||
VITE_NFTSTORAGE_KEY= | ||
# private key for running createPool.ts script | ||
PRIVATE_KEY= |
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,36 @@ | ||
// Run with npx ts-node --esm | ||
import * as ethers from 'ethers'; | ||
import { GoodCollectiveSDK } from '../src/goodcollective/goodcollective'; | ||
|
||
// const provider = new ethers.providers.JsonRpcProvider('https://alfajores-forno.celo-testnet.org'); | ||
const provider = new ethers.providers.JsonRpcProvider('https://forno.celo.org'); | ||
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY || '').connect(provider); | ||
const sdk = new GoodCollectiveSDK('42220', provider, { nftStorageKey: process.env.VITE_NFTSTORAGE_KEY }); | ||
|
||
const main = async () => { | ||
const projectId = 'your project id'; | ||
const poolAttributes = { | ||
name: 'pool name', | ||
description: 'pool description', | ||
email: 'contact@email.com', | ||
twitter: '@handle', | ||
}; | ||
const poolSettings = { | ||
validEvents: [1, 2], | ||
rewardPerEvent: [ethers.constants.WeiPerEther, ethers.constants.WeiPerEther.mul(2)], | ||
manager: wallet.address, | ||
membersValidator: ethers.constants.AddressZero, | ||
uniquenessValidator: ethers.constants.AddressZero, | ||
rewardToken: '0x03d3daB843e6c03b3d271eff9178e6A96c28D25f', | ||
}; | ||
|
||
const poolLimits = { | ||
maxTotalPerMonth: ethers.constants.WeiPerEther.mul(1000), | ||
maxMemberPerMonth: ethers.constants.WeiPerEther.mul(10), | ||
maxMemberPerDay: ethers.constants.WeiPerEther.mul(5), | ||
}; | ||
const pool = await sdk.createPoolWithAttributes(wallet, projectId, poolAttributes, poolSettings, poolLimits); | ||
console.log(pool.address); | ||
}; | ||
|
||
main(); |
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
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 |
---|---|---|
|
@@ -23,4 +23,4 @@ | |
"installConfig": { | ||
"hoistingLimits": "workspaces" | ||
} | ||
} | ||
} |
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