Skip to content

Commit 8002410

Browse files
Transpile 994399d3c
1 parent bc66b30 commit 8002410

File tree

7 files changed

+24
-13
lines changed

7 files changed

+24
-13
lines changed

contracts/governance/extensions/GovernorVotesSuperQuorumFractionUpgradeable.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ abstract contract GovernorVotesSuperQuorumFractionUpgradeable is Initializable,
8080

8181
/**
8282
* @dev Returns the super quorum for a `timepoint`, in terms of number of votes: `supply * numerator / denominator`.
83+
* See {GovernorSuperQuorum-superQuorum} for more details.
8384
*/
8485
function superQuorum(uint256 timepoint) public view virtual override returns (uint256) {
8586
return Math.mulDiv(token().getPastTotalSupply(timepoint), superQuorumNumerator(timepoint), quorumDenominator());

contracts/mocks/AuthorityMockUpgradeable.sol

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ contract NotAuthorityMockUpgradeable is Initializable, IAuthority {
1818
}
1919

2020
contract AuthorityNoDelayMockUpgradeable is Initializable, IAuthority {
21-
bool _immediate;
21+
bool private _immediate;
2222

2323
function __AuthorityNoDelayMock_init() internal onlyInitializing {
2424
}
@@ -39,8 +39,8 @@ contract AuthorityNoDelayMockUpgradeable is Initializable, IAuthority {
3939
}
4040

4141
contract AuthorityDelayMockUpgradeable is Initializable {
42-
bool _immediate;
43-
uint32 _delay;
42+
bool private _immediate;
43+
uint256 private _delay;
4444

4545
function __AuthorityDelayMock_init() internal onlyInitializing {
4646
}
@@ -51,15 +51,15 @@ contract AuthorityDelayMockUpgradeable is Initializable {
5151
address /* caller */,
5252
address /* target */,
5353
bytes4 /* selector */
54-
) external view returns (bool immediate, uint32 delay) {
54+
) external view returns (bool immediate, uint256 delay) {
5555
return (_immediate, _delay);
5656
}
5757

5858
function _setImmediate(bool immediate) external {
5959
_immediate = immediate;
6060
}
6161

62-
function _setDelay(uint32 delay) external {
62+
function _setDelay(uint256 delay) external {
6363
_delay = delay;
6464
}
6565
}

contracts/token/ERC6909/draft-ERC6909Upgradeable.sol

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ contract ERC6909Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradea
101101

102102
/**
103103
* @dev Creates `amount` of token `id` and assigns them to `account`, by transferring it from address(0).
104-
* Relies on the `_update` mechanism
104+
* Relies on the `_update` mechanism.
105105
*
106106
* Emits a {Transfer} event with `from` set to the zero address.
107107
*
@@ -115,10 +115,9 @@ contract ERC6909Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradea
115115
}
116116

117117
/**
118-
* @dev Moves `amount` of token `id` from `from` to `to` without checking for approvals.
119-
*
120-
* This internal function is equivalent to {transfer}, and can be used to
121-
* e.g. implement automatic token fees, slashing mechanisms, etc.
118+
* @dev Moves `amount` of token `id` from `from` to `to` without checking for approvals. This function verifies
119+
* that neither the sender nor the receiver are address(0), which means it cannot mint or burn tokens.
120+
* Relies on the `_update` mechanism.
122121
*
123122
* Emits a {Transfer} event.
124123
*

contracts/token/ERC6909/extensions/draft-ERC6909TokenSupplyUpgradeable.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ contract ERC6909TokenSupplyUpgradeable is Initializable, ERC6909Upgradeable, IER
4646
}
4747
if (to == address(0)) {
4848
unchecked {
49-
// amount <= _balances[id][from] <= _totalSupplies[id]
49+
// amount <= _balances[from][id] <= _totalSupplies[id]
5050
$._totalSupplies[id] -= amount;
5151
}
5252
}

test/access/manager/AuthorityUtils.test.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ const { ethers } = require('hardhat');
22
const { expect } = require('chai');
33
const { loadFixture } = require('@nomicfoundation/hardhat-network-helpers');
44

5+
const { MAX_UINT32, MAX_UINT64 } = require('../../helpers/constants');
6+
57
async function fixture() {
68
const [user, other] = await ethers.getSigners();
79

@@ -70,7 +72,7 @@ describe('AuthorityUtils', function () {
7072
});
7173

7274
for (const immediate of [true, false]) {
73-
for (const delay of [0n, 42n]) {
75+
for (const delay of [0n, 42n, MAX_UINT32]) {
7476
it(`returns (immediate=${immediate}, delay=${delay})`, async function () {
7577
await this.authority._setImmediate(immediate);
7678
await this.authority._setDelay(delay);
@@ -80,6 +82,14 @@ describe('AuthorityUtils', function () {
8082
});
8183
}
8284
}
85+
86+
it('out of bound delay', async function () {
87+
await this.authority._setImmediate(false);
88+
await this.authority._setDelay(MAX_UINT64); // bigger than the expected uint32
89+
const result = await this.mock.$canCallWithDelay(this.authority, this.user, this.other, '0x12345678');
90+
expect(result.immediate).to.equal(false);
91+
expect(result.delay).to.equal(0n);
92+
});
8393
});
8494

8595
describe('when authority replies with empty data', function () {

test/helpers/constants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module.exports = {
2+
MAX_UINT32: 2n ** 32n - 1n,
23
MAX_UINT48: 2n ** 48n - 1n,
34
MAX_UINT64: 2n ** 64n - 1n,
45
};

0 commit comments

Comments
 (0)