// Let's define a function for you to see more comfortablyfunctiontoTokenInfo(bytes1_tokenRefIndex,uint8_method,int128_amount) purereturns (bytes32) {returnbytes32(bytes1(_tokenRefIndex)) |bytes32(bytes2(uint16(_method))) |bytes32(uint256(uint128(uint256(int256(_amount)))));;}functiontoPoolId(uint8_optype,address_pool) purereturns (bytes32){returnbytes32(bytes1(_optype)) |bytes32(uint256(uint160(address(_pool))));}functiontoToken(IERC20 tok) purereturns (Token) {return Token.wrap(bytes32(uint256(uint160(address(tok)))));}functiontoToken(TokenSpecType spec_,uint88 id_,address addr_) purereturns (Token) {return Token.wrap( TokenSpecType.unwrap(spec_) |bytes32((bytes32(uint256(id_)) << ID_SHIFT) & ID_MASK)|bytes32(uint256(uint160(addr_))) );}// use NATIVE_TOKEN for ETH since we don't use weth internallyToken constant NATIVE_TOKEN = Token.wrap(0xEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE); //ref: lib/Token.soluint8constant SWAP =0;uint8constant GAUGE =1;uint8constant CONVERT =2;uint8constant VOTE =3;uint8constant USERBALANCE =4;uint8constant EXACTLY =0;uint8constant AT_MOST =1;uint8constant ALL =2;
The helper functions above will help you populate the Token/poolId/TokenInfo struct.