FTM Price: $0.687366 (+6.67%)
Gas: 19.4 GWei
 

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Latest 1 internal transaction

Parent Transaction Hash Block From To
417803882022-07-01 17:39:47828 days ago1656697187  Contract Creation0 FTM
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BaseV1Fees

Compiler Version
v0.8.11+commit.d7f03943

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license
/**
 *Submitted for verification at ftmscan.com on 2022-08-28
*/

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;

interface erc20 {
    function totalSupply() external view returns (uint256);
    function transfer(address recipient, uint amount) external returns (bool);
    function decimals() external view returns (uint8);
    function symbol() external view returns (string memory);
    function balanceOf(address) external view returns (uint);
    function transferFrom(address sender, address recipient, uint amount) external returns (bool);
    function approve(address spender, uint value) external returns (bool);
}

library Math {
    function min(uint a, uint b) internal pure returns (uint) {
        return a < b ? a : b;
    }
    function sqrt(uint y) internal pure returns (uint z) {
        if (y > 3) {
            z = y;
            uint x = y / 2 + 1;
            while (x < z) {
                z = x;
                x = (y / x + x) / 2;
            }
        } else if (y != 0) {
            z = 1;
        }
    }
}

interface IBaseV1Callee {
    function hook(address sender, uint amount0, uint amount1, bytes calldata data) external;
}

interface IBaseV1Factory {
    function protocolAddresses(address _pair) external returns (address);
    function spiritMaker() external returns (address);
    function stableFee() external returns (uint256);
    function variableFee() external returns (uint256);
}

