diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Accounts/deploying_new_accounts.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Accounts/deploying_new_accounts.adoc index 93c5f59e8a..e988434274 100644 --- a/components/Starknet/modules/architecture_and_concepts/pages/Accounts/deploying_new_accounts.adoc +++ b/components/Starknet/modules/architecture_and_concepts/pages/Accounts/deploying_new_accounts.adoc @@ -44,56 +44,3 @@ A `DEPLOY_ACCOUNT` transaction automatically tells the sequencer to call the `+_ ==== When creating a new account without the `DEPLOY_ACCOUNT` transaction, such as by invoking the Universal Deployer Contract (UDC) with an `INVOKE` transaction, the sequencer calls the `+__validate__+` function, which validates the `INVOKE` transaction. ==== - -''' - -.Solidity Example -[source,solidity] ----- -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.5.0 <0.9.0; - -library Balances { - function move(mapping(address => uint256) storage balances, address from, address to, uint amount) internal { - require(balances[from] >= amount); - require(balances[to] + amount >= balances[to]); - balances[from] -= amount; - balances[to] += amount; - } -} - -contract Token { - mapping(address => uint256) balances; - using Balances for *; - mapping(address => mapping(address => uint256)) allowed; - - event Transfer(address from, address to, uint amount); - event Approval(address owner, address spender, uint amount); - - function transfer(address to, uint amount) external returns (bool success) { - balances.move(msg.sender, to, amount); - emit Transfer(msg.sender, to, amount); - return true; - - } - - function transferFrom(address from, address to, uint amount) external returns (bool success) { - require(allowed[from][msg.sender] >= amount); - allowed[from][msg.sender] -= amount; - balances.move(from, to, amount); - emit Transfer(from, to, amount); - return true; - } - - function approve(address spender, uint tokens) external returns (bool success) { - require(allowed[msg.sender][spender] == 0, ""); - allowed[msg.sender][spender] = tokens; - emit Approval(msg.sender, spender, tokens); - return true; - } - - function balanceOf(address tokenOwner) external view returns (uint balance) { - return balances[tokenOwner]; - } -} ----- \ No newline at end of file