I've been trying to figure out how to make function calls using in-line assembly (yul)
For example, I have a function _getCurrentRate() where I would like to be capable of calling from several different functions besides this one.
function _getCurrentRate() public view returns (uint256 multiplier) {
assembly {
let pe := sload(periodEnd.slot)
let ps := sload(periodStart.slot)
let rate := sload(compoundRate.slot)
if lt(timestamp(), pe) {
multiplier := add(mul(sub(timestamp(), ps), rate), 1000000000000000000)
}
if iszero(lt(timestamp(), pe)) {
multiplier := 2000000000000000000
}
}
}
However, I have looked through documentation and unable to find any hint as to how to accomplish this! An example implementation of what I am talking about would look similar to this
function calculateSomething() public view returns (uint256 something) {
assembly {
let a := 123456789
let rate := _getCurrentRate()
something := mul(a, rate)
}
}