Skip to content

Commit

Permalink
add: production ubi pools
Browse files Browse the repository at this point in the history
  • Loading branch information
sirpy committed Oct 21, 2024
1 parent 5da4ecd commit 337092f
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 40 deletions.
3 changes: 2 additions & 1 deletion packages/contracts/contracts/UBI/UBIPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ contract UBIPool is AccessControlUpgradeable, GoodCollectiveSuperApp, UUPSUpgrad

error CLAIMFOR_DISABLED();
error NOT_MEMBER(address claimer);
error NOT_MANAGER(address manager);
error NOT_WHITELISTED(address whitelistedRoot);
error ALREADY_CLAIMED(address whitelistedRoot);
error INVALID_0_VALUE();
Expand Down Expand Up @@ -273,7 +274,7 @@ contract UBIPool is AccessControlUpgradeable, GoodCollectiveSuperApp, UUPSUpgrad
}
// if no members validator then if members only only manager can add members
else if (ubiSettings.onlyMembers && hasRole(MANAGER_ROLE, msg.sender) == false) {
revert NOT_MEMBER(member);
revert NOT_MANAGER(member);
}

_grantRole(MEMBER_ROLE, member);
Expand Down
14 changes: 14 additions & 0 deletions packages/contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,20 @@ const config: HardhatUserConfig = {
},
},
},
'production-celo': {
chainId: 42220,
url: `https://forno.celo.org`,
gasPrice: 5000000000,
accounts: {
mnemonic,
},
verify: {
etherscan: {
apiKey: process.env.CELOSCAN_KEY,
apiUrl: 'https://api.celoscan.io/',
},
},
},
'development-celo': {
chainId: 42220,
url: `https://forno.celo.org`,
Expand Down
105 changes: 67 additions & 38 deletions packages/sdk-js/scripts/createPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ const main = async () => {
if (process.argv[2] === 'ubi') {
return createUbiPool();
}
if (process.argv[2] === 'update') {
return updatePool('0xDd1c12f197E6D1E2FBA15487AaAE500eF6e07BCA');
}
return createPool();
// return updatePool('0x5dd23da6e1635928fa7f4fa2d8d8d623aa9c89ee');
};

const getMemberPools = async (address: string) => {
Expand Down Expand Up @@ -73,22 +75,44 @@ const createPool = async () => {
};

const updatePool = async (pool: string) => {
// const poolAttributes = {
// name: 'Test ipfs single donation with swap (Real G$)',
// description:
// 'This Collective directly supports smallholder farmers around Kenya’s Kakamega forest. These farmers are acting as nurseries, growing and nurturing native trees to maturity for subsequent reforestation. In partnership with Silvi.',
// email: '[email protected]',
// website: 'https://www.silvi.earth',
// twitter: 'https://twitter.com/SilviProtocol',
// instagram: 'https://instagram.com/x',
// threads: '',
// headerImage:
// 'https://uploads-ssl.webflow.com/639e611ba0716a170111fe96/65032c75ac7830faf70f9469_FooterBackground.jpg',
// logo: 'https://uploads-ssl.webflow.com/639e611ba0716a170111fe96/65032c4586b18e3e276db342_SilviLogo.png',
// images: [
// 'https://uploads-ssl.webflow.com/639e611ba0716a170111fe96/6507cb24ffa8a438ccf13d70_Screen%20Shot%202023-09-17%20at%208.59.00%20PM-p-500.png',
// 'https://uploads-ssl.webflow.com/639e611ba0716a170111fe96/650352d39dde89c0fd676908_RuralPlanting.jpg',
// ],
// };

const poolAttributes = {
name: 'Test ipfs single donation with swap (Real G$)',
name: 'Red Tent Women in Nigeria',
description:
'This Collective directly supports smallholder farmers around Kenya’s Kakamega forest. These farmers are acting as nurseries, growing and nurturing native trees to maturity for subsequent reforestation. In partnership with Silvi.',
email: '[email protected]',
website: 'https://www.silvi.earth',
twitter: 'https://twitter.com/SilviProtocol',
instagram: 'https://instagram.com/x',
threads: '',
headerImage:
'https://uploads-ssl.webflow.com/639e611ba0716a170111fe96/65032c75ac7830faf70f9469_FooterBackground.jpg',
logo: 'https://uploads-ssl.webflow.com/639e611ba0716a170111fe96/65032c4586b18e3e276db342_SilviLogo.png',
images: [
'https://uploads-ssl.webflow.com/639e611ba0716a170111fe96/6507cb24ffa8a438ccf13d70_Screen%20Shot%202023-09-17%20at%208.59.00%20PM-p-500.png',
'https://uploads-ssl.webflow.com/639e611ba0716a170111fe96/650352d39dde89c0fd676908_RuralPlanting.jpg',
],
'The Red Tent Women’s Basic Income is designed to flow money unencumbered and unconditionally from women and allies who have it to women who need it. Red Tent’s goal is to create a decentralized, automated and highly personalized system that measures and improves collaboration and wellbeing in communities. Women are the keepers of family and community, yet continue to be disproportionately affected by lack of access to capital and influence in all systems.',
rewardDescription: 'Up to 500 women in Nigeria may claim G$ every day ',
goodidDescription: 'Verified women from Nigeria',
// email: '',
website: 'https://redtent.io',
// twitter: '',
// instagram: '',
// twitter: 'https://twitter.com/SilviProtocol',
// instagram: 'https://instagram.com/x',
// threads: '',
headerImage: 'https://bafybeigo4ef4czy3rscoukfccgilzkzjchsr5cbhesz7sdc2komkqcibxu.ipfs.w3s.link/RedTent.tiny.png',
logo: 'https://bafybeigo4ef4czy3rscoukfccgilzkzjchsr5cbhesz7sdc2komkqcibxu.ipfs.w3s.link/RedTent.tiny.png',
// logo: 'https://uploads-ssl.webflow.com/639e611ba0716a170111fe96/65032c4586b18e3e276db342_SilviLogo.png',
// images: [
// 'https://uploads-ssl.webflow.com/639e611ba0716a170111fe96/6507cb24ffa8a438ccf13d70_Screen%20Shot%202023-09-17%20at%208.59.00%20PM-p-500.png',
// 'https://uploads-ssl.webflow.com/639e611ba0716a170111fe96/650352d39dde89c0fd676908_RuralPlanting.jpg',
// ],
};

const cid = await sdk.savePoolToIPFS(poolAttributes);
Expand All @@ -98,44 +122,49 @@ const updatePool = async (pool: string) => {
const res = await tx.wait();
console.log('updated pool', res);
};

const createUbiPool = async () => {
const projectId = 'testing';
const projectId = 'redtent';
const poolAttributes = {
name: 'Test subgraph events UBI Pool (Dev token)',
name: 'Red Tent Women in Nigeria',
description:
'This Collective directly supports smallholder farmers around Kenya’s Kakamega forest. These farmers are acting as nurseries, growing and nurturing native trees to maturity for subsequent reforestation. In partnership with Silvi.',
rewardDescription: 'Daily UBI',
goodidDescription: 'Verified women from kenya',
email: '[email protected]',
website: 'https://www.gooddollar.org',
twitter: 'https://twitter.com/SilviProtocol',
instagram: 'https://instagram.com/x',
threads: '',
headerImage:
'https://uploads-ssl.webflow.com/639e611ba0716a170111fe96/65032c75ac7830faf70f9469_FooterBackground.jpg',
logo: 'https://uploads-ssl.webflow.com/639e611ba0716a170111fe96/65032c4586b18e3e276db342_SilviLogo.png',
images: [
'https://uploads-ssl.webflow.com/639e611ba0716a170111fe96/6507cb24ffa8a438ccf13d70_Screen%20Shot%202023-09-17%20at%208.59.00%20PM-p-500.png',
'https://uploads-ssl.webflow.com/639e611ba0716a170111fe96/650352d39dde89c0fd676908_RuralPlanting.jpg',
],
'The Red Tent Women’s Basic Income is designed to flow money unencumbered and unconditionally from women and allies who have it to women who need it. Red Tent’s goal is to create a decentralized, automated and highly personalized system that measures and improves collaboration and wellbeing in communities. Women are the keepers of family and community, yet continue to be disproportionately affected by lack of access to capital and influence in all systems.',
rewardDescription: 'Up to 500 women in Nigeria may claim G$ every day ',
goodidDescription: 'Verified women from Nigeria',
// email: '',
website: 'https://redtent.io',
// twitter: '',
// instagram: '',
// twitter: 'https://twitter.com/SilviProtocol',
// instagram: 'https://instagram.com/x',
// threads: '',
headerImage: 'https://bafybeigo4ef4czy3rscoukfccgilzkzjchsr5cbhesz7sdc2komkqcibxu.ipfs.w3s.link/RedTent.tiny.png',
logo: 'https://bafybeigo4ef4czy3rscoukfccgilzkzjchsr5cbhesz7sdc2komkqcibxu.ipfs.w3s.link/RedTent.tiny.png',
// logo: 'https://uploads-ssl.webflow.com/639e611ba0716a170111fe96/65032c4586b18e3e276db342_SilviLogo.png',
// images: [
// 'https://uploads-ssl.webflow.com/639e611ba0716a170111fe96/6507cb24ffa8a438ccf13d70_Screen%20Shot%202023-09-17%20at%208.59.00%20PM-p-500.png',
// 'https://uploads-ssl.webflow.com/639e611ba0716a170111fe96/650352d39dde89c0fd676908_RuralPlanting.jpg',
// ],
};

const poolSettings: UBIPoolSettings = {
manager: wallet.address,
membersValidator: ethers.constants.AddressZero,
uniquenessValidator: '0xF25fA0D4896271228193E782831F6f3CFCcF169C',
rewardToken: '0xFa51eFDc0910CCdA91732e6806912Fa12e2FD475',
uniquenessValidator: '0xC361A6E67822a0EDc17D899227dd9FC50BD62F42',
// uniquenessValidator: '0xF25fA0D4896271228193E782831F6f3CFCcF169C',
// rewardToken: '0xFa51eFDc0910CCdA91732e6806912Fa12e2FD475',
rewardToken: '0x62B8B11039FcfE5aB0C56E502b1C372A3d2a9c7A',
// network === 'development-celo'
// ? '0xFa51eFDc0910CCdA91732e6806912Fa12e2FD475'
// : '0x62B8B11039FcfE5aB0C56E502b1C372A3d2a9c7A', //celo production token
};

const ubiSettings: UBISettings = {
cycleLengthDays: ethers.BigNumber.from(60),
cycleLengthDays: ethers.BigNumber.from(7),
claimPeriodDays: ethers.BigNumber.from(1),
minActiveUsers: ethers.BigNumber.from(100),
claimForEnabled: true,
maxClaimAmount: ethers.utils.parseEther('100'),
minActiveUsers: ethers.BigNumber.from(500),
claimForEnabled: false,
maxClaimAmount: ethers.utils.parseEther('437'),
maxClaimers: 500,
onlyMembers: true,
};
Expand Down
File renamed without changes.
8 changes: 8 additions & 0 deletions packages/subgraph/config/celo-prod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"network": "celo",
"UBIPoolFactoryAddress": "0x7af4A611FFA07644C3FE93aA49230e2BD2Ec8dBf",
"DirectPaymentsFactoryAddress": "0x55B06783023D8bfAB28ddb823098f1485b15Bf22",
"ProvableNFTAddress": "0x62AFaF745425fd2b67b358083068d3802e9EF04d",
"startBlock": 28352452,
"startBlockUbi": 28352452
}
2 changes: 1 addition & 1 deletion packages/subgraph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"codegen": "graph codegen",
"build": "yarn build:copyabi && yarn codegen && graph build",
"build:copyabi": "find ../contracts/artifacts/contracts/ -type f -not -name '*.dbg.json' -exec cp '{}' ./abis/ \\;",
"deploy": "yarn prepare celo; yarn prepare celo; graph auth --studio $STUDIO_PROD_KEY; graph deploy --studio goodcollective --version-label=v$npm_package_version",
"deploy": "yarn prepare celo-prod; graph auth --studio $STUDIO_PROD_KEY; graph deploy --studio goodcollective --version-label=v$npm_package_version",
"deploy-dev": "yarn prepare celo-dev;graph auth --studio $STUDIO_PROD_KEY; graph deploy --studio goodcollective --version-label= --version-label=dev-v$npm_package_version",
"create-local": "graph create --node http://localhost:8020/ scaffold-eth/your-contract",
"remove-local": "graph remove --node http://localhost:8020/ scaffold-eth/your-contract",
Expand Down

0 comments on commit 337092f

Please sign in to comment.