// Base V1 Fees contract is used as a 1:1 pair relationship to split out fees, this ensures that the curve does not need to be modified for LP shares
contract BaseV1Fees {

    address internal immutable factory; // Factory that created the pairs
    address internal immutable pair; // The pair it is bonded to
    address internal immutable token0; // token0 of pair, saved localy and statically for gas optimization
    address internal immutable token1; // Token1 of pair, saved localy and statically for gas optimization

    constructor(address _token0, address _token1, address _factory) {
        pair = msg.sender;
        factory = _factory;
        token0 = _token0;
        token1 = _token1;
    }

    function _safeTransfer(address token,address to,uint256 value) internal {
        require(token.code.length > 0);
        (bool success, bytes memory data) =
        token.call(abi.encodeWithSelector(erc20.transfer.selector, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))));
    }

    // Allow the pair to transfer fees to users
    function claimFeesFor(address recipient, uint amount0, uint amount1) external returns (uint256 claimed0, uint256 claimed1) {
        require(msg.sender == pair);
        uint256 counter = 4;
        // send 25% to protocol address if protocol address exists
        address protocolAddress = IBaseV1Factory(factory).protocolAddresses(pair);
        if (protocolAddress != address(0x0)) {
            if (amount0 > 0) _safeTransfer(token0, protocolAddress, amount0 / 4);
            if (amount1 > 0) _safeTransfer(token1, protocolAddress, amount1 / 4);
            counter--;
        }
        // send 25% to spiritMaker
        address spiritMaker = IBaseV1Factory(factory).spiritMaker();
        if (spiritMaker != address(0x0)) {
            if (amount0 > 0) _safeTransfer(token0, spiritMaker, amount0 / 4);
            if (amount1 > 0) _safeTransfer(token1, spiritMaker, amount1 / 4);
            counter--;
        }
        claimed0 = amount0 * counter / 4;
        claimed1 = amount1 * counter / 4;
        // send the rest to owner of LP
        if (amount0 > 0) _safeTransfer(token0, recipient, claimed0);
        if (amount1 > 0) _safeTransfer(token1, recipient, claimed1);
    }

}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_token0","type":"address"},{"internalType":"address","name":"_token1","type":"address"},{"internalType":"address","name":"_factory","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"claimFeesFor","outputs":[{"internalType":"uint256","name":"claimed0","type":"uint256"},{"internalType":"uint256","name":"claimed1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]

61010060405234801561001157600080fd5b506040516106f63803806106f68339810160408190526100309161006d565b3360a0526001600160a01b0390811660805291821660c0521660e0526100b0565b80516001600160a01b038116811461006857600080fd5b919050565b60008060006060848603121561008257600080fd5b61008b84610051565b925061009960208501610051565b91506100a760408501610051565b90509250925092565b60805160a05160c05160e0516105e66101106000396000818161019e015281816102af0152610354015260008181610163015281816102790152610323015260008181606a015260aa01526000818160da01526101db01526105e66000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063533cf5ce14610030575b600080fd5b61004361003e36600461048c565b61005c565b6040805192835260208301919091520160405180910390f35b600080336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461009457600080fd5b60405162a9652960e61b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116600480840191909152916000917f00000000000000000000000000000000000000000000000000000000000000001690632a594a40906024016020604051808303816000875af1158015610123573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061014791906104c1565b90506001600160a01b038116156101d7578515610193576101937f00000000000000000000000000000000000000000000000000000000000000008261018e60048a6104fb565b610385565b84156101c9576101c97f00000000000000000000000000000000000000000000000000000000000000008261018e6004896104fb565b816101d38161051d565b9250505b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663149f2b276040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610239573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025d91906104c1565b90506001600160a01b038116156102e85786156102a4576102a47f00000000000000000000000000000000000000000000000000000000000000008261018e60048b6104fb565b85156102da576102da7f00000000000000000000000000000000000000000000000000000000000000008261018e60048a6104fb565b826102e48161051d565b9350505b60046102f48489610534565b6102fe91906104fb565b9450600461030c8488610534565b61031691906104fb565b93508615610349576103497f00000000000000000000000000000000000000000000000000000000000000008987610385565b851561037a5761037a7f00000000000000000000000000000000000000000000000000000000000000008986610385565b505050935093915050565b6000836001600160a01b03163b1161039c57600080fd5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916103f89190610553565b6000604051808303816000865af19150503d8060008114610435576040519150601f19603f3d011682016040523d82523d6000602084013e61043a565b606091505b5091509150818015610464575080511580610464575080806020019051810190610464919061058e565b61046d57600080fd5b5050505050565b6001600160a01b038116811461048957600080fd5b50565b6000806000606084860312156104a157600080fd5b83356104ac81610474565b95602085013595506040909401359392505050565b6000602082840312156104d357600080fd5b81516104de81610474565b9392505050565b634e487b7160e01b600052601160045260246000fd5b60008261051857634e487b7160e01b600052601260045260246000fd5b500490565b60008161052c5761052c6104e5565b506000190190565b600081600019048311821515161561054e5761054e6104e5565b500290565b6000825160005b81811015610574576020818601810151858301520161055a565b81811115610583576000828501525b509190910192915050565b6000602082840312156105a057600080fd5b815180151581146104de57600080fdfea26469706673582212204bac78d116270fb57afdda2bece111fae0a7f01d390bf88ae01474c7e139bd1f64736f6c634300080b003300000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b75000000000000000000000000dc301622e621166bd8e82f2ca0a26c13ad0be3550000000000000000000000009d3591719038752db0c8beee2040ffcc3b2c6b9c

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063533cf5ce14610030575b600080fd5b61004361003e36600461048c565b61005c565b6040805192835260208301919091520160405180910390f35b600080336001600160a01b037f00000000000000000000000055167b5917a47eeafe2b1afed12bcb3aaab54255161461009457600080fd5b60405162a9652960e61b81526001600160a01b037f00000000000000000000000055167b5917a47eeafe2b1afed12bcb3aaab542558116600480840191909152916000917f0000000000000000000000009d3591719038752db0c8beee2040ffcc3b2c6b9c1690632a594a40906024016020604051808303816000875af1158015610123573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061014791906104c1565b90506001600160a01b038116156101d7578515610193576101937f00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b758261018e60048a6104fb565b610385565b84156101c9576101c97f000000000000000000000000dc301622e621166bd8e82f2ca0a26c13ad0be3558261018e6004896104fb565b816101d38161051d565b9250505b60007f0000000000000000000000009d3591719038752db0c8beee2040ffcc3b2c6b9c6001600160a01b031663149f2b276040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610239573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025d91906104c1565b90506001600160a01b038116156102e85786156102a4576102a47f00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b758261018e60048b6104fb565b85156102da576102da7f000000000000000000000000dc301622e621166bd8e82f2ca0a26c13ad0be3558261018e60048a6104fb565b826102e48161051d565b9350505b60046102f48489610534565b6102fe91906104fb565b9450600461030c8488610534565b61031691906104fb565b93508615610349576103497f00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b758987610385565b851561037a5761037a7f000000000000000000000000dc301622e621166bd8e82f2ca0a26c13ad0be3558986610385565b505050935093915050565b6000836001600160a01b03163b1161039c57600080fd5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916103f89190610553565b6000604051808303816000865af19150503d8060008114610435576040519150601f19603f3d011682016040523d82523d6000602084013e61043a565b606091505b5091509150818015610464575080511580610464575080806020019051810190610464919061058e565b61046d57600080fd5b5050505050565b6001600160a01b038116811461048957600080fd5b50565b6000806000606084860312156104a157600080fd5b83356104ac81610474565b95602085013595506040909401359392505050565b6000602082840312156104d357600080fd5b81516104de81610474565b9392505050565b634e487b7160e01b600052601160045260246000fd5b60008261051857634e487b7160e01b600052601260045260246000fd5b500490565b60008161052c5761052c6104e5565b506000190190565b600081600019048311821515161561054e5761054e6104e5565b500290565b6000825160005b81811015610574576020818601810151858301520161055a565b81811115610583576000828501525b509190910192915050565b6000602082840312156105a057600080fd5b815180151581146104de57600080fdfea26469706673582212204bac78d116270fb57afdda2bece111fae0a7f01d390bf88ae01474c7e139bd1f64736f6c634300080b0033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b75000000000000000000000000dc301622e621166bd8e82f2ca0a26c13ad0be3550000000000000000000000009d3591719038752db0c8beee2040ffcc3b2c6b9c

-----Decoded View---------------
Arg [0] : _token0 (address): 0x04068DA6C83AFCFA0e13ba15A6696662335D5B75
Arg [1] : _token1 (address): 0xdc301622e621166BD8E82f2cA0A26c13Ad0BE355
Arg [2] : _factory (address): 0x9d3591719038752db0c8bEEe2040FfcC3B2c6B9c

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 00000000000000000000000004068da6c83afcfa0e13ba15a6696662335d5b75
Arg [1] : 000000000000000000000000dc301622e621166bd8e82f2ca0a26c13ad0be355
Arg [2] : 0000000000000000000000009d3591719038752db0c8beee2040ffcc3b2c6b9c


Deployed Bytecode Sourcemap

1567:2175:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2527:1210;;;;;;:::i;:::-;;:::i;:::-;;;;712:25:1;;;768:2;753:18;;746:34;;;;685:18;2527:1210:0;;;;;;;;2614:16;;2669:10;-1:-1:-1;;;;;2683:4:0;2669:18;;2661:27;;;;;;2823:47;;-1:-1:-1;;;2823:47:0;;-1:-1:-1;;;;;2865:4:0;955:32:1;;2717:1:0;2823:47;;;937:51:1;;;;2717:1:0;-1:-1:-1;;2838:7:0;2823:41;;;;910:18:1;;2823:47:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;2797:73;-1:-1:-1;;;;;;2885:31:0;;;2881:239;;2937:11;;2933:68;;2950:51;2964:6;2972:15;2989:11;2999:1;2989:7;:11;:::i;:::-;2950:13;:51::i;:::-;3020:11;;3016:68;;3033:51;3047:6;3055:15;3072:11;3082:1;3072:7;:11;:::i;3033:51::-;3099:9;;;;:::i;:::-;;;;2881:239;3166:19;3203:7;-1:-1:-1;;;;;3188:35:0;;:37;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;3166:59;-1:-1:-1;;;;;;3240:27:0;;;3236:227;;3288:11;;3284:64;;3301:47;3315:6;3323:11;3336;3346:1;3336:7;:11;:::i;3301:47::-;3367:11;;3363:64;;3380:47;3394:6;3402:11;3415;3425:1;3415:7;:11;:::i;3380:47::-;3442:9;;;;:::i;:::-;;;;3236:227;3504:1;3484:17;3494:7;3484;:17;:::i;:::-;:21;;;;:::i;:::-;3473:32;-1:-1:-1;3547:1:0;3527:17;3537:7;3527;:17;:::i;:::-;:21;;;;:::i;:::-;3516:32;-1:-1:-1;3604:11:0;;3600:59;;3617:42;3631:6;3639:9;3650:8;3617:13;:42::i;:::-;3674:11;;3670:59;;3687:42;3701:6;3709:9;3720:8;3687:13;:42::i;:::-;2650:1087;;;2527:1210;;;;;;:::o;2146:324::-;2257:1;2237:5;-1:-1:-1;;;;;2237:17:0;;:21;2229:30;;;;;;2326:58;;;-1:-1:-1;;;;;2115:32:1;;;2326:58:0;;;2097:51:1;2164:18;;;;2157:34;;;2326:58:0;;;;;;;;;;2070:18:1;;;;2326:58:0;;;;;;;-1:-1:-1;;;;;2326:58:0;-1:-1:-1;;;2326:58:0;;;2315:70;;-1:-1:-1;;;;2315:10:0;;;;:70;;2326:58;2315:70;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2270:115;;;;2404:7;:57;;;;-1:-1:-1;2416:11:0;;:16;;:44;;;2447:4;2436:24;;;;;;;;;;;;:::i;:::-;2396:66;;;;;;2218:252;;2146:324;;;:::o;14:131:1:-;-1:-1:-1;;;;;89:31:1;;79:42;;69:70;;135:1;132;125:12;69:70;14:131;:::o;150:383::-;227:6;235;243;296:2;284:9;275:7;271:23;267:32;264:52;;;312:1;309;302:12;264:52;351:9;338:23;370:31;395:5;370:31;:::i;:::-;420:5;472:2;457:18;;444:32;;-1:-1:-1;523:2:1;508:18;;;495:32;;150:383;-1:-1:-1;;;150:383:1:o;999:251::-;1069:6;1122:2;1110:9;1101:7;1097:23;1093:32;1090:52;;;1138:1;1135;1128:12;1090:52;1170:9;1164:16;1189:31;1214:5;1189:31;:::i;:::-;1239:5;999:251;-1:-1:-1;;;999:251:1:o;1255:127::-;1316:10;1311:3;1307:20;1304:1;1297:31;1347:4;1344:1;1337:15;1371:4;1368:1;1361:15;1387:217;1427:1;1453;1443:132;;1497:10;1492:3;1488:20;1485:1;1478:31;1532:4;1529:1;1522:15;1560:4;1557:1;1550:15;1443:132;-1:-1:-1;1589:9:1;;1387:217::o;1609:136::-;1648:3;1676:5;1666:39;;1685:18;;:::i;:::-;-1:-1:-1;;;1721:18:1;;1609:136::o;1750:168::-;1790:7;1856:1;1852;1848:6;1844:14;1841:1;1838:21;1833:1;1826:9;1819:17;1815:45;1812:71;;;1863:18;;:::i;:::-;-1:-1:-1;1903:9:1;;1750:168::o;2202:426::-;2331:3;2369:6;2363:13;2394:1;2404:129;2418:6;2415:1;2412:13;2404:129;;;2516:4;2500:14;;;2496:25;;2490:32;2477:11;;;2470:53;2433:12;2404:129;;;2551:6;2548:1;2545:13;2542:48;;;2586:1;2577:6;2572:3;2568:16;2561:27;2542:48;-1:-1:-1;2606:16:1;;;;;2202:426;-1:-1:-1;;2202:426:1:o;2633:277::-;2700:6;2753:2;2741:9;2732:7;2728:23;2724:32;2721:52;;;2769:1;2766;2759:12;2721:52;2801:9;2795:16;2854:5;2847:13;2840:21;2833:5;2830:32;2820:60;;2876:1;2873;2866:12

Swarm Source

ipfs://4bac78d116270fb57afdda2bece111fae0a7f01d390bf88ae01474c7e139bd1f

Block Transaction Gas Used Reward
view all blocks produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.