Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export SONEIUM_TESTNET_VERIFIER_URL="https://soneium-minato.blockscout.com/api"

# Seismic
# Verifier URL must be the FULL socialscan command_api path, not the bare host.
export SEISMIC_TESTNET_RPC_URL=https://testnet-1.seismictest.net/rpc
export SEISMIC_TESTNET_RPC_URL=https://testnet-2.seismictest.net/rpc
export SEISMIC_TESTNET_VERIFIER_URL=https://api.socialscan.io/seismic-testnet/v1/explorer/command_api/contract
# Set when Seismic mainnet is live (deploy targets fail closed until then).
# export SEISMIC_MAINNET_RPC_URL=
Expand Down
20 changes: 0 additions & 20 deletions audits/README.md

This file was deleted.

2 changes: 1 addition & 1 deletion lib/common
6 changes: 5 additions & 1 deletion script/Config.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ contract Config {
address freezeManager;
address yieldRecipientManager;
address pauser;
address allowlistAdmin;
}

struct YieldToOneForcedTransferConfig {
Expand All @@ -43,6 +44,7 @@ contract Config {
address yieldRecipientManager;
address pauser;
address forcedTransferManager;
address allowlistAdmin;
}

struct JMIExtensionConfig {
Expand All @@ -55,6 +57,7 @@ contract Config {
address freezeManager;
address pauser;
address yieldRecipientManager;
address allowlistAdmin;
}

struct YieldToAllWithFeeConfig {
Expand Down Expand Up @@ -97,7 +100,8 @@ contract Config {
uint256 public constant BASE_SEPOLIA_CHAIN_ID = 84532;
uint256 public constant SEISMIC_TESTNET_CHAIN_ID = 5124;

address public constant DEPLOYER = 0x12b1A4226ba7D9Ad492779c924b0fC00BDCb6217;
address public constant DEPLOYER = 0xF2f1ACbe0BA726fEE8d75f3E32900526874740BB;
address public constant TESTNET_OWNER = 0x12b1A4226ba7D9Ad492779c924b0fC00BDCb6217;

address public constant M_TOKEN = 0x866A2BF4E572CbcF37D5071A7a58503Bfb36be1b;
address public constant WRAPPED_M_TOKEN = 0x437cc33344a0B27A429f795ff6B469C72698B291;
Expand Down
5 changes: 4 additions & 1 deletion script/ConfigureSeismicExtension.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ contract ConfigureSeismicExtension is ScriptBase {

vm.stopBroadcast();

console.log("Extension approved on SwapFacility:", extension);
for (uint256 i; i < infra.length; ++i) {
require(IMYieldToOne(extension).isAllowlisted(infra[i]), "allowlist failed");
}

console.log("Allowlisted Portal:", infra[0]);
if (limitOrderProtocol != address(0)) console.log("Allowlisted LimitOrderProtocol:", limitOrderProtocol);
}
Expand Down
7 changes: 5 additions & 2 deletions script/decrypt-transfer-event.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@
--peer-pubkey the OTHER party's 33-byte compressed public key
--from event `from` topic (sender / approver) — bound into the nonce
--to event `to` topic (recipient / spender) — bound into the nonce
--nonce-counter the contract's encryptedEventNonce value used for this emit (1-based)
--scan try counters 1..max-n until the GCM tag verifies (when the counter is unknown)
--nonce-counter the encryptedEventNonce for this emit (1-based) — read it straight from the
`EncryptedAmountNonce(from, to, nonce)` event the contract emits alongside the
ciphertext; preferred over --scan
--scan legacy fallback: try counters 1..max-n until the GCM tag verifies, for ciphertexts
from logs that predate the EncryptedAmountNonce event (when the counter is unknown)
--ciphertext event payload hex (ciphertext || 16-byte tag)
--self-test verify against vectors pinned from the Seismic precompiles (sforge mercury EVM)

Expand Down
84 changes: 52 additions & 32 deletions script/deploy/DeployBase.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,7 @@ contract DeployBase is DeployHelpers, ScriptBase {
proxy = _deployCreate3TransparentProxy(
implementation,
extensionConfig.admin,
abi.encodeWithSelector(
MYieldToOne.initialize.selector,
extensionConfig.extensionName,
extensionConfig.symbol,
extensionConfig.yieldRecipient,
extensionConfig.admin,
extensionConfig.freezeManager,
extensionConfig.yieldRecipientManager,
extensionConfig.pauser
),
_yieldToOneInitData(extensionConfig),
_computeSalt(deployer, extensionConfig.contractName)
);

Expand All @@ -165,17 +156,7 @@ contract DeployBase is DeployHelpers, ScriptBase {
proxy = _deployCreate3TransparentProxy(
implementation,
extensionConfig.admin,
abi.encodeWithSelector(
MYieldToOneForcedTransfer.initialize.selector,
extensionConfig.extensionName,
extensionConfig.symbol,
extensionConfig.yieldRecipient,
extensionConfig.admin,
extensionConfig.freezeManager,
extensionConfig.yieldRecipientManager,
extensionConfig.pauser,
extensionConfig.forcedTransferManager
),
_yieldToOneForcedTransferInitData(extensionConfig),
_computeSalt(deployer, extensionConfig.contractName)
);

Expand All @@ -193,23 +174,62 @@ contract DeployBase is DeployHelpers, ScriptBase {
proxy = _deployCreate3TransparentProxy(
implementation,
extensionConfig.admin,
abi.encodeWithSelector(
JMIExtension.initialize.selector,
extensionConfig.extensionName,
extensionConfig.symbol,
extensionConfig.yieldRecipient,
extensionConfig.admin,
extensionConfig.assetCapManager,
extensionConfig.freezeManager,
extensionConfig.pauser,
extensionConfig.yieldRecipientManager
),
_jmiExtensionInitData(extensionConfig),
_computeSalt(deployer, extensionConfig.contractName)
);

proxyAdmin = Upgrades.getAdminAddress(proxy);
}

function _yieldToOneInitData(YieldToOneConfig memory c) private pure returns (bytes memory) {
return
abi.encodeWithSelector(
MYieldToOne.initialize.selector,
c.extensionName,
c.symbol,
c.yieldRecipient,
c.admin,
c.freezeManager,
c.yieldRecipientManager,
c.pauser,
c.allowlistAdmin
);
}

function _yieldToOneForcedTransferInitData(
YieldToOneForcedTransferConfig memory c
) private pure returns (bytes memory) {
return
abi.encodeWithSelector(
MYieldToOneForcedTransfer.initialize.selector,
c.extensionName,
c.symbol,
c.yieldRecipient,
c.admin,
c.freezeManager,
c.yieldRecipientManager,
c.pauser,
c.forcedTransferManager,
c.allowlistAdmin
);
}

function _jmiExtensionInitData(JMIExtensionConfig memory c) private pure returns (bytes memory) {
return
abi.encodeWithSelector(
JMIExtension.initialize.selector,
c.extensionName,
c.symbol,
c.yieldRecipient,
c.admin,
c.assetCapManager,
c.freezeManager,
c.pauser,
c.yieldRecipientManager,
c.allowlistAdmin
);
}

function _deployYieldToAllWithFee(
address deployer,
YieldToAllWithFeeConfig memory extensionConfig
Expand Down
1 change: 1 addition & 0 deletions script/deploy/DeployJMIExtension.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ contract DeployJMIExtension is DeployBase {
extensionConfig.freezeManager = vm.envAddress("FREEZE_MANAGER");
extensionConfig.pauser = vm.envAddress("PAUSER");
extensionConfig.yieldRecipientManager = vm.envAddress("YIELD_RECIPIENT_MANAGER");
extensionConfig.allowlistAdmin = vm.envAddress("ALLOWLIST_ADMIN");

// Verify predicted address (if PREDICTED_ADDRESS env var is set)
if (_shouldVerifyPredictedAddress()) {
Expand Down
1 change: 1 addition & 0 deletions script/deploy/DeployYieldToOne.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ contract DeployYieldToOne is DeployBase {
extensionConfig.freezeManager = vm.envAddress("FREEZE_MANAGER");
extensionConfig.yieldRecipientManager = vm.envAddress("YIELD_RECIPIENT_MANAGER");
extensionConfig.pauser = vm.envAddress("PAUSER");
extensionConfig.allowlistAdmin = vm.envAddress("ALLOWLIST_ADMIN");

// Verify predicted address (if PREDICTED_ADDRESS env var is set)
if (_shouldVerifyPredictedAddress()) {
Expand Down
1 change: 1 addition & 0 deletions script/deploy/DeployYieldToOneForcedTransfer.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ contract DeployYieldToOneForcedTransfer is DeployBase {
extensionConfig.yieldRecipientManager = vm.envAddress("YIELD_RECIPIENT_MANAGER");
extensionConfig.pauser = vm.envAddress("PAUSER");
extensionConfig.forcedTransferManager = vm.envAddress("FORCED_TRANSFER_MANAGER");
extensionConfig.allowlistAdmin = vm.envAddress("ALLOWLIST_ADMIN");

// Verify predicted address (if PREDICTED_ADDRESS env var is set)
if (_shouldVerifyPredictedAddress()) {
Expand Down
22 changes: 18 additions & 4 deletions src/projects/jmi/JMIExtension.sol
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ contract JMIExtension is IJMIExtension, JMIExtensionLayout, MYieldToOne {
* @param freezeManager The address of a freeze manager.
* @param pauser The address of a pauser.
* @param yieldRecipientManager The address of a yield recipient manager.
* @param allowlistAdmin The address granted the allowlist admin role (manages the allowlist-manager role).
*/
function initialize(
string memory name,
Expand All @@ -114,7 +115,8 @@ contract JMIExtension is IJMIExtension, JMIExtensionLayout, MYieldToOne {
address assetCapManager,
address freezeManager,
address pauser,
address yieldRecipientManager
address yieldRecipientManager,
address allowlistAdmin
) public virtual initializer {
__JMIExtension_init(
name,
Expand All @@ -124,7 +126,8 @@ contract JMIExtension is IJMIExtension, JMIExtensionLayout, MYieldToOne {
assetCapManager,
freezeManager,
pauser,
yieldRecipientManager
yieldRecipientManager,
allowlistAdmin
);
}

Expand All @@ -138,6 +141,7 @@ contract JMIExtension is IJMIExtension, JMIExtensionLayout, MYieldToOne {
* @param freezeManager The address of a freeze manager.
* @param pauser The address of a pauser.
* @param yieldRecipientManager The address of a yield recipient setter.
* @param allowlistAdmin The address granted the allowlist admin role (manages the allowlist-manager role).
*/
function __JMIExtension_init(
string memory name,
Expand All @@ -147,11 +151,21 @@ contract JMIExtension is IJMIExtension, JMIExtensionLayout, MYieldToOne {
address assetCapManager,
address freezeManager,
address pauser,
address yieldRecipientManager
address yieldRecipientManager,
address allowlistAdmin
) internal onlyInitializing {
if (assetCapManager == address(0)) revert ZeroAssetCapManager();

__MYieldToOne_init(name, symbol, yieldRecipient, admin, freezeManager, yieldRecipientManager, pauser);
__MYieldToOne_init(
name,
symbol,
yieldRecipient,
admin,
freezeManager,
yieldRecipientManager,
pauser,
allowlistAdmin
);

_grantRole(ASSET_CAP_MANAGER_ROLE, assetCapManager);
}
Expand Down
Loading
Loading