diff --git a/packages/contracts/contracts/UBI/UBIPool.sol b/packages/contracts/contracts/UBI/UBIPool.sol index 507a6b79..5cc9fcb9 100644 --- a/packages/contracts/contracts/UBI/UBIPool.sol +++ b/packages/contracts/contracts/UBI/UBIPool.sol @@ -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(); @@ -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); diff --git a/packages/contracts/hardhat.config.ts b/packages/contracts/hardhat.config.ts index ae70f1e1..d04c0630 100644 --- a/packages/contracts/hardhat.config.ts +++ b/packages/contracts/hardhat.config.ts @@ -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`, diff --git a/packages/sdk-js/scripts/createPool.ts b/packages/sdk-js/scripts/createPool.ts index 1c9bb453..3dc823f1 100644 --- a/packages/sdk-js/scripts/createPool.ts +++ b/packages/sdk-js/scripts/createPool.ts @@ -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) => { @@ -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: 'myemail@gmail.com', + // 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: 'myemail@gmail.com', - 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); @@ -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: 'myemail@gmail.com', - 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, }; diff --git a/packages/subgraph/config/celo.json b/packages/subgraph/config/celo-old.json similarity index 100% rename from packages/subgraph/config/celo.json rename to packages/subgraph/config/celo-old.json diff --git a/packages/subgraph/config/celo-prod.json b/packages/subgraph/config/celo-prod.json new file mode 100644 index 00000000..5f2c287f --- /dev/null +++ b/packages/subgraph/config/celo-prod.json @@ -0,0 +1,8 @@ +{ + "network": "celo", + "UBIPoolFactoryAddress": "0x7af4A611FFA07644C3FE93aA49230e2BD2Ec8dBf", + "DirectPaymentsFactoryAddress": "0x55B06783023D8bfAB28ddb823098f1485b15Bf22", + "ProvableNFTAddress": "0x62AFaF745425fd2b67b358083068d3802e9EF04d", + "startBlock": 28352452, + "startBlockUbi": 28352452 +} diff --git a/packages/subgraph/package.json b/packages/subgraph/package.json index 14219bca..26f43bca 100644 --- a/packages/subgraph/package.json +++ b/packages/subgraph/package.json @@ -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",