@gooddollar/goodprotocol 2.0.25-beta.5 → 2.0.25-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/abis/OneTimeReward.min.json +1 -0
- package/artifacts/contracts/DAOStackInterfaces.sol/Avatar.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/Controller.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/GlobalConstraintInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/IntVoteInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/ReputationInterface.dbg.json +1 -1
- package/artifacts/contracts/DAOStackInterfaces.sol/SchemeRegistrar.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/AggregatorV3Interface.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ERC20.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IAaveIncentivesController.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IAdminWallet.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IDonationStaking.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IERC2917.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IFirstClaimPool.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IGoodDollar.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IGoodStaking.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IHasRouter.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IIdentity.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IIdentityV2.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ILendingPool.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IMultichainRouter.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/INameService.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/IUBIScheme.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/ProxyAdmin.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/Reserve.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/Staking.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/Uniswap.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/UniswapFactory.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/UniswapPair.dbg.json +1 -1
- package/artifacts/contracts/Interfaces.sol/cERC20.dbg.json +1 -1
- package/artifacts/contracts/fuseFaucet/Faucet.sol/Faucet.dbg.json +1 -1
- package/artifacts/contracts/fuseFaucet/FuseFaucet.sol/FuseFaucet.dbg.json +1 -1
- package/artifacts/contracts/fuseFaucet/FuseFaucetV2.sol/FuseFaucetV2.dbg.json +1 -1
- package/artifacts/contracts/governance/ClaimersDistribution.sol/ClaimersDistribution.dbg.json +1 -1
- package/artifacts/contracts/governance/CompoundVotingMachine.sol/CompoundVotingMachine.dbg.json +1 -1
- package/artifacts/contracts/governance/GReputation.sol/GReputation.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/GoodDollarStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/IGovernanceStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/IStakingUpgrade.dbg.json +1 -1
- package/artifacts/contracts/governance/GoodDollarStaking.sol/RewardsMinter.dbg.json +1 -1
- package/artifacts/contracts/governance/GovernanceStaking.sol/GovernanceStaking.dbg.json +1 -1
- package/artifacts/contracts/governance/MultiBaseGovernanceShareField.sol/MultiBaseGovernanceShareField.dbg.json +1 -1
- package/artifacts/contracts/governance/Reputation.sol/Reputation.dbg.json +1 -1
- package/artifacts/contracts/governance/StakersDistribution.sol/StakersDistribution.dbg.json +1 -1
- package/artifacts/contracts/identity/IdentityV2.sol/IdentityV2.dbg.json +1 -1
- package/artifacts/contracts/invite/InvitesFuseV2.sol/InvitesFuseV2.dbg.json +1 -1
- package/artifacts/contracts/invite/InvitesV1.sol/InvitesV1.dbg.json +1 -1
- package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.dbg.json +1 -1
- package/artifacts/contracts/invite/InvitesV2.sol/InvitesV2.json +2 -2
- package/artifacts/contracts/invite/OneTimeReward.sol/OneTimeReward.dbg.json +4 -0
- package/artifacts/contracts/invite/OneTimeReward.sol/OneTimeReward.json +291 -0
- package/artifacts/contracts/mocks/AaveMock.sol/AaveMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/AaveUSDMockOracle.sol/AaveUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/BatUSDMockOracle.sol/BatUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/CompUsdMockOracle.sol/CompUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/DAIMock.sol/DAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DaiEthPriceMockOracle.sol/DaiEthPriceMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/DecimalsMock.sol/DecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionBridgeMock.sol/DistributionBridgeMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/DistributionHelperTest.sol/DistributionHelperTestHelper.dbg.json +1 -1
- package/artifacts/contracts/mocks/EthUSDMockOracle.sol/EthUSDMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/FeesFormularMock.sol/FeesFormulaMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/GasPriceMockOracle.sol/GasPriceMockOracle.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodCompoundStakingTest.sol/GoodCompoundStakingTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodDollarStakingMock.sol/GoodDollarStakingMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/GoodFundManagerTest.sol/GoodFundManagerTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/IdentityMock.sol/IdentityMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/IncentiveControllerMock.sol/IncentiveControllerMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/LendingPoolMock.sol/LendingPoolMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/MultichainRouterMock.sol/IWrapper.dbg.json +1 -1
- package/artifacts/contracts/mocks/MultichainRouterMock.sol/MultichainRouterMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTester.sol/IGoodDollarStakingTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTester.sol/OverMintTester.dbg.json +1 -1
- package/artifacts/contracts/mocks/OverMintTesterRegularStake.sol/OverMintTesterRegularStake.dbg.json +1 -1
- package/artifacts/contracts/mocks/PayableMock.sol/PayableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/SixteenDecimalsTokenMock.sol/SixteenDecimalsTokenMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/StakingMockFixedAPY.sol/StakingMockFixedAPY.dbg.json +1 -1
- package/artifacts/contracts/mocks/SwapHelperTest.sol/SwapHelperTest.dbg.json +1 -1
- package/artifacts/contracts/mocks/TwentyDecimalsTokenMock.sol/TwentyDecimalsTokenMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock2.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock3.dbg.json +1 -1
- package/artifacts/contracts/mocks/UpgradableMocks.sol/UpgradableMock4.dbg.json +1 -1
- package/artifacts/contracts/mocks/UsdcMock.sol/USDCMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cBATMock.sol/cBATMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAILowWorthMock.sol/cDAILowWorthMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAIMock.sol/cDAIMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDAINonMintableMock.sol/cDAINonMintableMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cDecimalsMock.sol/cDecimalsMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cSDTMock.sol/cSDTMock.dbg.json +1 -1
- package/artifacts/contracts/mocks/cUSDCMock.sol/cUSDCMock.dbg.json +1 -1
- package/artifacts/contracts/reserve/DistributionHelper.sol/DistributionHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/ExchangeHelper.sol/ExchangeHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodMarketMaker.sol/GoodMarketMaker.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodReserveCDai.sol/ContributionCalc.dbg.json +1 -1
- package/artifacts/contracts/reserve/GoodReserveCDai.sol/GoodReserveCDai.dbg.json +1 -1
- package/artifacts/contracts/staking/BaseShareField.sol/BaseShareField.dbg.json +1 -1
- package/artifacts/contracts/staking/BaseShareFieldV2.sol/BaseShareFieldV2.dbg.json +1 -1
- package/artifacts/contracts/staking/DonationsStaking.sol/DonationsStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/FuseStakingV3.sol/FuseStakingV3.dbg.json +1 -1
- package/artifacts/contracts/staking/FuseStakingV3.sol/IConsensus.dbg.json +1 -1
- package/artifacts/contracts/staking/FuseStakingV3.sol/PegSwap.dbg.json +1 -1
- package/artifacts/contracts/staking/GoodFundManager.sol/GoodFundManager.dbg.json +1 -1
- package/artifacts/contracts/staking/SimpleStaking.sol/SimpleStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/SimpleStakingV2.sol/SimpleStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/UniswapV2SwapHelper.sol/UniswapV2SwapHelper.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/AaveStakingFactory.sol/AaveStakingFactory.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/GoodAaveStaking.sol/GoodAaveStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/aave/GoodAaveStakingV2.sol/GoodAaveStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/CompoundStakingFactory.sol/CompoundStakingFactory.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/GoodCompoundStaking.sol/GoodCompoundStaking.dbg.json +1 -1
- package/artifacts/contracts/staking/compound/GoodCompoundStakingV2.sol/GoodCompoundStakingV2.dbg.json +1 -1
- package/artifacts/contracts/staking/utils/Math64X64.sol/Math64x64.dbg.json +1 -1
- package/artifacts/contracts/staking/utils/StakingRewardsFixedAPY.sol/StakingRewardsFixedAPY.dbg.json +1 -1
- package/artifacts/contracts/token/ERC20PresetMinterPauserUpgradeable.sol/ERC20PresetMinterPauserUpgradeable.dbg.json +1 -1
- package/artifacts/contracts/token/ERC677.sol/ERC677.dbg.json +1 -1
- package/artifacts/contracts/token/ERC677.sol/ERC677Receiver.dbg.json +1 -1
- package/artifacts/contracts/token/GoodDollar.sol/GoodDollar.dbg.json +1 -1
- package/artifacts/contracts/token/IFeesFormula.sol/IFeesFormula.dbg.json +1 -1
- package/artifacts/contracts/token/MultichainFeeFormula.sol/MultichainFeeFormula.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ERC20Permit.sol/ERC20Permit.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ERC20Permit.sol/SelfApprove.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/IGoodDollarCustom.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ISuperGoodDollar.sol/ISuperGoodDollar.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/ISuperToken.sol/ISuperToken.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/SuperGoodDollar.sol/SuperGoodDollar.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/SuperToken.sol/SuperToken.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/SuperfluidToken.sol/SuperfluidToken.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/UUPSProxiable.sol/UUPSProxiable.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/UUPSProxy.sol/Proxy.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSProxy.dbg.json +1 -1
- package/artifacts/contracts/token/superfluid/UUPSProxy.sol/UUPSUtils.dbg.json +1 -1
- package/artifacts/contracts/ubi/UBIScheme.sol/UBIScheme.dbg.json +1 -1
- package/artifacts/contracts/ubi/UBISchemeV2.sol/UBISchemeV2.dbg.json +1 -1
- package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.dbg.json +1 -1
- package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.dbg.json +1 -1
- package/artifacts/contracts/utils/BancorFormula.sol/BancorFormula.dbg.json +1 -1
- package/artifacts/contracts/utils/BulkProof.sol/BulkProof.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyAndBridgeHelper.sol/BuyAndBridgeHelper.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDClone.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyGDClone.sol/BuyGDCloneFactory.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyGDClone.sol/DonateGDClone.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyGDClone.sol/IQuoterV2.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyGDClone.sol/ISwapRouter.dbg.json +1 -1
- package/artifacts/contracts/utils/DAOContract.sol/DAOContract.dbg.json +1 -1
- package/artifacts/contracts/utils/DAOUpgradeableContract.sol/DAOUpgradeableContract.dbg.json +1 -1
- package/artifacts/contracts/utils/DSMath.sol/DSMath.dbg.json +1 -1
- package/artifacts/contracts/utils/DataTypes.sol/DataTypes.dbg.json +1 -1
- package/artifacts/contracts/utils/GDFaucet.sol/GDFaucet.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/GoodDollarMintBurnWrapper.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/IRouter.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/PausableControl.dbg.json +1 -1
- package/artifacts/contracts/utils/GoodDollarMintBurnWrapper.sol/TokenOperation.dbg.json +1 -1
- package/artifacts/contracts/utils/IdentityFix.sol/IdentityFix.dbg.json +1 -1
- package/artifacts/contracts/utils/MultiCall.sol/Multicall.dbg.json +1 -1
- package/artifacts/contracts/utils/MultichainBridgeHelper.sol/MultichainBridgeHelper.dbg.json +1 -1
- package/artifacts/contracts/utils/NameService.sol/NameService.dbg.json +1 -1
- package/artifacts/contracts/utils/OneTimePayments.sol/OneTimePayments.dbg.json +1 -1
- package/artifacts/contracts/utils/OneTimePaymentsV2.sol/OneTimePaymentsV2.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgrade.sol/OldMarketMaker.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgrade.sol/ProtocolUpgrade.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeFuse.sol/ProtocolUpgradeFuse.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeFuseRecover.sol/ProtocolUpgradeFuseRecover.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtocolUpgradeRecover.sol/ProtocolUpgradeRecover.dbg.json +1 -1
- package/artifacts/contracts/utils/ProxyFactory1967.sol/ERC1967Proxy.dbg.json +1 -1
- package/artifacts/contracts/utils/ProxyFactory1967.sol/ProxyFactory1967.dbg.json +1 -1
- package/artifacts/contracts/utils/ReputationTestHelper.sol/ReputationTestHelper.dbg.json +1 -1
- package/contracts/invite/InvitesV2.sol +14 -12
- package/contracts/invite/OneTimeReward.sol +87 -0
- package/package.json +1 -1
- package/scripts/deployFullDAO.ts +6 -4
- package/scripts/fv.ts +24 -30
- package/scripts/utils.ts +6 -18
- package/test/helpers.ts +2 -0
- package/test/reserve/GoodReserveCDai.test.ts +2 -1
- package/tsconfig.json +1 -1
- package/types/@openzeppelin/contracts/access/Ownable.ts +175 -0
- package/types/@openzeppelin/contracts/access/index.ts +1 -0
- package/types/contracts/invite/OneTimeReward.ts +521 -0
- package/types/contracts/invite/index.ts +1 -0
- package/types/factories/@openzeppelin/contracts/access/Ownable__factory.ts +78 -0
- package/types/factories/@openzeppelin/contracts/access/index.ts +1 -0
- package/types/factories/contracts/invite/InvitesV2__factory.ts +1 -1
- package/types/factories/contracts/invite/OneTimeReward__factory.ts +361 -0
- package/types/factories/contracts/invite/index.ts +1 -0
- package/types/hardhat.d.ts +18 -0
- package/types/index.ts +4 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
5
|
+
import "@openzeppelin/contracts/access/Ownable.sol";
|
|
6
|
+
|
|
7
|
+
import "../Interfaces.sol";
|
|
8
|
+
import "../utils/NameService.sol";
|
|
9
|
+
import "../utils/DAOUpgradeableContract.sol";
|
|
10
|
+
|
|
11
|
+
contract OneTimeReward is Ownable, DAOContract {
|
|
12
|
+
bool public isActive;
|
|
13
|
+
uint public rewardAmount;
|
|
14
|
+
mapping(address => bool) public claimed;
|
|
15
|
+
|
|
16
|
+
event RewardClaimed(address indexed user, uint amount);
|
|
17
|
+
|
|
18
|
+
constructor(uint256 _rewardAmount, INameService _nameService) {
|
|
19
|
+
rewardAmount = _rewardAmount;
|
|
20
|
+
isActive = true;
|
|
21
|
+
setDAO(_nameService);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function getIdentity() public view returns (IIdentityV2) {
|
|
25
|
+
return IIdentityV2(nameService.getAddress("IDENTITY"));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function updateSettings(
|
|
29
|
+
bool _isActive,
|
|
30
|
+
uint _rewardAmount
|
|
31
|
+
) external onlyOwner {
|
|
32
|
+
isActive = _isActive;
|
|
33
|
+
rewardAmount = _rewardAmount;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function checkActiveAndBalance() public view returns (bool) {
|
|
37
|
+
if (!isActive) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (nativeToken().balanceOf(address(this)) < rewardAmount) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function checkCanClaimReward(address _user) public view returns (bool) {
|
|
49
|
+
address whitelistedRoot = getIdentity().getWhitelistedRoot(_user);
|
|
50
|
+
return canClaimReward(whitelistedRoot);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function canClaimReward(
|
|
54
|
+
address whitelistedRoot
|
|
55
|
+
) internal view returns (bool) {
|
|
56
|
+
if (checkActiveAndBalance() == false) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (whitelistedRoot == address(0)) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (claimed[whitelistedRoot]) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function claimReward(address _user) public {
|
|
72
|
+
address whitelistedRoot = getIdentity().getWhitelistedRoot(_user);
|
|
73
|
+
require(canClaimReward(whitelistedRoot), "User cannot claim reward");
|
|
74
|
+
claimed[whitelistedRoot] = true;
|
|
75
|
+
|
|
76
|
+
nativeToken().transfer(_user, rewardAmount);
|
|
77
|
+
|
|
78
|
+
emit RewardClaimed(_user, rewardAmount);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function withdrawAll(address _token) external onlyOwner {
|
|
82
|
+
uint balance = IERC20(_token).balanceOf(address(this));
|
|
83
|
+
require(balance > 0, "No tokens to withdraw");
|
|
84
|
+
|
|
85
|
+
IERC20(_token).transfer(msg.sender, balance);
|
|
86
|
+
}
|
|
87
|
+
}
|
package/package.json
CHANGED
package/scripts/deployFullDAO.ts
CHANGED
|
@@ -88,6 +88,8 @@ export const createDAO = async () => {
|
|
|
88
88
|
.deploy()
|
|
89
89
|
.then(printDeploy)) as Contract;
|
|
90
90
|
|
|
91
|
+
await BancorFormula.init()
|
|
92
|
+
|
|
91
93
|
const AddFounders = (await AddFoundersFactory.deploy().then(
|
|
92
94
|
printDeploy
|
|
93
95
|
)) as Contract;
|
|
@@ -421,14 +423,14 @@ const deployMainnet = async (Avatar, Identity) => {
|
|
|
421
423
|
let DAIEthOracle = daiEthOracleAddr
|
|
422
424
|
? await ethers.getContractAt("DaiEthPriceMockOracle", daiEthOracleAddr)
|
|
423
425
|
: ((await (await ethers.getContractFactory("DaiEthPriceMockOracle"))
|
|
424
|
-
|
|
425
|
-
|
|
426
|
+
.deploy()
|
|
427
|
+
.then(printDeploy)) as Contract);
|
|
426
428
|
|
|
427
429
|
let ETHUsdOracle = ethUsdOracleAddr
|
|
428
430
|
? await ethers.getContractAt("EthUSDMockOracle", ethUsdOracleAddr)
|
|
429
431
|
: ((await (await ethers.getContractFactory("EthUSDMockOracle"))
|
|
430
|
-
|
|
431
|
-
|
|
432
|
+
.deploy()
|
|
433
|
+
.then(printDeploy)) as Contract);
|
|
432
434
|
|
|
433
435
|
return {
|
|
434
436
|
Contribution,
|
package/scripts/fv.ts
CHANGED
|
@@ -3,13 +3,15 @@ import fs from "fs";
|
|
|
3
3
|
import { chunk, uniqBy } from "lodash";
|
|
4
4
|
import { bulkIsWhitelisted, bulkLastAuth } from "./utils";
|
|
5
5
|
|
|
6
|
+
//create tunnel to fv server ssh -L 9090:server:8080 -N user@server -i sshkey
|
|
6
7
|
const main = async () => {
|
|
7
|
-
const data = JSON.parse(fs.readFileSync("
|
|
8
|
+
const data = JSON.parse(fs.readFileSync("fvtriplets2.txt").toString());
|
|
8
9
|
const triplets = uniqBy(chunk(data, 3), _ => _.join("_"));
|
|
9
10
|
|
|
10
11
|
const accounts = triplets.map(_ => _[0]);
|
|
11
12
|
const whitelisted = await bulkIsWhitelisted(accounts);
|
|
12
13
|
const failed = triplets.filter(_ => whitelisted.includes(_[0]) === false);
|
|
14
|
+
|
|
13
15
|
console.log("Total accounts:", accounts.length);
|
|
14
16
|
console.log("Total whitelisted:", whitelisted.length);
|
|
15
17
|
console.log("Total failed re-auth:", failed.length);
|
|
@@ -19,48 +21,39 @@ const main = async () => {
|
|
|
19
21
|
});
|
|
20
22
|
console.log({ notfetched });
|
|
21
23
|
const ps = notfetched.map(async a => {
|
|
22
|
-
const i1 = await fetch("http://localhost:9090/enrollment-3d/" + a[1]).then(
|
|
23
|
-
|
|
24
|
-
);
|
|
25
|
-
const i2 = await fetch("http://localhost:9090/enrollment-3d/" + a[2]).then(
|
|
26
|
-
_ => _.json()
|
|
27
|
-
);
|
|
24
|
+
const i1 = await fetch("http://localhost:9090/enrollment-3d/" + a[1]).then(_ => _.json());
|
|
25
|
+
const i2 = await fetch("http://localhost:9090/enrollment-3d/" + a[2]).then(_ => _.json());
|
|
28
26
|
if (i1.auditTrailBase64 && i2.auditTrailBase64) {
|
|
29
|
-
fs.writeFileSync(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
fs.writeFileSync(
|
|
37
|
-
"fvimages/" + a.join("_") + "-b.jpg",
|
|
38
|
-
i2.auditTrailBase64,
|
|
39
|
-
{
|
|
40
|
-
encoding: "base64"
|
|
41
|
-
}
|
|
42
|
-
);
|
|
43
|
-
} else
|
|
44
|
-
console.log("not found", a, !!i1.auditTrailBase64, !!i2.auditTrailBase64);
|
|
27
|
+
fs.writeFileSync("fvimages/" + a.join("_") + "-a.jpg", i1.auditTrailBase64, {
|
|
28
|
+
encoding: "base64"
|
|
29
|
+
});
|
|
30
|
+
fs.writeFileSync("fvimages/" + a.join("_") + "-b.jpg", i2.auditTrailBase64, {
|
|
31
|
+
encoding: "base64"
|
|
32
|
+
});
|
|
33
|
+
} else console.log("not found", a, !!i1.auditTrailBase64, !!i2.auditTrailBase64);
|
|
45
34
|
});
|
|
46
35
|
|
|
47
36
|
await Promise.all(ps);
|
|
48
37
|
};
|
|
49
38
|
|
|
50
|
-
const deleteIdentifiers = async
|
|
51
|
-
const data = JSON.parse(fs.readFileSync("
|
|
39
|
+
const deleteIdentifiers = async password => {
|
|
40
|
+
const data = JSON.parse(fs.readFileSync("fvtriplets2.txt").toString());
|
|
52
41
|
const triplets = uniqBy(chunk(data, 3), _ => _.join("_"));
|
|
53
42
|
const accounts = triplets.map(_ => _[0]);
|
|
54
43
|
const whitelisted = await bulkIsWhitelisted(accounts);
|
|
55
44
|
const lastAuth = await bulkLastAuth(accounts);
|
|
45
|
+
console.log(
|
|
46
|
+
"no last auth",
|
|
47
|
+
Object.entries(lastAuth).filter(_ => _[1] === 0)
|
|
48
|
+
);
|
|
49
|
+
const dateYearsAgo = new Date();
|
|
50
|
+
dateYearsAgo.setFullYear(dateYearsAgo.getFullYear() - 3);
|
|
56
51
|
const failed = triplets.filter(
|
|
57
|
-
_ =>
|
|
58
|
-
whitelisted.includes(_[0]) === false && lastAuth.includes(_[0]) === true
|
|
52
|
+
_ => whitelisted.includes(_[0]) === false && lastAuth[_[0]] > 0 && lastAuth[_[0]] < dateYearsAgo.getTime() / 1000
|
|
59
53
|
);
|
|
60
54
|
|
|
61
55
|
let ps = [];
|
|
62
|
-
console.log(
|
|
63
|
-
|
|
56
|
+
console.log("old lastauth:", failed.length, "out of:", triplets.length);
|
|
64
57
|
for (let record of failed) {
|
|
65
58
|
ps.push(
|
|
66
59
|
fetch("https://goodserver.gooddollar.org/admin/verify/face/delete", {
|
|
@@ -97,5 +90,6 @@ const deleteIdentifiers = async () => {
|
|
|
97
90
|
console.log(res);
|
|
98
91
|
};
|
|
99
92
|
|
|
100
|
-
deleteIdentifiers();
|
|
101
93
|
// main();
|
|
94
|
+
console.log(process.env.ADMIN_PASSWORD);
|
|
95
|
+
deleteIdentifiers(process.env.ADMIN_PASSWORD);
|
package/scripts/utils.ts
CHANGED
|
@@ -5,14 +5,9 @@ import { ethers } from "hardhat";
|
|
|
5
5
|
export const bulkIsWhitelisted = async (accounts: Array<String>) => {
|
|
6
6
|
setMulticallAddress(122, "0x3CE6158b7278Bf6792e014FA7B4f3c6c46fe9410");
|
|
7
7
|
setMulticallAddress(42220, "0x75F59534dd892c1f8a7B172D639FA854D529ada3");
|
|
8
|
-
const celoProvider = new ethers.providers.JsonRpcProvider(
|
|
9
|
-
"https://forno.celo.org"
|
|
10
|
-
);
|
|
8
|
+
const celoProvider = new ethers.providers.JsonRpcProvider("https://forno.celo.org");
|
|
11
9
|
const ethcallProvider = new Provider(celoProvider, 42220);
|
|
12
|
-
const identityContract = new Contract(
|
|
13
|
-
"0xC361A6E67822a0EDc17D899227dd9FC50BD62F42",
|
|
14
|
-
Identity.abi
|
|
15
|
-
);
|
|
10
|
+
const identityContract = new Contract("0xC361A6E67822a0EDc17D899227dd9FC50BD62F42", Identity.abi);
|
|
16
11
|
const calls = accounts.map(d => identityContract.isWhitelisted(d));
|
|
17
12
|
const result = await ethcallProvider.all(calls);
|
|
18
13
|
const whitelisted = accounts.filter((v, i) => result[i]);
|
|
@@ -22,17 +17,10 @@ export const bulkIsWhitelisted = async (accounts: Array<String>) => {
|
|
|
22
17
|
export const bulkLastAuth = async (accounts: Array<String>) => {
|
|
23
18
|
setMulticallAddress(122, "0x3CE6158b7278Bf6792e014FA7B4f3c6c46fe9410");
|
|
24
19
|
setMulticallAddress(42220, "0x75F59534dd892c1f8a7B172D639FA854D529ada3");
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
);
|
|
28
|
-
const ethcallProvider = new Provider(celoProvider, 42220);
|
|
29
|
-
const identityContract = new Contract(
|
|
30
|
-
"0xC361A6E67822a0EDc17D899227dd9FC50BD62F42",
|
|
31
|
-
Identity.abi
|
|
32
|
-
);
|
|
20
|
+
const fuseProvider = new ethers.providers.JsonRpcProvider("https://rpc.fuse.io");
|
|
21
|
+
const ethcallProvider = new Provider(fuseProvider, 122);
|
|
22
|
+
const identityContract = new Contract("0x2F9C28de9e6d44b71B91b8BA337A5D82e308E7BE", Identity.abi);
|
|
33
23
|
const calls = accounts.map(d => identityContract.lastAuthenticated(d));
|
|
34
24
|
const result = await ethcallProvider.all(calls);
|
|
35
|
-
|
|
36
|
-
const whitelisted = accounts.filter((v, i) => parseInt(result[i]));
|
|
37
|
-
return whitelisted;
|
|
25
|
+
return Object.fromEntries(accounts.map((v, i) => [v, parseInt(result[i])]));
|
|
38
26
|
};
|
package/test/helpers.ts
CHANGED
|
@@ -134,6 +134,8 @@ export const createDAO = async (tokenType: "super" | "regular" = "super") => {
|
|
|
134
134
|
await ethers.getContractFactory("BancorFormula")
|
|
135
135
|
).deploy();
|
|
136
136
|
|
|
137
|
+
await BancorFormula.init();
|
|
138
|
+
|
|
137
139
|
console.log("deploy upgradeable identity...");
|
|
138
140
|
|
|
139
141
|
const Identity = await upgrades.deployProxy(
|
|
@@ -474,6 +474,7 @@ describe("GoodReserve - staking with cDAI mocks", () => {
|
|
|
474
474
|
"BancorFormula",
|
|
475
475
|
await marketMaker.getBancor()
|
|
476
476
|
);
|
|
477
|
+
|
|
477
478
|
const expectedReturn = await bancor.calculateSaleReturn(
|
|
478
479
|
supplyBefore.toString(),
|
|
479
480
|
reserveBalanceBefore.toString(),
|
|
@@ -966,7 +967,7 @@ describe("GoodReserve - staking with cDAI mocks", () => {
|
|
|
966
967
|
parseInt(reserveBalance.toString()) *
|
|
967
968
|
(1 -
|
|
968
969
|
(1 - amount.toNumber() / parseInt(supply.toString())) **
|
|
969
|
-
|
|
970
|
+
(1000000 / reserveToken.reserveRatio));
|
|
970
971
|
|
|
971
972
|
expected = Math.ceil((0.8 * expected) / 100) * 100; //deduct 20% contribution, allow 5 points precission mismatch (due to bancor pow estimation?), match solidity no floating point
|
|
972
973
|
//expected = Math.floor(0.8 * expected);
|
package/tsconfig.json
CHANGED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/* Autogenerated file. Do not edit manually. */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
import type {
|
|
5
|
+
BaseContract,
|
|
6
|
+
BigNumber,
|
|
7
|
+
BytesLike,
|
|
8
|
+
CallOverrides,
|
|
9
|
+
ContractTransaction,
|
|
10
|
+
Overrides,
|
|
11
|
+
PopulatedTransaction,
|
|
12
|
+
Signer,
|
|
13
|
+
utils,
|
|
14
|
+
} from "ethers";
|
|
15
|
+
import type {
|
|
16
|
+
FunctionFragment,
|
|
17
|
+
Result,
|
|
18
|
+
EventFragment,
|
|
19
|
+
} from "@ethersproject/abi";
|
|
20
|
+
import type { Listener, Provider } from "@ethersproject/providers";
|
|
21
|
+
import type {
|
|
22
|
+
TypedEventFilter,
|
|
23
|
+
TypedEvent,
|
|
24
|
+
TypedListener,
|
|
25
|
+
OnEvent,
|
|
26
|
+
} from "../../../common";
|
|
27
|
+
|
|
28
|
+
export interface OwnableInterface extends utils.Interface {
|
|
29
|
+
functions: {
|
|
30
|
+
"owner()": FunctionFragment;
|
|
31
|
+
"renounceOwnership()": FunctionFragment;
|
|
32
|
+
"transferOwnership(address)": FunctionFragment;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
getFunction(
|
|
36
|
+
nameOrSignatureOrTopic: "owner" | "renounceOwnership" | "transferOwnership"
|
|
37
|
+
): FunctionFragment;
|
|
38
|
+
|
|
39
|
+
encodeFunctionData(functionFragment: "owner", values?: undefined): string;
|
|
40
|
+
encodeFunctionData(
|
|
41
|
+
functionFragment: "renounceOwnership",
|
|
42
|
+
values?: undefined
|
|
43
|
+
): string;
|
|
44
|
+
encodeFunctionData(
|
|
45
|
+
functionFragment: "transferOwnership",
|
|
46
|
+
values: [string]
|
|
47
|
+
): string;
|
|
48
|
+
|
|
49
|
+
decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result;
|
|
50
|
+
decodeFunctionResult(
|
|
51
|
+
functionFragment: "renounceOwnership",
|
|
52
|
+
data: BytesLike
|
|
53
|
+
): Result;
|
|
54
|
+
decodeFunctionResult(
|
|
55
|
+
functionFragment: "transferOwnership",
|
|
56
|
+
data: BytesLike
|
|
57
|
+
): Result;
|
|
58
|
+
|
|
59
|
+
events: {
|
|
60
|
+
"OwnershipTransferred(address,address)": EventFragment;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
getEvent(nameOrSignatureOrTopic: "OwnershipTransferred"): EventFragment;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface OwnershipTransferredEventObject {
|
|
67
|
+
previousOwner: string;
|
|
68
|
+
newOwner: string;
|
|
69
|
+
}
|
|
70
|
+
export type OwnershipTransferredEvent = TypedEvent<
|
|
71
|
+
[string, string],
|
|
72
|
+
OwnershipTransferredEventObject
|
|
73
|
+
>;
|
|
74
|
+
|
|
75
|
+
export type OwnershipTransferredEventFilter =
|
|
76
|
+
TypedEventFilter<OwnershipTransferredEvent>;
|
|
77
|
+
|
|
78
|
+
export interface Ownable extends BaseContract {
|
|
79
|
+
connect(signerOrProvider: Signer | Provider | string): this;
|
|
80
|
+
attach(addressOrName: string): this;
|
|
81
|
+
deployed(): Promise<this>;
|
|
82
|
+
|
|
83
|
+
interface: OwnableInterface;
|
|
84
|
+
|
|
85
|
+
queryFilter<TEvent extends TypedEvent>(
|
|
86
|
+
event: TypedEventFilter<TEvent>,
|
|
87
|
+
fromBlockOrBlockhash?: string | number | undefined,
|
|
88
|
+
toBlock?: string | number | undefined
|
|
89
|
+
): Promise<Array<TEvent>>;
|
|
90
|
+
|
|
91
|
+
listeners<TEvent extends TypedEvent>(
|
|
92
|
+
eventFilter?: TypedEventFilter<TEvent>
|
|
93
|
+
): Array<TypedListener<TEvent>>;
|
|
94
|
+
listeners(eventName?: string): Array<Listener>;
|
|
95
|
+
removeAllListeners<TEvent extends TypedEvent>(
|
|
96
|
+
eventFilter: TypedEventFilter<TEvent>
|
|
97
|
+
): this;
|
|
98
|
+
removeAllListeners(eventName?: string): this;
|
|
99
|
+
off: OnEvent<this>;
|
|
100
|
+
on: OnEvent<this>;
|
|
101
|
+
once: OnEvent<this>;
|
|
102
|
+
removeListener: OnEvent<this>;
|
|
103
|
+
|
|
104
|
+
functions: {
|
|
105
|
+
owner(overrides?: CallOverrides): Promise<[string]>;
|
|
106
|
+
|
|
107
|
+
renounceOwnership(
|
|
108
|
+
overrides?: Overrides & { from?: string }
|
|
109
|
+
): Promise<ContractTransaction>;
|
|
110
|
+
|
|
111
|
+
transferOwnership(
|
|
112
|
+
newOwner: string,
|
|
113
|
+
overrides?: Overrides & { from?: string }
|
|
114
|
+
): Promise<ContractTransaction>;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
owner(overrides?: CallOverrides): Promise<string>;
|
|
118
|
+
|
|
119
|
+
renounceOwnership(
|
|
120
|
+
overrides?: Overrides & { from?: string }
|
|
121
|
+
): Promise<ContractTransaction>;
|
|
122
|
+
|
|
123
|
+
transferOwnership(
|
|
124
|
+
newOwner: string,
|
|
125
|
+
overrides?: Overrides & { from?: string }
|
|
126
|
+
): Promise<ContractTransaction>;
|
|
127
|
+
|
|
128
|
+
callStatic: {
|
|
129
|
+
owner(overrides?: CallOverrides): Promise<string>;
|
|
130
|
+
|
|
131
|
+
renounceOwnership(overrides?: CallOverrides): Promise<void>;
|
|
132
|
+
|
|
133
|
+
transferOwnership(
|
|
134
|
+
newOwner: string,
|
|
135
|
+
overrides?: CallOverrides
|
|
136
|
+
): Promise<void>;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
filters: {
|
|
140
|
+
"OwnershipTransferred(address,address)"(
|
|
141
|
+
previousOwner?: string | null,
|
|
142
|
+
newOwner?: string | null
|
|
143
|
+
): OwnershipTransferredEventFilter;
|
|
144
|
+
OwnershipTransferred(
|
|
145
|
+
previousOwner?: string | null,
|
|
146
|
+
newOwner?: string | null
|
|
147
|
+
): OwnershipTransferredEventFilter;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
estimateGas: {
|
|
151
|
+
owner(overrides?: CallOverrides): Promise<BigNumber>;
|
|
152
|
+
|
|
153
|
+
renounceOwnership(
|
|
154
|
+
overrides?: Overrides & { from?: string }
|
|
155
|
+
): Promise<BigNumber>;
|
|
156
|
+
|
|
157
|
+
transferOwnership(
|
|
158
|
+
newOwner: string,
|
|
159
|
+
overrides?: Overrides & { from?: string }
|
|
160
|
+
): Promise<BigNumber>;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
populateTransaction: {
|
|
164
|
+
owner(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
165
|
+
|
|
166
|
+
renounceOwnership(
|
|
167
|
+
overrides?: Overrides & { from?: string }
|
|
168
|
+
): Promise<PopulatedTransaction>;
|
|
169
|
+
|
|
170
|
+
transferOwnership(
|
|
171
|
+
newOwner: string,
|
|
172
|
+
overrides?: Overrides & { from?: string }
|
|
173
|
+
): Promise<PopulatedTransaction>;
|
|
174
|
+
};
|
|
175
|
+
}
|