Skip to content

Commit

Permalink
Merge pull request #703 from oceanprotocol/feature/ve_batch_allocate
Browse files Browse the repository at this point in the history
add setBatchAllocation to veAllocate.sol
  • Loading branch information
alexcos20 committed Sep 5, 2022
2 parents 74db55e + f48b042 commit 8f2bd1c
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = v1.1.2
current_version = v1.1.3
commit = True
tag = True

Expand Down
56 changes: 28 additions & 28 deletions addresses/address.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
},
"Dispenser": "0xCdbdDFeac752EC993e14bF07424D324B6B6959F2",
"ERC721Factory": "0x465069D3d6Ec45CDB006ec3E22cC9E8d6f9793eF",
"veAllocate": "0x328CF3f4843d469B0f4f1f35b4c0678411b9029C",
"veOCEAN": "0xf984d5fB2cB1fD62f64Df9D3e5da084f4F337C0c",
"veDelegation": "0x56f50fB3e8c718C3B2D853D88A0438BFd7271851",
"veFeeDistributor": "0x369AFe63286606a4C0b1D08d99F27826fDB5B5da",
"veDelegationProxy": "0x2f5DA63553b0926e830840BE17FBdc98f98036Bc",
"DFRewards": "0xFc677A722e6532fF9982666Ae8E3D6245745F460",
"DFStrategyV1": "0x2d2d4681F9A8bad9A9E4656c6c8F70976825e858"
"veAllocate": "0xbB7E22Ed79563daDb33BeDc16080DF02B62a1CE4",
"veOCEAN": "0x57cD87bb197B74Df44Fd69177c0550B9a0C04619",
"veDelegation": "0x15A278BaabC9EE66737562E35B3a42F77a48Fa79",
"veFeeDistributor": "0xB99BAA8D5b131c9140Be2F13EA6D2494DF272919",
"veDelegationProxy": "0x7b886fa12a9b11BD0cb83e79398070CD635BcBdF",
"DFRewards": "0xD09BCDC099D635A0D8A7f003DC01F645382B6700",
"DFStrategyV1": "0x2Fe41338f11d7402E31A4b902F60077164C65a52"
},
"mumbai": {
"chainId": 80001,
Expand All @@ -43,13 +43,13 @@
},
"Dispenser": "0x21bc18b92F7551e715B490E2C2875E8532317F8d",
"ERC721Factory": "0x7d46d74023507D30ccc2d3868129fbE4e400e40B",
"veAllocate": "0x0c86faF54E6B90c643ef330F118A856b34e0e7F7",
"veOCEAN": "0x51a1d099C86e4bdb827cfD7f318C5c8aCe621820",
"veDelegation": "0x5E4d6b1cDf5b0562C7aa327dcA86977e9028cECC",
"veFeeDistributor": "0xd17FA658C741b9b42bBFB5Ff9dc222a04F5Fe2Ca",
"veDelegationProxy": "0x81c769e115f1EB6900428e91a104763dECB6Cd66",
"DFRewards": "0x4270c2DEbED08b2e55dFF9eC322896D09f28942B",
"DFStrategyV1": "0x15fF19b08E1E04179c558402FE9665C80348b2fD"
"veAllocate": "0x3fa1d5AC45ab1Ff9CFAe227c5583Ec0484b54Ef9",
"veOCEAN": "0x061955B6980A34fce74b235f90DBe20d76f087b1",
"veDelegation": "0x96E3aE4247a01C3d40a261df1F8ead70E32E7C0c",
"veFeeDistributor": "0x35F1e6765750E874EB9d0675393A1A394A4749b4",
"veDelegationProxy": "0x51B1b14b8bfb43a2fB0b49843787Ca440200F6b7",
"DFRewards": "0x4259c164eedA7483dda2b4b622D761A88674D31f",
"DFStrategyV1": "0x1be9C72500B41c286C797D4FE727747Ae9C4E195"
},
"ropsten": {
"chainId": 3,
Expand All @@ -69,13 +69,13 @@
},
"Dispenser": "0x660B3832e940E4bb4FfbDAA0aAB9E9B8D524C7Ef",
"ERC721Factory": "0xB0F8c68eF94ACB8E976b1dED6351Cc62e383d253",
"veAllocate": "0xd17FA658C741b9b42bBFB5Ff9dc222a04F5Fe2Ca",
"veOCEAN": "0x81c769e115f1EB6900428e91a104763dECB6Cd66",
"veDelegation": "0x4270c2DEbED08b2e55dFF9eC322896D09f28942B",
"veFeeDistributor": "0x15fF19b08E1E04179c558402FE9665C80348b2fD",
"veDelegationProxy": "0x74c3017384F4Bc4B696EEDf49f0a12AA7EE5E90B",
"DFRewards": "0x375d3Fc56d812B3f79b61bC96694d6A196C5f0D9",
"DFStrategyV1": "0x3fa1d5AC45ab1Ff9CFAe227c5583Ec0484b54Ef9"
"veAllocate": "0x35F1e6765750E874EB9d0675393A1A394A4749b4",
"veOCEAN": "0x51B1b14b8bfb43a2fB0b49843787Ca440200F6b7",
"veDelegation": "0x4259c164eedA7483dda2b4b622D761A88674D31f",
"veFeeDistributor": "0x1be9C72500B41c286C797D4FE727747Ae9C4E195",
"veDelegationProxy": "0xDD6b48CcDFdaa84F868aA18418236e52c2eA26A6",
"DFRewards": "0x409AA28a9815fcBFc7e5489c3DA45c84b2f36721",
"DFStrategyV1": "0xCFeF55c6ae4d250586e293f29832967a04A9087d"
},
"moonbase": {
"chainId": 1287,
Expand Down Expand Up @@ -218,13 +218,13 @@
},
"Dispenser": "0xFe7967A5176fDAFa8DE109b3507016B885a82D6e",
"ERC721Factory": "0xe8c6Dc39602031A152440311e364818ba25C2Bc1",
"veAllocate": "0x8bA04715B1b210f710426b21A29887EEd4EA6751",
"veOCEAN": "0x1706DF1f2d93558D1d77bEd49ccdB8B88fAfC306",
"veDelegation": "0x45dA5988d4fEAEdc5Ee60FC83eA7Caa8Fb485883",
"veFeeDistributor": "0xA8513c0457AfaD54a57664Ba5C742c24f1D624be",
"veDelegationProxy": "0xDB55DCBbAC940aCb5c28817802f17A48B15d558b",
"DFRewards": "0x042BFbd88c3998282153088604207b2AeF045b43",
"DFStrategyV1": "0xbFBc7A21133B4e0e54a182BE8d4337A5e036A615"
"veAllocate": "0x3EFDD8f728c8e774aB81D14d0B2F07a8238960f4",
"veOCEAN": "0x8B8E187CF9c551e63f54AA04E21F48CDAF2296aE",
"veDelegation": "0xE282492d50879b911844fA6dD87aAD6169963fC6",
"veFeeDistributor": "0xd09789Ce05aa0f6feFc18315de4964Db07Cc0618",
"veDelegationProxy": "0x257fe2e49530A4B7FC3Ed597465e2931db3f20b7",
"DFRewards": "0x6fd867E5AEE6D62a24f97939db90C4e67A73A651",
"DFStrategyV1": "0x1Af3CC30fD18af837f7630Aff12aE2b826bD3c5D"
},
"polygonedge": {
"chainId": 81001,
Expand Down
26 changes: 26 additions & 0 deletions contracts/ve/veAllocate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ contract veAllocate {
uint256 amount
);

event AllocationSetMultiple(
address indexed sender,
address[] nft,
uint256[] chainId,
uint256[] amount
);

function getveAllocation(
address user,
address nft,
Expand Down Expand Up @@ -45,4 +52,23 @@ contract veAllocate {
veAllocation[msg.sender][nft][chainId] = amount;
emit AllocationSet(msg.sender, nft, chainId, amount);
}

function setBatchAllocation(
uint256[] calldata amount,
address[] calldata nft,
uint256[] calldata chainId
) external {
require(amount.length <= 150, 'Too Many Operations');
require(amount.length == nft.length, 'Nft array size missmatch');
require(amount.length == chainId.length, 'Chain array size missmatch');
for (uint256 i = 0; i < amount.length; i++) {
_totalAllocation[msg.sender] =
_totalAllocation[msg.sender] +
amount[i] -
veAllocation[msg.sender][nft[i]][chainId[i]];
veAllocation[msg.sender][nft[i]][chainId[i]] = amount[i];
}
require(_totalAllocation[msg.sender] <= 10000, "Max Allocation");
emit AllocationSetMultiple(msg.sender, nft, chainId, amount);
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oceanprotocol/contracts",
"version": "v1.1.2",
"version": "v1.1.3",
"description": "Ocean Protocol Smartcontracts",
"bugs": {
"url": "https://github.com/oceanprotocol/contracts/issues"
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = ocean-contracts
version = v1.1.2
version = v1.1.3
author = leucothia
author_email = devops@oceanprotocol.com
description = 🐳 Ocean Protocol L1 - v4
Expand Down

0 comments on commit 8f2bd1c

Please sign in to comment.