Skip to content

Commit

Permalink
update proxy contracts&deployment scritps
Browse files Browse the repository at this point in the history
  • Loading branch information
ungaro committed Jan 13, 2025
1 parent fb1890a commit a277f6f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
36 changes: 21 additions & 15 deletions smart-wallets/script/DeployAssetToken.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,44 @@ import { Script } from "forge-std/Script.sol";
import { Test } from "forge-std/Test.sol";
import { console2 } from "forge-std/console2.sol";

import { AssetTokenProxy } from "../src/proxy/AssetTokenProxy.sol";
import { AssetToken } from "../src/token/AssetToken.sol";

contract DeployAssetToken is Script, Test {

// Address of the admin
// Change this address to your own
address private constant ADMIN_ADDRESS = 0xb015762405De8fD24d29A6e0799c12e0Ea81c1Ff;

// Address of the currency token
address private constant CURRENCY_TOKEN_ADDRESS = 0xe644F07B1316f28a7F134998e021eA9f7135F351;
// pUSD in Plume Mainnet
address private constant CURRENCY_TOKEN_ADDRESS = 0xdddD73F5Df1F0DC31373357beAC77545dC5A6f3F;

function test() public { }

function run() external {
vm.startBroadcast(ADMIN_ADDRESS);

// Deploy implementation
AssetToken assetToken = new AssetToken();

// Initialize the token
assetToken.initialize(
ADMIN_ADDRESS, // owner
"Real World Asset Token", // name
"RWA", // symbol
ERC20(CURRENCY_TOKEN_ADDRESS), // currencyToken
18, // decimals
"https://metadata.uri", // tokenURI
1000e18, // initialSupply
1_000_000e18, // totalValue
false // isWhitelistEnabled
AssetTokenProxy assetTokenProxy = new AssetTokenProxy(
address(assetToken),
abi.encodeCall(
assetTokenProxy.initialize,
(
ADMIN_ADDRESS, // owner
"Real World Asset Token", // name
"RWA", // symbol
ERC20(CURRENCY_TOKEN_ADDRESS), // currencyToken
18, // decimals
"https://metadata.uri", // tokenURI
1000e18, // initialSupply
1_000_000e18, // totalValue
false // isWhitelistEnabled
)
)
);

console2.log("AssetToken deployed to:", address(assetToken));
console2.log("AssetToken deployed to:", address(assetTokenProxy));

vm.stopBroadcast();
}
Expand Down
4 changes: 2 additions & 2 deletions smart-wallets/script/DeployYieldToken.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ contract DeployYieldToken is Script, Test {

// Change these addresses
address private constant ADMIN_ADDRESS = 0xb015762405De8fD24d29A6e0799c12e0Ea81c1Ff;
address private constant CURRENCY_TOKEN_ADDRESS = 0x2DEc3B6AdFCCC094C31a2DCc83a43b5042220Ea2;
address private constant CURRENCY_TOKEN_ADDRESS = 0xdddD73F5Df1F0DC31373357beAC77545dC5A6f3F;
address private constant ASSET_TOKEN_ADDRESS = 0x659619AEdf381c3739B0375082C2d61eC1fD8835;

function test() public { }
Expand All @@ -41,7 +41,7 @@ contract DeployYieldToken is Script, Test {
)
);

console2.log("YieldToken deployed to:", address(yieldToken));
console2.log("YieldToken deployed to:", address(yieldTokenProxy));

vm.stopBroadcast();
}
Expand Down
6 changes: 3 additions & 3 deletions smart-wallets/src/token/YieldToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -546,14 +546,14 @@ contract YieldToken is
emit Withdraw(controller, receiver, controller, assets, shares);
}


function _beforeWithdraw(uint256 assets) internal view {
function _beforeWithdraw(
uint256 assets
) internal view {
YieldTokenStorage storage $ = _getYieldTokenStorage();
uint256 availableAssets = IERC20(asset()).balanceOf(address(this)) - $.yieldBuffer;
require(availableAssets >= assets, "Cannot withdraw from yield buffer");
}


/// @inheritdoc IERC4626
function withdraw(
uint256 assets,
Expand Down

0 comments on commit a277f6f

Please sign in to comment.