@gooddollar/goodprotocol 2.1.0 → 2.1.2
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/README.md +12 -0
- package/artifacts/abis/AdminWallet.min.json +1 -1
- package/artifacts/abis/AdminWalletFuse.min.json +1 -1
- package/artifacts/abis/GenericDistributionHelperTest.min.json +1 -0
- package/artifacts/abis/GenericDistributionHelperTestHelper.min.json +1 -0
- package/artifacts/abis/IBancorExchangeProvider.min.json +1 -1
- package/artifacts/abis/IUniswapV3Pool.min.json +1 -1
- package/artifacts/abis/IdentityV3.min.json +1 -1
- package/artifacts/abis/MentoExchange.min.json +1 -1
- package/artifacts/abis/UpdateReserveRatioAfterXDC.min.json +1 -0
- package/artifacts/contracts/IUniswapV3.sol/INonfungiblePositionManager.dbg.json +1 -1
- package/artifacts/contracts/IUniswapV3.sol/IUniswapV3Pool.dbg.json +1 -1
- package/artifacts/contracts/IUniswapV3.sol/IUniswapV3Pool.json +13 -0
- package/artifacts/contracts/MentoInterfaces.sol/IBancorExchangeProvider.dbg.json +1 -1
- package/artifacts/contracts/MentoInterfaces.sol/IBancorExchangeProvider.json +13 -0
- package/artifacts/contracts/MentoInterfaces.sol/IBroker.dbg.json +1 -1
- package/artifacts/contracts/MentoInterfaces.sol/IGoodDollarExchangeProvider.dbg.json +1 -1
- package/artifacts/contracts/MentoInterfaces.sol/IGoodDollarExpansionController.dbg.json +1 -1
- package/artifacts/contracts/MentoInterfaces.sol/IMentoReserve.dbg.json +1 -1
- package/artifacts/contracts/MentoInterfaces.sol/ITradingLimits.dbg.json +1 -1
- package/artifacts/contracts/identity/IdentityV3.sol/IdentityV3.dbg.json +1 -1
- package/artifacts/contracts/identity/IdentityV3.sol/IdentityV3.json +40 -2
- package/artifacts/contracts/mocks/GenericDistributionHelperTest.sol/GenericDistributionHelperTest.dbg.json +4 -0
- package/artifacts/contracts/mocks/GenericDistributionHelperTest.sol/GenericDistributionHelperTest.json +931 -0
- package/artifacts/contracts/mocks/GenericDistributionHelperTest.sol/GenericDistributionHelperTestHelper.dbg.json +4 -0
- package/artifacts/contracts/mocks/GenericDistributionHelperTest.sol/GenericDistributionHelperTestHelper.json +957 -0
- package/artifacts/contracts/reserve/GenericDistributionHelper.sol/GenericDistributionHelper.dbg.json +1 -1
- package/artifacts/contracts/reserve/GenericDistributionHelper.sol/GenericDistributionHelper.json +2 -2
- package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.dbg.json +1 -1
- package/artifacts/contracts/utils/AdminWallet.sol/AdminWallet.json +36 -2
- package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.dbg.json +1 -1
- package/artifacts/contracts/utils/AdminWalletFuse.sol/AdminWalletFuse.json +36 -2
- package/artifacts/contracts/utils/BulkWhitelist.sol/BulkWhitelist.dbg.json +1 -1
- package/artifacts/contracts/utils/BulkWhitelist.sol/BulkWhitelist.json +2 -2
- package/artifacts/contracts/utils/BuyFromReserveHelper.sol/BuyFromReserveHelper.dbg.json +1 -1
- package/artifacts/contracts/utils/BuyFromReserveHelper.sol/BuyFromReserveHelper.json +2 -2
- 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/ProtoclUpgradeV4Mento.sol/MentoExchange.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtoclUpgradeV4Mento.sol/ProtocolUpgradeV4Mento.dbg.json +1 -1
- package/artifacts/contracts/utils/ProtoclUpgradeV4Mento.sol/ProtocolUpgradeV4Mento.json +2 -2
- package/artifacts/contracts/utils/UpdateReserveRatioAfterXDC.sol/MentoExchange.dbg.json +4 -0
- package/artifacts/contracts/utils/UpdateReserveRatioAfterXDC.sol/MentoExchange.json +24 -0
- package/artifacts/contracts/utils/UpdateReserveRatioAfterXDC.sol/UpdateReserveRatioAfterXDC.dbg.json +4 -0
- package/artifacts/contracts/utils/UpdateReserveRatioAfterXDC.sol/UpdateReserveRatioAfterXDC.json +50 -0
- package/contracts/IUniswapV3.sol +2 -0
- package/contracts/identity/IdentityV3.sol +2 -0
- package/contracts/mocks/GenericDistributionHelperTest.sol +31 -0
- package/contracts/reserve/GenericDistributionHelper.sol +43 -21
- package/contracts/utils/AdminWallet.sol +27 -0
- package/contracts/utils/AdminWalletFuse.sol +27 -0
- package/contracts/utils/UpdateReserveRatioAfterXDC.sol +64 -0
- package/hardhat.config.ts +9 -12
- package/package.json +3 -2
- package/releases/deployment.json +4 -1
- package/scripts/bulkWhitelist.ts +31 -0
- package/scripts/multichain-deploy/helpers.ts +13 -6
- package/scripts/proposals/gip-25-xdc-deploy-reserve.ts +425 -0
- package/scripts/proposals/gip-25-xdc-upgrade-ubi.ts +334 -31
- package/test/governance/ClaimersDistribution.test.ts +1 -1
- package/test/reserve/GenericDistributionHelper.test.ts +315 -0
- package/test/ubi/UBISchemeCycle.test.ts +30 -63
- package/types/contracts/IUniswapV3.sol/IUniswapV3Pool.ts +14 -1
- package/types/contracts/MentoInterfaces.sol/IBancorExchangeProvider.ts +14 -0
- package/types/contracts/fuseFaucet/Faucet copy.sol/DebugFaucet.ts +1439 -0
- package/types/contracts/fuseFaucet/Faucet copy.sol/index.ts +4 -0
- package/types/contracts/identity/IdentityV3.ts +46 -0
- package/types/contracts/index.ts +0 -2
- package/types/contracts/mocks/GenericDistributionHelperTest.sol/CeloDistributionHelperTestHelper.ts +1357 -0
- package/types/contracts/mocks/GenericDistributionHelperTest.sol/GenericDistributionHelperTest.ts +1305 -0
- package/types/contracts/mocks/GenericDistributionHelperTest.sol/GenericDistributionHelperTestHelper.ts +1357 -0
- package/types/contracts/mocks/GenericDistributionHelperTest.sol/index.ts +5 -0
- package/types/contracts/mocks/index.ts +2 -0
- package/types/contracts/utils/AdminWallet.ts +45 -0
- package/types/contracts/utils/AdminWalletFuse.ts +45 -0
- package/types/contracts/utils/BuyGDClone.sol/BuyGDCloneV2.ts +464 -0
- package/types/contracts/utils/UpdateReserveRatioAfterXDC.sol/MentoExchange.ts +81 -0
- package/types/contracts/utils/UpdateReserveRatioAfterXDC.sol/UpdateReserveRatioAfterXDC.ts +117 -0
- package/types/contracts/utils/UpdateReserveRatioAfterXDC.sol/index.ts +5 -0
- package/types/contracts/utils/UpdateReserveSettingsForXdc.sol/MentoExchange.ts +81 -0
- package/types/contracts/utils/UpdateReserveSettingsForXdc.sol/UpdateReserveRatioAfterXDC.ts +122 -0
- package/types/contracts/utils/UpdateReserveSettingsForXdc.sol/index.ts +5 -0
- package/types/contracts/utils/index.ts +4 -0
- package/types/factories/contracts/IUniswapV3.sol/IUniswapV3Pool__factory.ts +13 -0
- package/types/factories/contracts/MentoInterfaces.sol/IBancorExchangeProvider__factory.ts +13 -0
- package/types/factories/contracts/fuseFaucet/Faucet copy.sol/DebugFaucet__factory.ts +945 -0
- package/types/factories/contracts/fuseFaucet/Faucet copy.sol/index.ts +4 -0
- package/types/factories/contracts/identity/IdentityV3__factory.ts +39 -1
- package/types/factories/contracts/index.ts +0 -1
- package/types/factories/contracts/mocks/GenericDistributionHelperTest.sol/CeloDistributionHelperTestHelper__factory.ts +1017 -0
- package/types/factories/contracts/mocks/GenericDistributionHelperTest.sol/GenericDistributionHelperTestHelper__factory.ts +1021 -0
- package/types/factories/contracts/mocks/GenericDistributionHelperTest.sol/GenericDistributionHelperTest__factory.ts +989 -0
- package/types/factories/contracts/mocks/GenericDistributionHelperTest.sol/index.ts +5 -0
- package/types/factories/contracts/mocks/index.ts +1 -0
- package/types/factories/contracts/reserve/GenericDistributionHelper__factory.ts +1 -1
- package/types/factories/contracts/utils/AdminWalletFuse__factory.ts +35 -1
- package/types/factories/contracts/utils/AdminWallet__factory.ts +35 -1
- package/types/factories/contracts/utils/BulkWhitelist__factory.ts +1 -1
- package/types/factories/contracts/utils/BuyFromReserveHelper__factory.ts +1 -1
- package/types/factories/contracts/utils/BuyGDClone.sol/BuyGDCloneV2__factory.ts +415 -0
- package/types/factories/contracts/utils/ProtoclUpgradeV4Mento.sol/ProtocolUpgradeV4Mento__factory.ts +1 -1
- package/types/factories/contracts/utils/UpdateReserveRatioAfterXDC.sol/MentoExchange__factory.ts +39 -0
- package/types/factories/contracts/utils/UpdateReserveRatioAfterXDC.sol/UpdateReserveRatioAfterXDC__factory.ts +110 -0
- package/types/factories/contracts/utils/UpdateReserveRatioAfterXDC.sol/index.ts +5 -0
- package/types/factories/contracts/utils/UpdateReserveSettingsForXdc.sol/MentoExchange__factory.ts +39 -0
- package/types/factories/contracts/utils/UpdateReserveSettingsForXdc.sol/UpdateReserveRatioAfterXDC__factory.ts +115 -0
- package/types/factories/contracts/utils/UpdateReserveSettingsForXdc.sol/index.ts +5 -0
- package/types/factories/contracts/utils/index.ts +2 -0
- package/types/hardhat.d.ts +54 -9
- package/types/index.ts +6 -0
- package/artifacts/contracts/IQuoter.sol/IQuoterV2.dbg.json +0 -4
- package/artifacts/contracts/IQuoter.sol/IQuoterV2.json +0 -211
package/artifacts/contracts/utils/UpdateReserveRatioAfterXDC.sol/UpdateReserveRatioAfterXDC.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_format": "hh-sol-artifact-1",
|
|
3
|
+
"contractName": "UpdateReserveRatioAfterXDC",
|
|
4
|
+
"sourceName": "contracts/utils/UpdateReserveRatioAfterXDC.sol",
|
|
5
|
+
"abi": [
|
|
6
|
+
{
|
|
7
|
+
"inputs": [
|
|
8
|
+
{
|
|
9
|
+
"internalType": "address",
|
|
10
|
+
"name": "_owner",
|
|
11
|
+
"type": "address"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"stateMutability": "nonpayable",
|
|
15
|
+
"type": "constructor"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"inputs": [
|
|
19
|
+
{
|
|
20
|
+
"internalType": "contract Controller",
|
|
21
|
+
"name": "_controller",
|
|
22
|
+
"type": "address"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"internalType": "address",
|
|
26
|
+
"name": "_mentoExchange",
|
|
27
|
+
"type": "address"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"internalType": "bytes32",
|
|
31
|
+
"name": "_exchangeId",
|
|
32
|
+
"type": "bytes32"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"internalType": "uint32",
|
|
36
|
+
"name": "_reserveRatio",
|
|
37
|
+
"type": "uint32"
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"name": "upgrade",
|
|
41
|
+
"outputs": [],
|
|
42
|
+
"stateMutability": "nonpayable",
|
|
43
|
+
"type": "function"
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"bytecode": "0x608060405234801561001057600080fd5b5060405161090038038061090083398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b61086d806100936000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063fb7b652814610030575b600080fd5b61004361003e366004610592565b610045565b005b6000546001600160a01b0316331461009f5760405162461bcd60e51b81526020600482015260186024820152776f6e6c79206f776e65722063616e2063616c6c207468697360401b60448201526064015b60405180910390fd5b6000836001600160a01b0316633149d54a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061010391906105e5565b6040516309e1222960e21b8152600481018590529091506000906001600160a01b0386169063278488a49060240160c060405180830381865afa15801561014e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610172919061061f565b63ffffffff841660808201526040516024810186905260006044820181905291925081906001600160a01b0389169063d1b7089a90899060640160408051601f198184030181529181526020820180516001600160e01b03166372375adb60e11b179052516001600160e01b031960e085901b1681526101fb92919089906000906004016106dd565b6000604051808303816000875af115801561021a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526102429190810190610743565b915091508161028c5760405162461bcd60e51b815260206004820152601660248201527519195cdd1c9bde515e18da185b99d94819985a5b195960521b6044820152606401610096565b6040805184516001600160a01b03908116602483015260208601518116604483015291850151606482015260608501516084820152608085015163ffffffff90811660a483015260a08601511660c48201529089169063d1b7089a90899060e40160408051601f198184030181529181526020820180516001600160e01b031663aec36c1f60e01b179052516001600160e01b031960e085901b16815261033c92919089906000906004016106dd565b6000604051808303816000875af115801561035b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103839190810190610743565b9092509050816103cd5760405162461bcd60e51b815260206004820152601560248201527418dc99585d19515e18da185b99d94819985a5b1959605a1b6044820152606401610096565b6000818060200190518101906103e39190610803565b905086811461042b5760405162461bcd60e51b81526020600482015260146024820152731b9bdd081cd85b5948195e18da185b99d9481a5960621b6044820152606401610096565b610434816104fe565b604051636c525b1360e01b81526001600160a01b0386811660048301528a1690636c525b13906024016020604051808303816000875af115801561047c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104a0919061081c565b6104e35760405162461bcd60e51b81526020600482015260146024820152731d5b9c9959da5cdd195c9a5b99c819985a5b195960621b6044820152606401610096565b5050600080546001600160a01b031916905550505050505050565b6105438160405160240161051491815260200190565b60408051601f198184030181529190526020810180516001600160e01b03166327b7cf8560e01b179052610546565b50565b6105438160006a636f6e736f6c652e6c6f679050600080835160208501845afa505050565b6001600160a01b038116811461054357600080fd5b63ffffffff8116811461054357600080fd5b600080600080608085870312156105a857600080fd5b84356105b38161056b565b935060208501356105c38161056b565b92506040850135915060608501356105da81610580565b939692955090935050565b6000602082840312156105f757600080fd5b81516106028161056b565b9392505050565b634e487b7160e01b600052604160045260246000fd5b600060c0828403121561063157600080fd5b60405160c081016001600160401b038111828210171561065357610653610609565b60405282516106618161056b565b815260208301516106718161056b565b806020830152506040830151604082015260608301516060820152608083015161069a81610580565b608082015260a08301516106ad81610580565b60a08201529392505050565b60005b838110156106d45781810151838201526020016106bc565b50506000910152565b600060018060a01b03808716835260806020840152855180608085015261070b8160a0860160208a016106b9565b9416604083015250606081019190915260a0601f909201601f1916010192915050565b8051801515811461073e57600080fd5b919050565b6000806040838503121561075657600080fd5b61075f8361072e565b60208401519092506001600160401b038082111561077c57600080fd5b818501915085601f83011261079057600080fd5b8151818111156107a2576107a2610609565b604051601f8201601f19908116603f011681019083821181831017156107ca576107ca610609565b816040528281528860208487010111156107e357600080fd5b6107f48360208301602088016106b9565b80955050505050509250929050565b60006020828403121561081557600080fd5b5051919050565b60006020828403121561082e57600080fd5b6106028261072e56fea26469706673582212200fce731fac65158d43214b3007af300c6df7bc0a05f1f9f971f545474e09566b64736f6c63430008130033",
|
|
47
|
+
"deployedBytecode": "0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063fb7b652814610030575b600080fd5b61004361003e366004610592565b610045565b005b6000546001600160a01b0316331461009f5760405162461bcd60e51b81526020600482015260186024820152776f6e6c79206f776e65722063616e2063616c6c207468697360401b60448201526064015b60405180910390fd5b6000836001600160a01b0316633149d54a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061010391906105e5565b6040516309e1222960e21b8152600481018590529091506000906001600160a01b0386169063278488a49060240160c060405180830381865afa15801561014e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610172919061061f565b63ffffffff841660808201526040516024810186905260006044820181905291925081906001600160a01b0389169063d1b7089a90899060640160408051601f198184030181529181526020820180516001600160e01b03166372375adb60e11b179052516001600160e01b031960e085901b1681526101fb92919089906000906004016106dd565b6000604051808303816000875af115801561021a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526102429190810190610743565b915091508161028c5760405162461bcd60e51b815260206004820152601660248201527519195cdd1c9bde515e18da185b99d94819985a5b195960521b6044820152606401610096565b6040805184516001600160a01b03908116602483015260208601518116604483015291850151606482015260608501516084820152608085015163ffffffff90811660a483015260a08601511660c48201529089169063d1b7089a90899060e40160408051601f198184030181529181526020820180516001600160e01b031663aec36c1f60e01b179052516001600160e01b031960e085901b16815261033c92919089906000906004016106dd565b6000604051808303816000875af115801561035b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526103839190810190610743565b9092509050816103cd5760405162461bcd60e51b815260206004820152601560248201527418dc99585d19515e18da185b99d94819985a5b1959605a1b6044820152606401610096565b6000818060200190518101906103e39190610803565b905086811461042b5760405162461bcd60e51b81526020600482015260146024820152731b9bdd081cd85b5948195e18da185b99d9481a5960621b6044820152606401610096565b610434816104fe565b604051636c525b1360e01b81526001600160a01b0386811660048301528a1690636c525b13906024016020604051808303816000875af115801561047c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104a0919061081c565b6104e35760405162461bcd60e51b81526020600482015260146024820152731d5b9c9959da5cdd195c9a5b99c819985a5b195960621b6044820152606401610096565b5050600080546001600160a01b031916905550505050505050565b6105438160405160240161051491815260200190565b60408051601f198184030181529190526020810180516001600160e01b03166327b7cf8560e01b179052610546565b50565b6105438160006a636f6e736f6c652e6c6f679050600080835160208501845afa505050565b6001600160a01b038116811461054357600080fd5b63ffffffff8116811461054357600080fd5b600080600080608085870312156105a857600080fd5b84356105b38161056b565b935060208501356105c38161056b565b92506040850135915060608501356105da81610580565b939692955090935050565b6000602082840312156105f757600080fd5b81516106028161056b565b9392505050565b634e487b7160e01b600052604160045260246000fd5b600060c0828403121561063157600080fd5b60405160c081016001600160401b038111828210171561065357610653610609565b60405282516106618161056b565b815260208301516106718161056b565b806020830152506040830151604082015260608301516060820152608083015161069a81610580565b608082015260a08301516106ad81610580565b60a08201529392505050565b60005b838110156106d45781810151838201526020016106bc565b50506000910152565b600060018060a01b03808716835260806020840152855180608085015261070b8160a0860160208a016106b9565b9416604083015250606081019190915260a0601f909201601f1916010192915050565b8051801515811461073e57600080fd5b919050565b6000806040838503121561075657600080fd5b61075f8361072e565b60208401519092506001600160401b038082111561077c57600080fd5b818501915085601f83011261079057600080fd5b8151818111156107a2576107a2610609565b604051601f8201601f19908116603f011681019083821181831017156107ca576107ca610609565b816040528281528860208487010111156107e357600080fd5b6107f48360208301602088016106b9565b80955050505050509250929050565b60006020828403121561081557600080fd5b5051919050565b60006020828403121561082e57600080fd5b6106028261072e56fea26469706673582212200fce731fac65158d43214b3007af300c6df7bc0a05f1f9f971f545474e09566b64736f6c63430008130033",
|
|
48
|
+
"linkReferences": {},
|
|
49
|
+
"deployedLinkReferences": {}
|
|
50
|
+
}
|
package/contracts/IUniswapV3.sol
CHANGED
|
@@ -35,6 +35,7 @@ contract IdentityV3 is
|
|
|
35
35
|
string public constant TYPED_STRUCTURE =
|
|
36
36
|
"ConnectIdentity(address whitelisted,address connected,uint256 deadline)";
|
|
37
37
|
|
|
38
|
+
/* @dev rough estimate of number of whitelisted addresses */
|
|
38
39
|
uint256 public whitelistedCount;
|
|
39
40
|
uint256 public whitelistedContracts;
|
|
40
41
|
uint256 public authenticationPeriod;
|
|
@@ -236,6 +237,7 @@ contract IdentityV3 is
|
|
|
236
237
|
function addBlacklisted(
|
|
237
238
|
address account
|
|
238
239
|
) public onlyRole(IDENTITY_ADMIN_ROLE) whenNotPaused {
|
|
240
|
+
_removeWhitelisted(account);
|
|
239
241
|
identities[account].status = 255;
|
|
240
242
|
emit BlacklistAdded(account);
|
|
241
243
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
pragma solidity >=0.8;
|
|
2
|
+
|
|
3
|
+
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
4
|
+
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
5
|
+
import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol";
|
|
6
|
+
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
|
7
|
+
import "@openzeppelin/contracts/utils/math/Math.sol";
|
|
8
|
+
|
|
9
|
+
import "../reserve/GenericDistributionHelper.sol";
|
|
10
|
+
|
|
11
|
+
contract GenericDistributionHelperTest is GenericDistributionHelper {
|
|
12
|
+
function onDistribution(uint256 _amount) external override {
|
|
13
|
+
revert();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
contract GenericDistributionHelperTestHelper is GenericDistributionHelper {
|
|
18
|
+
IMessagePassingBridge bridge;
|
|
19
|
+
|
|
20
|
+
function setOracle(IStaticOracle oracle) external {
|
|
21
|
+
STATIC_ORACLE = oracle;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function getBridge() public view override returns (IMessagePassingBridge) {
|
|
25
|
+
return bridge;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function setBridges(address _mpbBridge) external {
|
|
29
|
+
bridge = IMessagePassingBridge(_mpbBridge);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -9,6 +9,7 @@ import "@gooddollar/bridge-contracts/contracts/messagePassingBridge/IMessagePass
|
|
|
9
9
|
import "@uniswap/v2-periphery/contracts/interfaces/IWETH.sol";
|
|
10
10
|
|
|
11
11
|
import "../utils/DAOUpgradeableContract.sol";
|
|
12
|
+
import "../IUniswapV3.sol";
|
|
12
13
|
|
|
13
14
|
// import "hardhat/console.sol";
|
|
14
15
|
|
|
@@ -57,6 +58,8 @@ contract GenericDistributionHelper is
|
|
|
57
58
|
|
|
58
59
|
address public reserveToken;
|
|
59
60
|
|
|
61
|
+
uint256 private _status; //for reentrancy guard
|
|
62
|
+
|
|
60
63
|
event Distribution(
|
|
61
64
|
uint256 distributed,
|
|
62
65
|
uint256 startingBalance,
|
|
@@ -75,6 +78,18 @@ contract GenericDistributionHelper is
|
|
|
75
78
|
|
|
76
79
|
receive() external payable {}
|
|
77
80
|
|
|
81
|
+
modifier nonReentrant() {
|
|
82
|
+
// On the first call to nonReentrant, _status will be _NOT_ENTERED
|
|
83
|
+
require(_status != 1, "ReentrancyGuard: reentrant call");
|
|
84
|
+
|
|
85
|
+
// Any calls to nonReentrant after this point will fail
|
|
86
|
+
_status = 1;
|
|
87
|
+
_;
|
|
88
|
+
// By storing the original value once again, a refund is triggered (see
|
|
89
|
+
// https://eips.ethereum.org/EIPS/eip-2200)
|
|
90
|
+
_status = 0;
|
|
91
|
+
}
|
|
92
|
+
|
|
78
93
|
function initialize(
|
|
79
94
|
INameService _ns,
|
|
80
95
|
IStaticOracle _oracle,
|
|
@@ -94,7 +109,7 @@ contract GenericDistributionHelper is
|
|
|
94
109
|
_setReserveToken(_reserveToken);
|
|
95
110
|
}
|
|
96
111
|
|
|
97
|
-
function getBridge() public view returns (IMessagePassingBridge) {
|
|
112
|
+
function getBridge() public view virtual returns (IMessagePassingBridge) {
|
|
98
113
|
return IMessagePassingBridge(nameService.getAddress("MPBBRIDGE_CONTRACT"));
|
|
99
114
|
}
|
|
100
115
|
|
|
@@ -105,19 +120,15 @@ contract GenericDistributionHelper is
|
|
|
105
120
|
}
|
|
106
121
|
|
|
107
122
|
function _setReserveToken(address _reserveToken) internal {
|
|
108
|
-
uint24[] memory fees = new uint24[](1);
|
|
109
|
-
fees[0] = 100;
|
|
110
123
|
reserveToken = _reserveToken;
|
|
111
|
-
STATIC_ORACLE.
|
|
124
|
+
STATIC_ORACLE.prepareAllAvailablePoolsWithTimePeriod(
|
|
112
125
|
reserveToken,
|
|
113
126
|
address(nativeToken()),
|
|
114
|
-
fees,
|
|
115
127
|
60
|
|
116
128
|
);
|
|
117
|
-
STATIC_ORACLE.
|
|
129
|
+
STATIC_ORACLE.prepareAllAvailablePoolsWithTimePeriod(
|
|
118
130
|
reserveToken,
|
|
119
131
|
gasToken,
|
|
120
|
-
fees,
|
|
121
132
|
60
|
|
122
133
|
);
|
|
123
134
|
}
|
|
@@ -132,7 +143,7 @@ contract GenericDistributionHelper is
|
|
|
132
143
|
* @notice this is usually called by reserve, but can be called by anyone anytime to trigger distribution
|
|
133
144
|
* @param _amount how much was sent, informational only
|
|
134
145
|
*/
|
|
135
|
-
function onDistribution(uint256 _amount) external virtual {
|
|
146
|
+
function onDistribution(uint256 _amount) external virtual nonReentrant {
|
|
136
147
|
//we consider the actual balance and not _amount
|
|
137
148
|
uint256 toDistribute = nativeToken().balanceOf(address(this));
|
|
138
149
|
if (toDistribute == 0) return;
|
|
@@ -243,25 +254,21 @@ contract GenericDistributionHelper is
|
|
|
243
254
|
function calcGDToSell(
|
|
244
255
|
uint256 maxAmountToSell
|
|
245
256
|
) public view returns (uint256 gdToSell, uint256 minReceived) {
|
|
246
|
-
uint24[] memory fees = new uint24[](1);
|
|
247
|
-
fees[0] = 100;
|
|
248
257
|
uint256 nativeToBuy = feeSettings.minBalanceForFees *
|
|
249
258
|
3 -
|
|
250
259
|
address(this).balance;
|
|
251
260
|
(uint256 nativeValueInUSD, ) = STATIC_ORACLE
|
|
252
|
-
.
|
|
261
|
+
.quoteAllAvailablePoolsWithTimePeriod(
|
|
253
262
|
uint128(nativeToBuy),
|
|
254
263
|
gasToken,
|
|
255
264
|
reserveToken,
|
|
256
|
-
fees,
|
|
257
265
|
60 //last 1 minute
|
|
258
266
|
);
|
|
259
267
|
|
|
260
|
-
(gdToSell, ) = STATIC_ORACLE.
|
|
268
|
+
(gdToSell, ) = STATIC_ORACLE.quoteAllAvailablePoolsWithTimePeriod(
|
|
261
269
|
uint128(nativeValueInUSD),
|
|
262
270
|
reserveToken,
|
|
263
271
|
address(nativeToken()),
|
|
264
|
-
fees,
|
|
265
272
|
60 //last 1 minute
|
|
266
273
|
);
|
|
267
274
|
|
|
@@ -269,22 +276,19 @@ contract GenericDistributionHelper is
|
|
|
269
276
|
if (gdToSell > maxAmountToSell) {
|
|
270
277
|
gdToSell = maxAmountToSell;
|
|
271
278
|
|
|
272
|
-
fees[0] = 100;
|
|
273
279
|
// gdToSell = (nativeValueInUSD * 1e18) / gdPriceInUSD; // mul by 1e18 so result is in 18 decimals
|
|
274
280
|
(uint256 minReceivedCUSD, ) = STATIC_ORACLE
|
|
275
|
-
.
|
|
281
|
+
.quoteAllAvailablePoolsWithTimePeriod(
|
|
276
282
|
uint128(gdToSell),
|
|
277
283
|
address(nativeToken()),
|
|
278
284
|
reserveToken,
|
|
279
|
-
fees,
|
|
280
285
|
60 //last 1 minute
|
|
281
286
|
);
|
|
282
287
|
|
|
283
|
-
(minReceived, ) = STATIC_ORACLE.
|
|
288
|
+
(minReceived, ) = STATIC_ORACLE.quoteAllAvailablePoolsWithTimePeriod(
|
|
284
289
|
uint128(minReceivedCUSD),
|
|
285
290
|
reserveToken,
|
|
286
291
|
gasToken,
|
|
287
|
-
fees,
|
|
288
292
|
60 //last 1 minute
|
|
289
293
|
);
|
|
290
294
|
}
|
|
@@ -294,15 +298,33 @@ contract GenericDistributionHelper is
|
|
|
294
298
|
uint256 amountToSell,
|
|
295
299
|
uint256 minReceived
|
|
296
300
|
) internal returns (uint256 nativeBought) {
|
|
301
|
+
address[] memory gdPools = STATIC_ORACLE.getAllPoolsForPair(
|
|
302
|
+
reserveToken,
|
|
303
|
+
address(nativeToken())
|
|
304
|
+
);
|
|
305
|
+
address[] memory gasPools = STATIC_ORACLE.getAllPoolsForPair(
|
|
306
|
+
reserveToken,
|
|
307
|
+
gasToken
|
|
308
|
+
);
|
|
309
|
+
uint24 gasFee = IUniswapV3Pool(gasPools[0]).fee();
|
|
310
|
+
uint24 gdFee = IUniswapV3Pool(gdPools[0]).fee();
|
|
311
|
+
for (uint i = 1; i < gasPools.length; i++) {
|
|
312
|
+
uint24 fee = IUniswapV3Pool(gasPools[i]).fee();
|
|
313
|
+
gasFee = gasFee < fee ? gasFee : fee;
|
|
314
|
+
}
|
|
315
|
+
for (uint i = 1; i < gdPools.length; i++) {
|
|
316
|
+
uint24 fee = IUniswapV3Pool(gdPools[i]).fee();
|
|
317
|
+
gdFee = gdFee < fee ? gdFee : fee;
|
|
318
|
+
}
|
|
297
319
|
ERC20(nativeToken()).approve(address(ROUTER), amountToSell);
|
|
298
320
|
uint256 amountOutMinimum = (minReceived * (100 - feeSettings.maxSlippage)) /
|
|
299
321
|
100; // 5% slippage
|
|
300
322
|
ISwapRouter.ExactInputParams memory params = ISwapRouter.ExactInputParams({
|
|
301
323
|
path: abi.encodePacked(
|
|
302
324
|
nativeToken(),
|
|
303
|
-
|
|
325
|
+
gdFee,
|
|
304
326
|
reserveToken,
|
|
305
|
-
|
|
327
|
+
gasFee,
|
|
306
328
|
gasToken
|
|
307
329
|
),
|
|
308
330
|
recipient: address(this),
|
|
@@ -280,4 +280,31 @@ contract AdminWallet is
|
|
|
280
280
|
(success, returnValue) = _contract.call{ value: _value }(_data);
|
|
281
281
|
emit GenericCall(_contract, _data, _value, success);
|
|
282
282
|
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* @dev perform a generic call to an arbitrary contract
|
|
286
|
+
* @param _contracts the contract's addresses to call
|
|
287
|
+
* @param _datas ABI-encoded contract call to call `_contract` address.
|
|
288
|
+
* @param _values value (ETH) to transfer with the transaction
|
|
289
|
+
* @return success success or fail
|
|
290
|
+
* bytes - the return bytes of the called contract's function.
|
|
291
|
+
*/
|
|
292
|
+
function genericCallBatch(
|
|
293
|
+
address[] memory _contracts,
|
|
294
|
+
bytes[] memory _datas,
|
|
295
|
+
uint256[] memory _values
|
|
296
|
+
)
|
|
297
|
+
public
|
|
298
|
+
onlyAdmin
|
|
299
|
+
reimburseGas
|
|
300
|
+
returns (bool success, bytes memory returnValue)
|
|
301
|
+
{
|
|
302
|
+
for (uint i = 0; i < _contracts.length; i++) {
|
|
303
|
+
// solhint-disable-next-line avoid-call-value
|
|
304
|
+
(success, returnValue) = _contracts[i].call{ value: _values[i] }(
|
|
305
|
+
_datas[i]
|
|
306
|
+
);
|
|
307
|
+
emit GenericCall(_contracts[i], _datas[i], _values[i], success);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
283
310
|
}
|
|
@@ -282,4 +282,31 @@ contract AdminWalletFuse is
|
|
|
282
282
|
(success, returnValue) = _contract.call{ value: _value }(_data);
|
|
283
283
|
emit GenericCall(_contract, _data, _value, success);
|
|
284
284
|
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* @dev perform a generic call to an arbitrary contract
|
|
288
|
+
* @param _contracts the contract's addresses to call
|
|
289
|
+
* @param _datas ABI-encoded contract call to call `_contract` address.
|
|
290
|
+
* @param _values value (ETH) to transfer with the transaction
|
|
291
|
+
* @return success success or fail
|
|
292
|
+
* bytes - the return bytes of the called contract's function.
|
|
293
|
+
*/
|
|
294
|
+
function genericCallBatch(
|
|
295
|
+
address[] memory _contracts,
|
|
296
|
+
bytes[] memory _datas,
|
|
297
|
+
uint256[] memory _values
|
|
298
|
+
)
|
|
299
|
+
public
|
|
300
|
+
onlyAdmin
|
|
301
|
+
reimburseGas
|
|
302
|
+
returns (bool success, bytes memory returnValue)
|
|
303
|
+
{
|
|
304
|
+
for (uint i = 0; i < _contracts.length; i++) {
|
|
305
|
+
// solhint-disable-next-line avoid-call-value
|
|
306
|
+
(success, returnValue) = _contracts[i].call{ value: _values[i] }(
|
|
307
|
+
_datas[i]
|
|
308
|
+
);
|
|
309
|
+
emit GenericCall(_contracts[i], _datas[i], _values[i], success);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
285
312
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.0;
|
|
3
|
+
|
|
4
|
+
import "../utils/NameService.sol";
|
|
5
|
+
import "../Interfaces.sol";
|
|
6
|
+
import "../MentoInterfaces.sol";
|
|
7
|
+
|
|
8
|
+
import "hardhat/console.sol";
|
|
9
|
+
|
|
10
|
+
interface MentoExchange {
|
|
11
|
+
function reserve() external view returns (address);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @notice set the new reserve ratio on Celo after xdc reserve deploy
|
|
16
|
+
*/
|
|
17
|
+
contract UpdateReserveRatioAfterXDC {
|
|
18
|
+
address owner;
|
|
19
|
+
|
|
20
|
+
constructor(address _owner) {
|
|
21
|
+
owner = _owner;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function upgrade(
|
|
25
|
+
Controller _controller,
|
|
26
|
+
address _mentoExchange,
|
|
27
|
+
bytes32 _exchangeId,
|
|
28
|
+
uint32 _reserveRatio
|
|
29
|
+
) external {
|
|
30
|
+
require(msg.sender == address(owner), "only owner can call this");
|
|
31
|
+
address avatar = IBancorExchangeProvider(_mentoExchange).AVATAR();
|
|
32
|
+
|
|
33
|
+
IBancorExchangeProvider.PoolExchange
|
|
34
|
+
memory _exchange = IBancorExchangeProvider(_mentoExchange)
|
|
35
|
+
.getPoolExchange(_exchangeId);
|
|
36
|
+
|
|
37
|
+
_exchange.reserveRatio = _reserveRatio;
|
|
38
|
+
|
|
39
|
+
// first destory existing exchange
|
|
40
|
+
(bool ok, bytes memory result) = _controller.genericCall(
|
|
41
|
+
address(_mentoExchange),
|
|
42
|
+
abi.encodeCall(IBancorExchangeProvider.destroyExchange, (_exchangeId, 0)),
|
|
43
|
+
address(avatar),
|
|
44
|
+
0
|
|
45
|
+
);
|
|
46
|
+
require(ok, "destroyExchange failed");
|
|
47
|
+
|
|
48
|
+
(ok, result) = _controller.genericCall(
|
|
49
|
+
address(_mentoExchange),
|
|
50
|
+
abi.encodeCall(IBancorExchangeProvider.createExchange, _exchange),
|
|
51
|
+
address(avatar),
|
|
52
|
+
0
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
require(ok, "createExchange failed");
|
|
56
|
+
bytes32 exchangeId = abi.decode(result, (bytes32));
|
|
57
|
+
require(exchangeId == _exchangeId, "not same exchange id");
|
|
58
|
+
console.logBytes32(exchangeId);
|
|
59
|
+
|
|
60
|
+
// prevent executing again
|
|
61
|
+
require(_controller.unregisterSelf(avatar), "unregistering failed");
|
|
62
|
+
owner = address(0);
|
|
63
|
+
}
|
|
64
|
+
}
|
package/hardhat.config.ts
CHANGED
|
@@ -23,10 +23,13 @@ import { sumStakersGdRewards } from "./scripts/staking/stakersGdRewardsCalculati
|
|
|
23
23
|
import { verify } from "./scripts/verify";
|
|
24
24
|
import { ethers } from "ethers";
|
|
25
25
|
import { fstat, readFileSync, writeFileSync } from "fs";
|
|
26
|
+
import * as envEnc from "@chainlink/env-enc";
|
|
27
|
+
envEnc.config();
|
|
28
|
+
|
|
26
29
|
config();
|
|
27
30
|
|
|
28
31
|
const mnemonic = process.env.MNEMONIC || "test test test test test test test test test test test junk";
|
|
29
|
-
const deployerPrivateKey = process.env.
|
|
32
|
+
const deployerPrivateKey = process.env.ADMIN_KEY || ethers.utils.hexZeroPad("0x11", 32);
|
|
30
33
|
const infura_api = process.env.INFURA_API;
|
|
31
34
|
const alchemy_key = process.env.ALCHEMY_KEY;
|
|
32
35
|
const etherscan_key = process.env.ETHERSCAN_KEY;
|
|
@@ -38,7 +41,7 @@ const MAINNET_URL = "https://mainnet.infura.io/v3/" + infura_api;
|
|
|
38
41
|
|
|
39
42
|
const xdc = {
|
|
40
43
|
accounts: { mnemonic },
|
|
41
|
-
url: "https://rpc.xdc.
|
|
44
|
+
url: "https://rpc.xdc.org",
|
|
42
45
|
gas: 3000000,
|
|
43
46
|
gasPrice: 12.5e9,
|
|
44
47
|
chainId: 50
|
|
@@ -62,15 +65,7 @@ const hhconfig: HardhatUserConfig = {
|
|
|
62
65
|
enabled: true
|
|
63
66
|
},
|
|
64
67
|
etherscan: {
|
|
65
|
-
apiKey:
|
|
66
|
-
mainnet: etherscan_key,
|
|
67
|
-
txdc: etherscan_key,
|
|
68
|
-
xdc: etherscan_key,
|
|
69
|
-
celo: etherscan_key,
|
|
70
|
-
alfajores: celoscan_key,
|
|
71
|
-
base: basescan_key,
|
|
72
|
-
fuse: etherscan_key
|
|
73
|
-
},
|
|
68
|
+
apiKey: etherscan_key,
|
|
74
69
|
customChains: [
|
|
75
70
|
{
|
|
76
71
|
network: "fuse",
|
|
@@ -130,7 +125,8 @@ const hhconfig: HardhatUserConfig = {
|
|
|
130
125
|
initialDate: "2021-12-01", //required for DAO tests like guardian
|
|
131
126
|
forking: process.env.FORK_CHAIN_ID && {
|
|
132
127
|
url: "https://eth-mainnet.alchemyapi.io/v2/" + process.env.ALCHEMY_KEY
|
|
133
|
-
}
|
|
128
|
+
},
|
|
129
|
+
blockGasLimit: 100000000429720,
|
|
134
130
|
},
|
|
135
131
|
fork: {
|
|
136
132
|
chainId: 1,
|
|
@@ -152,6 +148,7 @@ const hhconfig: HardhatUserConfig = {
|
|
|
152
148
|
},
|
|
153
149
|
dapptest: {
|
|
154
150
|
gasPrice: 1000000000, //1 gwei
|
|
151
|
+
blockGasLimit: 100000000429720,
|
|
155
152
|
url: "http://127.0.0.1:8545/"
|
|
156
153
|
},
|
|
157
154
|
"dapptest-mainnet": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddollar/goodprotocol",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "GoodDollar Protocol",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16.x"
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
"@babel/preset-env": "*",
|
|
67
67
|
"@babel/register": "*",
|
|
68
68
|
"@celo-tools/celo-ethers-wrapper": "^0.4.0",
|
|
69
|
+
"@chainlink/env-enc": "^1.0.5",
|
|
69
70
|
"@gnosis.pm/safe-core-sdk": "^3.2.0",
|
|
70
71
|
"@gnosis.pm/safe-core-sdk-types": "^1.7.0",
|
|
71
72
|
"@gnosis.pm/safe-ethers-lib": "^1.7.0",
|
|
@@ -82,7 +83,7 @@
|
|
|
82
83
|
"@openzeppelin/contracts": "^4.8.0",
|
|
83
84
|
"@openzeppelin/contracts-upgradeable": "^4.8.0",
|
|
84
85
|
"@openzeppelin/hardhat-upgrades": "^1.22.1",
|
|
85
|
-
"@safe-global/api-kit": "^
|
|
86
|
+
"@safe-global/api-kit": "^4.0.0",
|
|
86
87
|
"@safe-global/protocol-kit": "^6.0.2",
|
|
87
88
|
"@safe-global/types-kit": "^2.0.1",
|
|
88
89
|
"@superfluid-finance/ethereum-contracts": "1.8.1",
|
package/releases/deployment.json
CHANGED
|
@@ -669,6 +669,7 @@
|
|
|
669
669
|
"MentoProxyAdmin": "0x54f44fBE2943c2196D94831288E716cdeAF5657"
|
|
670
670
|
},
|
|
671
671
|
"production-xdc": {
|
|
672
|
+
"networkId": 50,
|
|
672
673
|
"ProxyFactory": "0x5BE34022c26FA03a8d6926314a42414c7ca2dF51",
|
|
673
674
|
"GuardiansSafe": "0xE0c5daa7CC6F88d29505f702a53bb5E67600e7Ec",
|
|
674
675
|
"CUSD": "0xfA2958CB79b0491CC627c1557F441eF849Ca8eb1",
|
|
@@ -683,6 +684,8 @@
|
|
|
683
684
|
"AdminWallet": "0x66fc1bE551f752706130b6f54d84141F8c2Ae8Bb",
|
|
684
685
|
"Faucet": "0x7344Da1Be296f03fbb8082aDaC5696058B5a9bd9",
|
|
685
686
|
"Invites": "0x6bd698566632bf2e81e2278f1656CB24aAF06D2e",
|
|
686
|
-
"UBIScheme": "0x22867567E2D80f2049200E25C6F31CB6Ec2F0faf"
|
|
687
|
+
"UBIScheme": "0x22867567E2D80f2049200E25C6F31CB6Ec2F0faf",
|
|
688
|
+
"MpbBridge": "0xa3247276DbCC76Dd7705273f766eB3E8a5ecF4a5",
|
|
689
|
+
"BulkWhitelist": "0xe8861A20452Db53dF685F1d9e6B7017de3DB0E46"
|
|
687
690
|
}
|
|
688
691
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import farmed from "../farming.json";
|
|
2
|
+
import { ethers, network } from "hardhat";
|
|
3
|
+
import { chunk } from "lodash";
|
|
4
|
+
import contracts from "../releases/deployment.json";
|
|
5
|
+
import { bulkIsWhitelisted } from "./utils";
|
|
6
|
+
const main = async () => {
|
|
7
|
+
const signer = (await ethers.getSigners())[0];
|
|
8
|
+
|
|
9
|
+
console.log("signer", signer.address);
|
|
10
|
+
const whitelist = await ethers.getContractAt("BulkWhitelist", contracts[network.name].BulkWhitelist);
|
|
11
|
+
const chunks = chunk(farmed, 300);
|
|
12
|
+
for (let batch of chunks) {
|
|
13
|
+
console.log("whitelisting batch of", batch.length, batch[0], batch[batch.length - 1]);
|
|
14
|
+
const res = await (await whitelist.connect(signer).removeWhitelisted(batch, { gasLimit: 25000000 })).wait();
|
|
15
|
+
console.log("tx:", res.transactionHash);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const checkReVerified = async () => {
|
|
20
|
+
const chunks = chunk(farmed, 300);
|
|
21
|
+
let total = 0;
|
|
22
|
+
for (let batch of chunks) {
|
|
23
|
+
console.log("check whitelisting batch of", batch.length, batch[0], batch[batch.length - 1]);
|
|
24
|
+
const res = await bulkIsWhitelisted(batch);
|
|
25
|
+
console.log(`${res.length}/${batch.length}`);
|
|
26
|
+
total += res.length;
|
|
27
|
+
}
|
|
28
|
+
console.log(`total: ${total}/${farmed.length}`);
|
|
29
|
+
};
|
|
30
|
+
checkReVerified();
|
|
31
|
+
// main().catch(console.log);
|
|
@@ -5,7 +5,7 @@ import { TransactionResponse, TransactionReceipt } from "@ethersproject/provider
|
|
|
5
5
|
import { getImplementationAddress } from "@openzeppelin/upgrades-core";
|
|
6
6
|
|
|
7
7
|
import SafeApiKit from "@safe-global/api-kit";
|
|
8
|
-
import Safe from "@safe-global/protocol-kit";
|
|
8
|
+
import Safe, { SafeTransactionOptionalProps } from "@safe-global/protocol-kit";
|
|
9
9
|
import { MetaTransactionData } from "@safe-global/types-kit";
|
|
10
10
|
|
|
11
11
|
import util from "util";
|
|
@@ -357,6 +357,7 @@ export const executeViaSafe = async (
|
|
|
357
357
|
functionInputs,
|
|
358
358
|
safeAddress: string,
|
|
359
359
|
safeSignerOrNetwork?: Signer | string,
|
|
360
|
+
safeOptions: SafeTransactionOptionalProps = {},
|
|
360
361
|
isSimulation = false
|
|
361
362
|
) => {
|
|
362
363
|
if (typeof safeSignerOrNetwork !== "object" && !process.env.SAFEOWNER_PRIVATE_KEY) {
|
|
@@ -368,7 +369,7 @@ export const executeViaSafe = async (
|
|
|
368
369
|
// new ethers.providers.JsonRpcProvider("https://rpc.flashbots.net")
|
|
369
370
|
// );
|
|
370
371
|
let chainId = 1;
|
|
371
|
-
let provider = "https://mainnet.
|
|
372
|
+
let provider = "https://mainnet.gateway.tenderly.co";
|
|
372
373
|
if (typeof safeSignerOrNetwork === "string") {
|
|
373
374
|
switch (safeSignerOrNetwork) {
|
|
374
375
|
case "mainnet":
|
|
@@ -387,6 +388,10 @@ export const executeViaSafe = async (
|
|
|
387
388
|
// new ethers.providers.JsonRpcProvider("https://rpc.fuse.io")
|
|
388
389
|
// );
|
|
389
390
|
break;
|
|
391
|
+
case "xdc":
|
|
392
|
+
chainId = 50;
|
|
393
|
+
provider = "https://rpc.xdcrpc.com";
|
|
394
|
+
break;
|
|
390
395
|
}
|
|
391
396
|
} else if (safeSignerOrNetwork) {
|
|
392
397
|
// safeSigner = safeSignerOrNetwork as any;
|
|
@@ -396,18 +401,20 @@ export const executeViaSafe = async (
|
|
|
396
401
|
let txServiceUrl;
|
|
397
402
|
switch (chainId) {
|
|
398
403
|
case 1:
|
|
399
|
-
txServiceUrl = "https://safe-transaction-mainnet.safe.global";
|
|
404
|
+
// txServiceUrl = "https://safe-transaction-mainnet.safe.global";
|
|
400
405
|
break;
|
|
401
406
|
case 122:
|
|
402
|
-
txServiceUrl = "https://transaction-fuse.safe.fuse.io";
|
|
407
|
+
txServiceUrl = "https://transaction-fuse.safe.fuse.io/api";
|
|
403
408
|
break;
|
|
404
409
|
case 42220:
|
|
405
|
-
txServiceUrl = "https://safe-transaction-celo.safe.global";
|
|
410
|
+
// txServiceUrl = "https://safe-transaction-celo.safe.global";
|
|
406
411
|
break;
|
|
407
412
|
}
|
|
408
413
|
console.log("creating safe adapter", { txServiceUrl });
|
|
409
414
|
const safeService = new SafeApiKit({
|
|
410
|
-
chainId: BigInt(chainId)
|
|
415
|
+
chainId: BigInt(chainId),
|
|
416
|
+
txServiceUrl,
|
|
417
|
+
apiKey: process.env.SAFE_TX_SERVICE_API_KEY || ""
|
|
411
418
|
});
|
|
412
419
|
|
|
413
420
|
const safeSdk = await Safe.init({
|