diff --git a/bridgeToSepolia.sh b/bridgeToSepolia.sh deleted file mode 100644 index 622fb9d..0000000 --- a/bridgeToSepolia.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -DEFAULT_ZKSYNC_LOCAL_KEY="0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110" -DEFAULT_ZKSYNC_ADDRESS="0x36615Cf349d7F6344891B1e7CA7C72883F5dc049" - -ZKSYNC_REGISTRY_MODULE_OWNER_CUSTOM="0x3139687Ee9938422F57933C3CDB3E21EE43c4d0F" -ZKSYNC_TOKEN_ADMIN_REGISTRY="0xc7777f12258014866c677Bdb679D0b007405b7DF" -ZKSYNC_ROUTER="0xA1fdA8aa9A8C4b945C45aD30647b01f07D7A0B16" -ZKSYNC_RNM_PROXY_ADDRESS="0x3DA20FD3D8a8f8c1f1A5fD03648147143608C467" -ZKSYNC_SEPOLIA_CHAIN_SELECTOR="6898391096552792247" -ZKSYNC_LINK_ADDRESS="0x23A1aFD896c8c8876AF46aDc38521f4432658d1e" - -SEPOLIA_REGISTRY_MODULE_OWNER_CUSTOM="0x62e731218d0D47305aba2BE3751E7EE9E5520790" -SEPOLIA_TOKEN_ADMIN_REGISTRY="0x95F29FEE11c5C55d26cCcf1DB6772DE953B37B82" -SEPOLIA_ROUTER="0x0BF3dE8c5D3e8A2B34D2BEeB17ABfCeBaf363A59" -SEPOLIA_RNM_PROXY_ADDRESS="0xba3f6251de62dED61Ff98590cB2fDf6871FbB991" -SEPOLIA_CHAIN_SELECTOR="16015286601757825753" -SEPOLIA_LINK_ADDRESS="0x779877A7B0D9E8603169DdbD7836e478b4624789" -# 3. On ZKsync! - -# Check balance on ZKsync Sepolia -ZKSYNC_BALANCE=$(cast balance $(cast wallet address --account updraft) --erc20 ${ZKSYNC_REBASE_TOKEN_ADDRESS} --rpc-url ${ZKSYNC_SEPOLIA_RPC_URL}) -echo "ZKsync balance: $ZKSYNC_BALANCE" - -# Bridge back to Sepolia -cast send ${ZKSYNC_ROUTER} "ccipSend(uint64,(bytes,bytes,(address,uint256)[]))" ${SEPOLIA_CHAIN_SELECTOR} ($(cast keccak $(cast wallet address --account updraft)),"",[(${ZKSYNC_REBASE_TOKEN_ADDRESS},$(cast max-uint))]) - -# 4. On Sepolia! - -# Withdraw funds from the vault -echo "Withdrawing funds from the vault..." -forge script ./script/Interactions.s.sol:WithdrawScript --rpc-url ${SEPOLIA_RPC_URL} --account updraft --broadcast --sig "run(address)" ${VAULT_ADDRESS} \ No newline at end of file diff --git a/script/BridgeTokens.s.sol b/script/BridgeTokens.s.sol index 77cbedc..47560e3 100644 --- a/script/BridgeTokens.s.sol +++ b/script/BridgeTokens.s.sol @@ -2,55 +2,40 @@ pragma solidity ^0.8.24; import {Script} from "forge-std/Script.sol"; -import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IRouterClient} from "@ccip/contracts/src/v0.8/ccip/interfaces/IRouterClient.sol"; import {Client} from "@ccip/contracts/src/v0.8/ccip/libraries/Client.sol"; +import {IERC20} from "@ccip/contracts/src/v0.8/vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol"; contract BridgeTokensScript is Script { - function createCCIPMessage( - address receiverAddress, - address tokenToSendAddress, - uint256 amountToSend, - address linkTokenAddress - ) public pure returns (Client.EVM2AnyMessage memory) { - // 1. Create the token struct array - Client.EVMTokenAmount[] memory tokenToSendDetails = new Client.EVMTokenAmount[](1); - Client.EVMTokenAmount memory tokenAmount = - Client.EVMTokenAmount({token: tokenToSendAddress, amount: amountToSend}); - tokenToSendDetails[0] = tokenAmount; - // 3. Create the message struct with no data and the designated amount of tokens - Client.EVM2AnyMessage memory message = Client.EVM2AnyMessage({ - receiver: abi.encode(receiverAddress), // we need to encode the address to bytes - data: "", // We don't need any data for this example - tokenAmounts: tokenToSendDetails, // this needs to be of type EVMTokenAmount[] as you could send multiple tokens - feeToken: linkTokenAddress, // The token used to pay for the fee - extraArgs: Client._argsToBytes(Client.EVMExtraArgsV1({gasLimit: 0})) // We don't need any extra args for this example - }); - return message; - } - - function sendMessage( + function run( address receiverAddress, uint64 destinationChainSelector, address tokenToSendAddress, uint256 amountToSend, address linkTokenAddress, - address ccipRouterAddress + address routerAddress ) public { + // struct EVM2AnyMessage { + // bytes receiver; // abi.encode(receiver address) for dest EVM chains + // bytes data; // Data payload + // EVMTokenAmount[] tokenAmounts; // Token transfers + // address feeToken; // Address of feeToken. address(0) means you will send msg.value. + // bytes extraArgs; // Populate this with _argsToBytes(EVMExtraArgsV2) + // } + Client.EVMTokenAmount[] memory tokenAmounts = new Client.EVMTokenAmount[](1); + tokenAmounts[0] = Client.EVMTokenAmount({token: tokenToSendAddress, amount: amountToSend}); vm.startBroadcast(); - // 1. Create the CCIP message - Client.EVM2AnyMessage memory message = - createCCIPMessage(receiverAddress, tokenToSendAddress, amountToSend, linkTokenAddress); - - // 2. Approve the router to burn the tokens - IERC20(tokenToSendAddress).approve(ccipRouterAddress, amountToSend); - - // 4. Approve the router to spend the fees - uint256 ccipFee = IRouterClient(ccipRouterAddress).getFee(destinationChainSelector, message); - IERC20(linkTokenAddress).approve(ccipRouterAddress, ccipFee); // Approve the fee - // 5. Send the message to the router!! - IRouterClient(ccipRouterAddress).ccipSend(destinationChainSelector, message); // Send the message - + Client.EVM2AnyMessage message = Client.EVM2AnyMessage({ + receiver: abi.encode(receiverAddress), + data: "", + tokenAmounts: tokenAmounts, + feeToken: linkTokenAddress, + extraArgs: Client._argsToBytes(Client.EVMExtraArgsV1({gasLimit: 0})) + }); + uint256 ccipFee = IRouterClient(routerAddress).getFee(destinationChainSelector, message); + IERC20(linkTokenAddress).approve(routerAddress, ccipFee); + IERC20(tokenToSendAddress).approve(routerAddress, amountToSend); + IRouterClient(routerAddress).ccipSend(destinationChainSelector, message); vm.stopBroadcast(); } } diff --git a/script/ConfigurePool.s.sol b/script/ConfigurePool.s.sol index 347b9f0..95d6ebd 100644 --- a/script/ConfigurePool.s.sol +++ b/script/ConfigurePool.s.sol @@ -2,29 +2,30 @@ pragma solidity ^0.8.24; import {Script} from "forge-std/Script.sol"; -import {TokenPool} from "@ccip/contracts/src/v0.8/ccip/pools/BurnMintTokenPool.sol"; +import {TokenPool} from "@ccip/contracts/src/v0.8/ccip/pools/TokenPool.sol"; import {RateLimiter} from "@ccip/contracts/src/v0.8/ccip/libraries/RateLimiter.sol"; contract ConfigurePoolScript is Script { - function createChainUpdateObject( + function run( + address localPool, uint64 remoteChainSelector, - address remotePoolAddress, - address remoteTokenAddress, + address remotePool, + address remoteToken, bool outboundRateLimiterIsEnabled, uint128 outboundRateLimiterCapacity, uint128 outboundRateLimiterRate, bool inboundRateLimiterIsEnabled, uint128 inboundRateLimiterCapacity, uint128 inboundRateLimiterRate - ) public pure returns (TokenPool.ChainUpdate[] memory) { + ) public { + vm.startBroadcast(); bytes[] memory remotePoolAddresses = new bytes[](1); - remotePoolAddresses[0] = abi.encode(address(remotePoolAddress)); - - TokenPool.ChainUpdate[] memory chains = new TokenPool.ChainUpdate[](1); - chains[0] = TokenPool.ChainUpdate({ + remotePoolAddresses[0] = abi.encode(remotePool); + TokenPool.ChainUpdate[] memory chainsToAdd = new TokenPool.ChainUpdate[](1); + chainsToAdd[0] = TokenPool.ChainUpdate({ remoteChainSelector: remoteChainSelector, remotePoolAddresses: remotePoolAddresses, - remoteTokenAddress: abi.encode(remoteTokenAddress), + remoteTokenAddress: abi.encode(remoteToken), outboundRateLimiterConfig: RateLimiter.Config({ isEnabled: outboundRateLimiterIsEnabled, capacity: outboundRateLimiterCapacity, @@ -36,38 +37,6 @@ contract ConfigurePoolScript is Script { rate: inboundRateLimiterRate }) }); - return chains; - } - - function run( - address ccipChainPoolAddress, - uint64 remoteChainSelector, - address remotePoolAddress, - address remoteTokenAddress, - bool outboundRateLimiterIsEnabled, - uint128 outboundRateLimiterCapacity, - uint128 outboundRateLimiterRate, - bool inboundRateLimiterIsEnabled, - uint128 inboundRateLimiterCapacity, - uint128 inboundRateLimiterRate - ) public { - vm.startBroadcast(); - - TokenPool tokenPool = TokenPool(ccipChainPoolAddress); - TokenPool.ChainUpdate[] memory chains = createChainUpdateObject( - remoteChainSelector, - remotePoolAddress, - remoteTokenAddress, - outboundRateLimiterIsEnabled, - outboundRateLimiterCapacity, - outboundRateLimiterRate, - inboundRateLimiterIsEnabled, - inboundRateLimiterCapacity, - inboundRateLimiterRate - ); - uint64[] memory remoteChainSelectorsToRemove = new uint64[](0); - tokenPool.applyChainUpdates(remoteChainSelectorsToRemove, chains); - - vm.stopBroadcast(); + TokenPool(localPool).applyChainUpdates(new uint64[](0), chainsToAdd); } } diff --git a/script/Deployer.s.sol b/script/Deployer.s.sol index e3d6b1c..12de428 100644 --- a/script/Deployer.s.sol +++ b/script/Deployer.s.sol @@ -2,68 +2,41 @@ pragma solidity ^0.8.24; import {Script} from "forge-std/Script.sol"; -import {CCIPLocalSimulatorFork, Register} from "@chainlink/local/src/ccip/CCIPLocalSimulatorFork.sol"; + +import {CCIPLocalSimulatorFork, Register} from "@chainlink-local/src/ccip/CCIPLocalSimulatorFork.sol"; + +import {IERC20} from "@ccip/contracts/src/v0.8/vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol"; import {RegistryModuleOwnerCustom} from "@ccip/contracts/src/v0.8/ccip/tokenAdminRegistry/RegistryModuleOwnerCustom.sol"; import {TokenAdminRegistry} from "@ccip/contracts/src/v0.8/ccip/tokenAdminRegistry/TokenAdminRegistry.sol"; -import {IERC20} from "@ccip/contracts/src/v0.8/vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol"; import {RebaseToken} from "../src/RebaseToken.sol"; -import {IRebaseToken} from "../src/interfaces/IRebaseToken.sol"; import {RebaseTokenPool} from "../src/RebaseTokenPool.sol"; import {Vault} from "../src/Vault.sol"; -contract TokenDeployer is Script { - CCIPLocalSimulatorFork public ccipLocalSimulatorFork; - Register.NetworkDetails public networkDetails; - - RegistryModuleOwnerCustom public registryModuleOwnerCustom; - TokenAdminRegistry public tokenAdminRegistry; +import {IRebaseToken} from "../src/interfaces/IRebaseToken.sol"; +contract TokenAndPoolDeployer is Script { function run() public returns (RebaseToken token, RebaseTokenPool pool) { - ccipLocalSimulatorFork = new CCIPLocalSimulatorFork(); - networkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); - - registryModuleOwnerCustom = RegistryModuleOwnerCustom(networkDetails.registryModuleOwnerCustomAddress); - tokenAdminRegistry = TokenAdminRegistry(networkDetails.tokenAdminRegistryAddress); + CCIPLocalSimulatorFork ccipLocalSimulatorFork = new CCIPLocalSimulatorFork(); + Register.NetworkDetails memory networkDetails = ccipLocalSimulatorFork.getNetworkDetails(block.chainid); vm.startBroadcast(); - - // Step 1) Deploy token token = new RebaseToken(); - - // Step 2) Deploy pool - address[] memory allowlist = new address[](0); pool = new RebaseTokenPool( - IERC20(address(token)), allowlist, networkDetails.rmnProxyAddress, networkDetails.routerAddress + IERC20(address(token)), new address[](0), networkDetails.rmnProxyAddress, networkDetails.routerAddress ); - token.grantMintAndBurnRole(address(pool)); - - // Step 4) Claim Admin role - registryModuleOwnerCustom.registerAdminViaOwner(address(token)); - - // Step 5) Accept Admin role - tokenAdminRegistry.acceptAdminRole(address(token)); - - // Step 6) Link token to pool - tokenAdminRegistry.setPool(address(token), address(pool)); - + RegistryModuleOwnerCustom(networkDetails.registryModuleOwnerCustomAddress).registerAdminViaOwner(address(token)); + TokenAdminRegistry(networkDetails.tokenAdminRegistryAddress).acceptAdminRole(address(token)); + TokenAdminRegistry(networkDetails.tokenAdminRegistryAddress).setPool(address(token), address(pool)); vm.stopBroadcast(); } } -// Only on the source chain! contract VaultDeployer is Script { function run(address _rebaseToken) public returns (Vault vault) { - // NOTE: what can I do instead of this by making it interactive? Do I even need this line if I'm using a wallet for this? - //uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); vm.startBroadcast(); - - // Step 1) Deploy the vault vault = new Vault(IRebaseToken(_rebaseToken)); - - // Step 2) Claim burn and mint role IRebaseToken(_rebaseToken).grantMintAndBurnRole(address(vault)); - vm.stopBroadcast(); } } diff --git a/src/RebaseToken.sol b/src/RebaseToken.sol index 6855b24..c3402d1 100644 --- a/src/RebaseToken.sol +++ b/src/RebaseToken.sol @@ -6,9 +6,11 @@ import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol"; /* - * @title RebaseToken - * @author Ciara Nightingale - * @notice This contract is a cross-chain token that allows users to mint and burn tokens with interest. Users deposit into the Vault on the source chain and are minted tokens. They can then send these tokens cross-chain or transfer them to someone else. Whatever interest they have accrued since the last time their balance was updated is minted to them. When they redeem their tokens, their interest is also minted to them and then whatever they redeem is burned. The users interest is equal to the contract interest rate at the time of minting (or reciving a token transfer if the reciever does not already have an interestRate). This is true even when they bridge their tokens to another chain. The interest rate is updated by the protocol on the source chain and can only decrease over time. +* @title RebaseToken +* @author Ciara Nightingale +* @notice This is a cross-chain rebase token that incentivises users to deposit into a vault and gain interest in rewards. +* @notice The interest rate in the smart contract can only decrease +* @notice Each will user will have their own interest rate that is the global interest rate at the time of depositing. */ contract RebaseToken is ERC20, Ownable, AccessControl { ///////////////////// @@ -24,14 +26,9 @@ contract RebaseToken is ERC20, Ownable, AccessControl { ///////////////////// // Events ///////////////////// - event UserInterestRateUpdated(address indexed user, uint256 newUserInterestRate); - event ToInterestAccrued(address indexed user, uint256 balance); - event FromInterestAccrued(address indexed user, uint256 balance); event InterestRateUpdated(uint256 newInterestRate); - constructor() Ownable(msg.sender) ERC20("RebaseToken", "RBT") { - _grantRole(MINT_AND_BURN_ROLE, msg.sender); // so that the owner can update the interest rate - } + constructor() Ownable(msg.sender) ERC20("RebaseToken", "RBT") {} ///////////////////// // Functions @@ -52,12 +49,18 @@ contract RebaseToken is ERC20, Ownable, AccessControl { * @notice only allow the interest rate to decrease but we don't want it to revert in case it's the destination chain that is updating the interest rate (in which case it'll either be the same or larger so it won't update) * */ - function setInterestRate(uint256 _interestRate) external onlyOwner { - if (_interestRate < s_interestRate) { - // if this is coming from the destination chain, this wont be updated since it will be greater (or equal to) the current interest rate - s_interestRate = _interestRate; - emit InterestRateUpdated(_interestRate); + /** + * @notice Set the interest rate in the contract + * @param _newInterestRate The new interest rate to set + * @dev The interest rate can only decrease + */ + function setInterestRate(uint256 _newInterestRate) external onlyOwner { + // Set the interest rate + if (_newInterestRate >= s_interestRate) { + revert RebaseToken__InterestRateCanOnlyDecrease(s_interestRate, _newInterestRate); } + s_interestRate = _newInterestRate; + emit InterestRateSet(_newInterestRate); } /** * @dev returns the principal balance of the user. The principal balance is the last @@ -78,9 +81,9 @@ contract RebaseToken is ERC20, Ownable, AccessControl { /// @dev this function increases the total supply. function mint(address _account, uint256 _value, uint256 _interestRate) public onlyRole(MINT_AND_BURN_ROLE) { // Mints any existing interest that has accrued since the last time the user's balance was updated. - _beforeUpdate(address(0), _account); + _mintAccruedInterest(_to); // Sets the users interest rate to either their bridged value if they are bridging or to the current interest rate if they are depositing. - _setUserInterestRate(_account, _interestRate); + s_userInterestRate[_to] = _userInterestRate; _mint(_account, _value); } @@ -90,10 +93,7 @@ contract RebaseToken is ERC20, Ownable, AccessControl { /// @dev this function decreases the total supply. function burn(address _account, uint256 _value) public onlyRole(MINT_AND_BURN_ROLE) { // Mints any existing interest that has accrued since the last time the user's balance was updated. - if (_value == type(uint256).max) { - _value = balanceOf(_account); - } - _beforeUpdate(_account, address(0)); + _mintAccruedInterest(_from); _burn(_account, _value); } @@ -126,10 +126,11 @@ contract RebaseToken is ERC20, Ownable, AccessControl { if (_amount == type(uint256).max) { _amount = balanceOf(msg.sender); } - _beforeUpdate(msg.sender, _recipient); + _mintAccruedInterest(msg.sender); + _mintAccruedInterest(_recipient); if (balanceOf(_recipient) == 0) { // Update the users interest rate only if they have not yet got one (or they tranferred/burned all their tokens). Otherwise people could force others to have lower interest. - _setUserInterestRate(_recipient, s_userInterestRate[msg.sender]); + s_userInterestRate[_recipient] = s_userInterestRate[msg.sender]; } return super.transfer(_recipient, _amount); } @@ -147,28 +148,15 @@ contract RebaseToken is ERC20, Ownable, AccessControl { _amount = balanceOf(_sender); } // accumulates the balance of the user so it is up to date with any interest accumulated. - _beforeUpdate(_sender, _recipient); + _mintAccruedInterest(_sender); + _mintAccruedInterest(_recipient); if (balanceOf(_recipient) == 0) { // Update the users interest rate only if they have not yet got one (or they tranferred/burned all their tokens). Otherwise people could force others to have lower interest. - _setUserInterestRate(_recipient, s_userInterestRate[_sender]); + s_userInterestRate[_recipient] = s_userInterestRate[_sender]; } return super.transferFrom(_sender, _recipient, _amount); } - /** - * @dev updates the interest rate. This is called only by the pool when a user bridges to this chain. - * @param _interestRate the new interest rate - * @notice this is called when a bridges tokens to this chain - * - */ - function _setUserInterestRate(address _user, uint256 _interestRate) internal { - // called when a user deposits, bridges tokens to this chain or is transferred tokens by another user - // needs to be called alongside _beforeUpdate to make sure the users last updated timestamp is set. - // update the user's interest rate - s_userInterestRate[_user] = _interestRate; - emit UserInterestRateUpdated(_user, _interestRate); - } - /** * @dev returns the interest accrued since the last update of the user's balance - aka since the last time the interest accrued was minted to the user. * @return linearInterest the interest accrued since the last update @@ -190,13 +178,13 @@ contract RebaseToken is ERC20, Ownable, AccessControl { * @return currentBalance users new balance * */ - function _mintAccruedInterest(address _user) internal returns (uint256 currentBalance) { + function _mintAccruedInterest(address _user) internal { // Get the user's previous principal balance. The amount of tokens they had last time their interest was minted to them. uint256 previousPrincipalBalance = super.balanceOf(_user); // Calculate the accrued interest since the last accumulation // `balanceOf` uses the user's interest rate and the time since their last update to get the updated balance - currentBalance = balanceOf(_user); + uint256 currentBalance = balanceOf(_user); uint256 balanceIncrease = currentBalance - previousPrincipalBalance; // Mint an amount of tokens equivalent to the interest accrued @@ -205,27 +193,6 @@ contract RebaseToken is ERC20, Ownable, AccessControl { s_userLastUpdatedTimestamp[_user] = block.timestamp; } - /** - * @dev executes the transfer of tokens, invoked by _transfer(), _mint() and _burn() - * @param _from the address from which transfer the tokens - * @param _to the destination address - * - */ - function _beforeUpdate(address _from, address _to) internal { - if (_from != address(0)) { - // we are burning or transferring tokens - // mint any accrued interest since the last time the user's balance was updated - (uint256 fromBalance) = _mintAccruedInterest(_from); - emit FromInterestAccrued(_from, fromBalance); - } - if (_to != address(0)) { - // we are minting or transferring tokens - // mint any accrued interest since the last time the user's balance was updated - uint256 toBalance = _mintAccruedInterest(_to); - emit ToInterestAccrued(_to, toBalance); - } - } - /** * @dev returns the global interest rate of the token for future depositors * @return s_interestRate diff --git a/src/RebaseTokenPool.sol b/src/RebaseTokenPool.sol index 8be9829..5406ed8 100644 --- a/src/RebaseTokenPool.sol +++ b/src/RebaseTokenPool.sol @@ -17,17 +17,16 @@ contract RebaseTokenPool is TokenPool { external virtual override - returns (Pool.LockOrBurnOutV1 memory) + returns (Pool.LockOrBurnOutV1 memory lockOrBurnOut) { _validateLockOrBurn(lockOrBurnIn); - address receiver = abi.decode(lockOrBurnIn.receiver, (address)); // Burn the tokens on the source chain. This returns their userAccumulatedInterest before the tokens were burned (in case all tokens were burned, we don't want to send 0 cross-chain) - uint256 userInterestRate = IRebaseToken(address(i_token)).getUserInterestRate(receiver); + uint256 userInterestRate = IRebaseToken(address(i_token)).getUserInterestRate(lockOrBurnIn.originalSender); //uint256 currentInterestRate = IRebaseToken(address(i_token)).getInterestRate(); IRebaseToken(address(i_token)).burn(address(this), lockOrBurnIn.amount); // encode a function call to pass the caller's info to the destination pool and update it - return Pool.LockOrBurnOutV1({ + lockOrBurnOut = Pool.LockOrBurnOutV1({ destTokenAddress: getRemoteToken(lockOrBurnIn.remoteChainSelector), destPoolData: abi.encode(userInterestRate) }); diff --git a/src/Vault.sol b/src/Vault.sol index 6a3c1d1..473f5f1 100644 --- a/src/Vault.sol +++ b/src/Vault.sol @@ -32,9 +32,7 @@ contract Vault { if (_amount == type(uint256).max) { _amount = i_rebaseToken.balanceOf(msg.sender); } - i_rebaseToken.burn(msg.sender, _amount); - // executes redeem of the underlying asset (bool success,) = payable(msg.sender).call{value: _amount}(""); if (!success) { diff --git a/src/interfaces/IRebaseToken.sol b/src/interfaces/IRebaseToken.sol index a43f5c1..4a82da1 100644 --- a/src/interfaces/IRebaseToken.sol +++ b/src/interfaces/IRebaseToken.sol @@ -1,13 +1,11 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.24; +pragma solidity ^0.8.24; interface IRebaseToken { - function burn(address from, uint256 amount) external; - function mint(address to, uint256 amount, uint256 interestRate) external; + function mint(address _to, uint256 _amount, uint256 _interestRate) external; + function burn(address _from, uint256 _amount) external; + function balanceOf(address _account) external view returns (uint256); + function getUserInterestRate(address _account) external view returns (uint256); function getInterestRate() external view returns (uint256); - function getUserInterestRate(address user) external view returns (uint256); - function setUserInterestRate(address user, uint256 newInterestRate) external; - function setInterestRate(uint256 newInterestRate) external; - function grantMintAndBurnRole(address account) external; - function balanceOf(address account) external view returns (uint256); + function grantMintAndBurnRole(address _account) external; } diff --git a/src/interfaces/IRebaseTokenPool.sol b/src/interfaces/IRebaseTokenPool.sol deleted file mode 100644 index 9ee40c2..0000000 --- a/src/interfaces/IRebaseTokenPool.sol +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.24; - -interface IRebaseTokenPool { - function deposit() external payable; - function redeem(uint256 amount) external; -} diff --git a/test/CrossChain.t.sol b/test/CrossChain.t.sol index 6878e48..14e68e0 100644 --- a/test/CrossChain.t.sol +++ b/test/CrossChain.t.sol @@ -180,7 +180,7 @@ contract CrossChainTest is Test { receiver: abi.encode(alice), // we need to encode the address to bytes data: "", // We don't need any data for this example tokenAmounts: tokenToSendDetails, // this needs to be of type EVMTokenAmount[] as you could send multiple tokens - extraArgs: Client._argsToBytes(Client.EVMExtraArgsV1({gasLimit: 0})), // We don't need any extra args for this example + extraArgs: "", // We don't need any extra args for this example feeToken: localNetworkDetails.linkAddress // The token used to pay for the fee }); // Get and approve the fees