@gooddollar/goodprotocol 2.0.25-beta.6 → 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/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/OneTimeReward.sol +87 -0
- package/package.json +1 -1
- package/scripts/deployFullDAO.ts +6 -4
- package/test/helpers.ts +2 -0
- package/test/reserve/GoodReserveCDai.test.ts +2 -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/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/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);
|
|
@@ -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
|
+
}
|