Skip to content

Commit 4f9af22

Browse files
authored
Update airdrop transfer (#437)
* remove gas limit for airdrop transfers * update test * fix * fix * docs * v3.6.3-0 * remove gas griefing test * update forge * remove tests * fix * docs * v3.8.4-1 * release script
1 parent 2bb75ad commit 4f9af22

38 files changed

+5678
-1956
lines changed

contracts/airdrop/AirdropERC1155.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ contract AirdropERC1155 is
100100

101101
for (uint256 i = 0; i < len; ) {
102102
try
103-
IERC1155(_tokenAddress).safeTransferFrom{ gas: 80_000 }(
103+
IERC1155(_tokenAddress).safeTransferFrom(
104104
_tokenOwner,
105105
_contents[i].recipient,
106106
_contents[i].tokenId,

contracts/airdrop/AirdropERC20.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ contract AirdropERC20 is
155155
if (_currency == CurrencyTransferLib.NATIVE_TOKEN) {
156156
// solhint-disable avoid-low-level-calls
157157
// slither-disable-next-line low-level-calls
158-
(success, ) = _to.call{ value: _amount, gas: 80_000 }("");
158+
(success, ) = _to.call{ value: _amount }("");
159159
} else {
160160
(bool success_, bytes memory data_) = _currency.call(
161161
abi.encodeWithSelector(IERC20.transferFrom.selector, _from, _to, _amount)

contracts/airdrop/AirdropERC721.sol

+1-5
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,7 @@ contract AirdropERC721 is
100100

101101
for (uint256 i = 0; i < len; ) {
102102
try
103-
IERC721(_tokenAddress).safeTransferFrom{ gas: 80_000 }(
104-
_tokenOwner,
105-
_contents[i].recipient,
106-
_contents[i].tokenId
107-
)
103+
IERC721(_tokenAddress).safeTransferFrom(_tokenOwner, _contents[i].recipient, _contents[i].tokenId)
108104
{} catch {
109105
// revert if failure is due to unapproved tokens
110106
require(

contracts/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@thirdweb-dev/contracts",
33
"description": "Collection of smart contracts deployable via the thirdweb SDK, dashboard and CLI",
4-
"version": "3.8.2",
4+
"version": "3.8.4-1",
55
"license": "Apache-2.0",
66
"repository": {
77
"type": "git",

docs/ERC721AQueryableInit.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# ERC721AQueryableInit
2+
3+
4+
5+
6+
7+
8+
9+
10+
11+
12+

docs/EditionStake.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ function indexedTokens(uint256) external view returns (uint256)
408408
### initialize
409409

410410
```solidity
411-
function initialize(address _defaultAdmin, string _contractURI, address[] _trustedForwarders, address _rewardToken, address _stakingToken, uint256 _defaultTimeUnit, uint256 _defaultRewardsPerUnitTime) external nonpayable
411+
function initialize(address _defaultAdmin, string _contractURI, address[] _trustedForwarders, address _rewardToken, address _stakingToken, uint80 _defaultTimeUnit, uint256 _defaultRewardsPerUnitTime) external nonpayable
412412
```
413413

414414

@@ -424,7 +424,7 @@ function initialize(address _defaultAdmin, string _contractURI, address[] _trust
424424
| _trustedForwarders | address[] | undefined |
425425
| _rewardToken | address | undefined |
426426
| _stakingToken | address | undefined |
427-
| _defaultTimeUnit | uint256 | undefined |
427+
| _defaultTimeUnit | uint80 | undefined |
428428
| _defaultRewardsPerUnitTime | uint256 | undefined |
429429

430430
### isIndexed
@@ -522,7 +522,7 @@ function onERC1155BatchReceived(address operator, address from, uint256[] ids, u
522522
### onERC1155Received
523523

524524
```solidity
525-
function onERC1155Received(address, address, uint256, uint256, bytes) external nonpayable returns (bytes4)
525+
function onERC1155Received(address, address, uint256, uint256, bytes) external view returns (bytes4)
526526
```
527527

528528

@@ -631,7 +631,7 @@ Set rewards per unit of time. Interpreted as x rewards per second/per
631631
### setDefaultTimeUnit
632632

633633
```solidity
634-
function setDefaultTimeUnit(uint256 _defaultTimeUnit) external nonpayable
634+
function setDefaultTimeUnit(uint80 _defaultTimeUnit) external nonpayable
635635
```
636636

637637
Set time unit. Set as a number of seconds. Could be specified as -- x * 1 hours, x * 1 days, etc.
@@ -642,7 +642,7 @@ Set time unit. Set as a number of seconds. Could be specified as -- x
642642

643643
| Name | Type | Description |
644644
|---|---|---|
645-
| _defaultTimeUnit | uint256 | New time unit. |
645+
| _defaultTimeUnit | uint80 | New time unit. |
646646

647647
### setRewardsPerUnitTime
648648

@@ -664,7 +664,7 @@ Set rewards per unit of time. Interpreted as x rewards per second/per
664664
### setTimeUnit
665665

666666
```solidity
667-
function setTimeUnit(uint256 _tokenId, uint256 _timeUnit) external nonpayable
667+
function setTimeUnit(uint256 _tokenId, uint80 _timeUnit) external nonpayable
668668
```
669669

670670
Set time unit. Set as a number of seconds. Could be specified as -- x * 1 hours, x * 1 days, etc.
@@ -676,12 +676,12 @@ Set time unit. Set as a number of seconds. Could be specified as -- x
676676
| Name | Type | Description |
677677
|---|---|---|
678678
| _tokenId | uint256 | ERC1155 token Id. |
679-
| _timeUnit | uint256 | New time unit. |
679+
| _timeUnit | uint80 | New time unit. |
680680

681681
### stake
682682

683683
```solidity
684-
function stake(uint256 _tokenId, uint256 _amount) external nonpayable
684+
function stake(uint256 _tokenId, uint64 _amount) external nonpayable
685685
```
686686

687687
Stake ERC721 Tokens.
@@ -693,12 +693,12 @@ Stake ERC721 Tokens.
693693
| Name | Type | Description |
694694
|---|---|---|
695695
| _tokenId | uint256 | ERC1155 token-id to stake. |
696-
| _amount | uint256 | Amount to stake. |
696+
| _amount | uint64 | Amount to stake. |
697697

698698
### stakers
699699

700700
```solidity
701-
function stakers(uint256, address) external view returns (uint256 amountStaked, uint256 timeOfLastUpdate, uint256 unclaimedRewards, uint256 conditionIdOflastUpdate)
701+
function stakers(uint256, address) external view returns (uint64 conditionIdOflastUpdate, uint64 amountStaked, uint128 timeOfLastUpdate, uint256 unclaimedRewards)
702702
```
703703

704704

@@ -716,10 +716,10 @@ function stakers(uint256, address) external view returns (uint256 amountStaked,
716716

717717
| Name | Type | Description |
718718
|---|---|---|
719-
| amountStaked | uint256 | undefined |
720-
| timeOfLastUpdate | uint256 | undefined |
719+
| conditionIdOflastUpdate | uint64 | undefined |
720+
| amountStaked | uint64 | undefined |
721+
| timeOfLastUpdate | uint128 | undefined |
721722
| unclaimedRewards | uint256 | undefined |
722-
| conditionIdOflastUpdate | uint256 | undefined |
723723

724724
### stakersArray
725725

@@ -786,7 +786,7 @@ function supportsInterface(bytes4 interfaceId) external view returns (bool)
786786
### withdraw
787787

788788
```solidity
789-
function withdraw(uint256 _tokenId, uint256 _amount) external nonpayable
789+
function withdraw(uint256 _tokenId, uint64 _amount) external nonpayable
790790
```
791791

792792
Withdraw staked tokens.
@@ -798,7 +798,7 @@ Withdraw staked tokens.
798798
| Name | Type | Description |
799799
|---|---|---|
800800
| _tokenId | uint256 | ERC1155 token-id to withdraw. |
801-
| _amount | uint256 | Amount to withdraw. |
801+
| _amount | uint64 | Amount to withdraw. |
802802

803803
### withdrawRewardTokens
804804

0 commit comments

Comments
 (0)